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.2.0 #52780
base: main
Are you sure you want to change the base?
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:
|
Retrying node-test-linter: https://ci.nodejs.org/job/node-test-linter/54555/ |
It's probably eslint/eslint#18301, only fixed in ESLint v9. I'll add the ESLint update to this PR. |
Blocked on #52889 |
Added the update to ESLint v9 |
Triggered https://ci.nodejs.org/job/node-test-linter/54577/console and it failed :(
|
It must be running a very old version of node ! |
|
|
We need to upgrade the host. Node.js 18+ can't run on Ubuntu 18. Opened nodejs/build#3713 |
2d73458
to
67d957e
Compare
67d957e
to
d96abc4
Compare
Rebased, reworded the first commit so the PR can be squashed, and separated additional fixes from the ESLint update to ease reviews. (this is still blocked on updates of the build machines) |
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
.