-
-
Notifications
You must be signed in to change notification settings - Fork 32
feat!: move to ESM only #516
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
Conversation
One of the ci failures seems to be some funk with unsupported API imports I'll figure it out tomorrow |
lib/index.js
Outdated
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.
This is generated by hand now? Authors of new rules usually forget to update this kind of thing so just want to confirm tests/index.js
verifies everything is included here properly?
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 is
we could write a script to auto generate it if that helps
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's fine for now.
yeah im pretty sure its just how long it takes typescript to run but im not sure what we can do about that other than increase the timeout for that specific test |
lib/rules/no-property-in-node.js
Outdated
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.
Thread about the test failure in Node 21-24.
Looks like it's just this rule only.
1068 passing (7s)
1 failing
1) no-property-in-node
valid
'a' in window;:
Error: Timeout of 2000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (/home/runner/work/eslint-plugin-eslint-plugin/eslint-plugin-eslint-plugin/tests/lib/rules/no-property-in-node.js)
at process.processImmediate (node:internal/timers:478:21)
CC: @JoshuaKGoldberg who authored the rule in case he has any ideas
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.
I'm updating TS dependencies just in case:
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.
Even if it's not something that gets merged, it'd be interesting to know if extending the timeout does indeed allow the tests to pass, or if it's something more significant
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.
I'll try and repro it locally, when i get home
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.
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.
Increasing the mocha timeout from 2000ms to 3000ms (--timeout 3000
) didn't fix it. Unclear how long the timeout would need to be to accommodate this test file.
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.
I could take a stab at moving the repo to vitest
(in place of mocha / c8) in a separate change, if that would help.
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.
Yes, would be open to a separate PR to move to vitest first, assuming that has advantages over the current setup.
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.
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.
@43081j this merged, if you want to rebase when you're able.
This change moves the test runner from `mocha` + `nyc` to `vitest`. In order to import `vitest` the tests had to be in esm, so I checked out everything under the `tests` folder from eslint-community#516 (leaving the source as it was). I also moved the `eslint-rule-tester` out of the `tests/lib` folder and into its own `utils` folder. That way vitest didn't treat it as a test. Note: rather than using `vitest`'s preferred `v8` coverage reporter, I used the `istanbul` one, to ensure the coverages between old and new were the same. I did notice that when I tried the `v8` coverage reporter, the coverage numbers were much less. Something to consider as a follow-up change. The v8 reporter *should* be more accurate, so the coverage may not be as high as it seems. I'd recommend moving up to the `v8` reporter after the esm branch lands.
* test: change test runner to vitest This change moves the test runner from `mocha` + `nyc` to `vitest`. In order to import `vitest` the tests had to be in esm, so I checked out everything under the `tests` folder from #516 (leaving the source as it was). I also moved the `eslint-rule-tester` out of the `tests/lib` folder and into its own `utils` folder. That way vitest didn't treat it as a test. Note: rather than using `vitest`'s preferred `v8` coverage reporter, I used the `istanbul` one, to ensure the coverages between old and new were the same. I did notice that when I tried the `v8` coverage reporter, the coverage numbers were much less. Something to consider as a follow-up change. The v8 reporter *should* be more accurate, so the coverage may not be as high as it seems. I'd recommend moving up to the `v8` reporter after the esm branch lands. * test: update fixtures tsconfig to use wildcard * build: remove `globals` and packageManager config
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.
Nice work!
Nice work @43081j 🥳 |
Anyone who is using commonjs on node
<20
will have to do one of the following:eslint.config.mjs
Everyone else should be unaffected.
This would be a new major of course.
Let me know if there's any other changes you think we should do