-
Notifications
You must be signed in to change notification settings - Fork 29.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tools: migrate to ESLint flat config and update ESLint to v9.3.0 #52780
Conversation
Review requested:
|
@nodejs/linting |
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. |
Maybe we can use an non-confusing name, |
SGTM. I'll wait a few days to see if there are other suggestions. |
Done! I went with |
Looks like |
@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 |
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); |
This is ready for reviews. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
🤔 |
Also worth running on a windows machine before landing |
I developed it on Windows. |
Note that |
Proof it works after deleting the symlink:
|
(╯°□°)╯︵ ┻━┻ |
dc6f540
to
1739756
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gogogogogogogogogogo
@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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might make sense to wait for #53023 to land and get rid of this.
Landed in 7e6d92c |
Closes: #52567 PR-URL: #52780 Fixes: #52567 Reviewed-By: Moshe Atlow <[email protected]> Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: Antoine du Hamel <[email protected]>
Closes: nodejs#52567 PR-URL: nodejs#52780 Fixes: nodejs#52567 Reviewed-By: Moshe Atlow <[email protected]> Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: Antoine du Hamel <[email protected]>
Closes: nodejs#52567 PR-URL: nodejs#52780 Fixes: nodejs#52567 Reviewed-By: Moshe Atlow <[email protected]> Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: Antoine du Hamel <[email protected]>
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
.