Uh oh!
There was an error while loading. Please reload this page.
tools: migrate to ESLint flat config and update ESLint to v9.3.0 - #52780
Conversation
nodejs-github-bot
commented
May 1, 2024
Review requested:
|
Uh oh!
There was an error while loading. Please reload this page.
targos
commented
May 2, 2024
@nodejs/linting |
Uh oh!
There was an error while loading. Please reload this page.
aduh95
commented
May 2, 2024
To me, the most obvious choice would be to have them in each directory (e.g. |
I think this would be confusing, because they would not be ESLint config files, just partials for the real config, and it would make people think they work like the old config system. |
aduh95
commented
May 2, 2024
Maybe we can use an non-confusing name, |
targos
commented
May 2, 2024
SGTM. I'll wait a few days to see if there are other suggestions. |
targos
commented
May 6, 2024
Done! I went with |
targos
commented
May 6, 2024
Looks like |
anonrig
commented
May 6, 2024
@targos Can we also enable indentation rule for "Makefile" file? |
You can hard-code to exclude it from the JS2C like this: diff --git a/tools/js2c.cc b/tools/js2c.cc
index e0f3d88447..a536b5dcd8 100644
--- a/tools/js2c.cc+++ b/tools/js2c.cc@@ -928,6 +928,13 @@ int Main(int argc, char* argv[]) {
auto mjs_it = file_map.find(".mjs");
assert(js_it != file_map.end() && mjs_it != file_map.end());
+ auto it = std::find(mjs_it->second.begin(),+ mjs_it->second.end(),+ "lib/eslint.config_partial.mjs");+ if (it != mjs_it->second.end()) {+ mjs_it->second.erase(it);+ }+
std::sort(js_it->second.begin(), js_it->second.end());
std::sort(mjs_it->second.begin(), mjs_it->second.end());(Or make it more flexible as another vector to ignore, or make it an argument, or prefix it with a dot and ignore all files beginning with a dot in |
joyeecheung
commented
May 7, 2024
If you want to ignore all files beginning with a dot, probably just do this (not sure if we have any files starting with a dot that we actually want to include in the binary, I am guessing we don't): diff --git a/tools/js2c.cc b/tools/js2c.cc
index e0f3d88447..d94fd33a0d 100644
--- a/tools/js2c.cc+++ b/tools/js2c.cc@@ -123,6 +123,10 @@ bool SearchFiles(const std::string& dir,
break;
}
+ if (StartsWith(dent.name, ".")) {+ continue;+ }+
std::string path = dir + '/' + dent.name;
if (EndsWith(path, extension)) {
files.emplace_back(path); |
targos
commented
May 7, 2024
targos
commented
May 8, 2024
This is ready for reviews. |
nodejs-github-bot
commented
May 8, 2024
targos
commented
May 8, 2024
🤔 |
MoLow
commented
May 8, 2024
Also worth running on a windows machine before landing |
targos
commented
May 8, 2024
I developed it on Windows. |
targos
commented
May 8, 2024
Note that |
Proof it works after deleting the symlink: |
nodejs-github-bot
commented
May 22, 2024
targos
commented
May 22, 2024
nodejs-github-bot
commented
May 22, 2024
targos
commented
May 23, 2024
@aduh95 Would you like to have another look? |
| export const noRestrictedSyntaxCommonTest = [ | ||
| { | ||
| // TODO(@panva): move this to no-restricted-properties | ||
| // when https://github.com/eslint/eslint/issues/16412 is fixed. | ||
| selector: "Identifier[name='webcrypto']", | ||
| message: 'Use `globalThis.crypto`.', | ||
| }, | ||
| ]; |
There was a problem hiding this comment.
It might make sense to wait for #53023 to land and get rid of this.
nodejs-github-bot
commented
May 23, 2024
Landed in 7e6d92c |
Closes: nodejs#52567 PR-URL: nodejs#52780Fixes: nodejs#52567 Reviewed-By: Moshe Atlow <moshe@atlow.co.il> Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>

Closes: #52567
Not completely ready. I have to double check some things because there are reported errors.
I'm opening the PR to ask a question:
For now, I put the entire config in one file. I would like to split it into multiple files to make it more readable but I'm not sure what approach to take. My current idea is to create a new folder, probably somewhere in
tools.