* [pve-devel] [PATCH eslint] change from CLIEngine to ESLint
@ 2021-12-02 12:54 Dominik Csapak
2021-12-06 13:40 ` [pve-devel] applied: " Thomas Lamprecht
0 siblings, 1 reply; 2+ messages in thread
From: Dominik Csapak @ 2021-12-02 12:54 UTC (permalink / raw)
To: pve-devel
8.0 officialy removed CLIEngine (though it's still in git) so use
the current and supported API.
Necessary changes:
* use 'ESLint' instead of 'CLIEngine'
* use 'lintFiles' instead of 'executeOnFiles' (thats async now)
* adapt to the change of return value of 'lintFiles'
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
after appliying this, we have to 'make buildupstream' again, since the
included code changes (CLIEngine -> ESLint)
patches/0001-adapt-webpack-config.patch | 2 +-
src/bin/app.js | 4 ++--
src/lib/worker.js | 12 +++++++-----
3 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/patches/0001-adapt-webpack-config.patch b/patches/0001-adapt-webpack-config.patch
index b0201e1..a1235d3 100644
--- a/patches/0001-adapt-webpack-config.patch
+++ b/patches/0001-adapt-webpack-config.patch
@@ -22,7 +22,7 @@ index a22c99b..9209159 100644
+ target: "node",
entry: {
- eslint: ["core-js/stable", "regenerator-runtime/runtime", "./lib/linter/linter.js"]
-+ eslint: ["core-js/stable", "regenerator-runtime/runtime", "./lib/linter/linter.js", "./lib/cli-engine/index.js"]
++ eslint: ["core-js/stable", "regenerator-runtime/runtime", "./lib/linter/linter.js", "./lib/eslint/index.js"]
},
output: {
filename: "[name].js",
diff --git a/src/bin/app.js b/src/bin/app.js
index 10e7e6a..a1ba89f 100644
--- a/src/bin/app.js
+++ b/src/bin/app.js
@@ -313,7 +313,7 @@ promises.push(eslint.createWorker({
files: paths
}));
-let results = (await Promise.all(promises)).map(res => res.results).flat(1);
+let results = (await Promise.all(promises)).flat(1);
let exitcode = 0;
let files_err = [], files_warn = [], files_ok = [];
@@ -390,7 +390,7 @@ console.log('------------------------------------------------------------');
if (program.fix) {
if (fixes > 0) {
console.log(`Writing ${color.bold(fixes)} fixed files...`);
- eslint.CLIEngine.outputFixes({ results });
+ eslint.ESLint.outputFixes({ results });
console.log('Done');
} else {
console.log("No fixable Errors/Warnings found.");
diff --git a/src/lib/worker.js b/src/lib/worker.js
index 9a8c955..000209e 100644
--- a/src/lib/worker.js
+++ b/src/lib/worker.js
@@ -3,11 +3,13 @@
const worker = require('worker_threads');
if (!worker.isMainThread) {
- const eslint = require('pve-eslint');
- const data = worker.workerData;
- const cli = new eslint.CLIEngine(data.cliOptions);
- const report = cli.executeOnFiles(data.files);
- worker.parentPort.postMessage(report);
+ (async function() {
+ const eslint = require('pve-eslint');
+ const data = worker.workerData;
+ const cli = new eslint.ESLint(data.cliOptions);
+ const report = await cli.lintFiles(data.files);
+ worker.parentPort.postMessage(report);
+ })();
} else {
module.exports = async function createWorker(workerData) {
return new Promise((resolve, reject) => {
--
2.30.2
^ permalink raw reply [flat|nested] 2+ messages in thread
* [pve-devel] applied: [PATCH eslint] change from CLIEngine to ESLint
2021-12-02 12:54 [pve-devel] [PATCH eslint] change from CLIEngine to ESLint Dominik Csapak
@ 2021-12-06 13:40 ` Thomas Lamprecht
0 siblings, 0 replies; 2+ messages in thread
From: Thomas Lamprecht @ 2021-12-06 13:40 UTC (permalink / raw)
To: Proxmox VE development discussion, Dominik Csapak
On 02.12.21 13:54, Dominik Csapak wrote:
> 8.0 officialy removed CLIEngine (though it's still in git) so use
> the current and supported API.
>
> Necessary changes:
> * use 'ESLint' instead of 'CLIEngine'
> * use 'lintFiles' instead of 'executeOnFiles' (thats async now)
> * adapt to the change of return value of 'lintFiles'
>
> Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
> ---
> after appliying this, we have to 'make buildupstream' again, since the
> included code changes (CLIEngine -> ESLint)
>
> patches/0001-adapt-webpack-config.patch | 2 +-
> src/bin/app.js | 4 ++--
> src/lib/worker.js | 12 +++++++-----
> 3 files changed, 10 insertions(+), 8 deletions(-)
>
>
applied, thanks!
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-12-06 13:40 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-02 12:54 [pve-devel] [PATCH eslint] change from CLIEngine to ESLint Dominik Csapak
2021-12-06 13:40 ` [pve-devel] applied: " Thomas Lamprecht
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal