From: Dominik Csapak <d.csapak@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH eslint] change from CLIEngine to ESLint
Date: Thu, 2 Dec 2021 13:54:18 +0100 [thread overview]
Message-ID: <20211202125418.41303-1-d.csapak@proxmox.com> (raw)
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
next reply other threads:[~2021-12-02 12:54 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-02 12:54 Dominik Csapak [this message]
2021-12-06 13:40 ` [pve-devel] applied: " Thomas Lamprecht
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211202125418.41303-1-d.csapak@proxmox.com \
--to=d.csapak@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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