-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
chore: bump eslint and its plugins #13412
Conversation
"eslint-plugin-flowtype": "^5.7.2", | ||
"eslint-plugin-import": "^2.23.4", | ||
"eslint-plugin-jest": "^24.3.6", | ||
"eslint-plugin-prettier": "^3.4.0", |
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 the root package, it is fine to bump major versions since we build on latest node.
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/46672/ |
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 66b73c7:
|
for (let i = 0; i < options1.plugins.length; i++) { | ||
if (i === 0 || i === 1 || i === 4 || i === 5 || i === 6) { |
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.
The linter helps catching a bug: "i === 6" is unreachable.
expect(options2.plugins[i]).not.toBe(options1.plugins[i]); | ||
} else { | ||
expect(options2.plugins[i]).toBe(options1.plugins[i]); | ||
continue; |
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 sort-of cheating. The expect
is still implicitly guarded. However I can't figure out a better way except constructing a list of valid i
, which seems to be overkills here.
/cc @SimenB
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.
Personal preference is mostly ignore comments even if I generally agree with the lint rule.
@G-Rath thoughts on this one?
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 think I like how it looks here - but that could also be because I'm bias against else
😅
Another alternative would be to do the comparison yourself and compare to true
:
const plugin1 = options1.plugins[i];
const plugin2 = options2.plugins[i];
expect(Object.is(plugin2, plugin1).toBe(i !== 2);
I'm pretty sure we don't have any rules that'll complain on that (tho maybe we should?) - but one of the big downsides of course is that jest
won't be as helpful with it's error messages if the test failed, since it'll always just complain "expected value to be true"
return new Promise(resolve => { | ||
transformFile( |
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.
In all these tests we could use transformFileAsync
which returns a promise.
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 test is focused on the behaviour of transformFile
so I don't think we should replace here. I have added a new test case on transformFileAsync
.
const bundler = browserify( | ||
path.join( | ||
path.dirname(fileURLToPath(import.meta.url)), | ||
"fixtures/browserify/register.js", | ||
), | ||
); | ||
return new Promise((resolve, reject) => { | ||
bundler.bundle(function (err, bundle) { | ||
if (err) return reject(err); |
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.
The promise will be rejected when bundler fails.
This PR also fixes the following lint errors reported by new
eslint-plugin-jest
:it
level, or split to two loop calls.expect()
is allowed in loop.