-
Notifications
You must be signed in to change notification settings - Fork 14
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
Update to ESLint 7 #1000
Comments
I noticed weddell is already using eslint 7. |
ESLint 7 has a new default rule that prevents setters from returning a value. I considered turning the rule off for compatibility, but it seems better to eliminate these returns, so I'll commit that. |
Following the migration guide linked above, I adapted our
I ran the following tests on the new version:
Everything worked as desired, so I'll take the following steps:
|
While I was working on this, ESLint 7.17.0 was released, with an autofix for formatting ternary operators. I'm inclined to update to this now so we only need to notify clients and PhET developers to |
I posted a message in slack and in the google group:
The last step is:
|
CT discovered an issue when there are no files to lint (in phet-io-wrapper-classroom-activity), I corrected it in the commit. |
On second thought, it makes sense for me to add a |
I added support for
Questions:
|
Assigning to @jonathanolson, since we use this tool quite a bit, I am recommending high priority. |
I'm trying to understand the results.forEach( result => {
let failed = false;
if ( result.errorCount > 0 || result.warningCount > 0 ) {
console.error( `lint failed in ${repo}`, result.filePath, result );
failed = true;
}
if ( failed ) {
process.exit( 1 );
}
} ); could be simplified to: for ( const result of results ) {
if ( result.errorCount > 0 || result.warningCount > 0 ) {
console.error( `lint failed in ${repo}`, result.filePath, result );
process.exit( 1 );
}
} Also: preferring for-of loops in async functions, so that it will work nicely if we add awaits INSIDE the loop. |
const sum = ( a, b ) => a + b;
const count = numbers => numbers.length === 0 ? 0 : numbers.reduce( sum ); I believe can be reduced to: const count = numbers.reduce( ( a, b ) => a + b, 0 ); or, since we have lodash: const count = _.sum( numbers ); |
The comment here seems incorrect. I presume it's more "no JS code that we WANT to be linted exists here"? const EXCLUDE_PATTERNS = [ // patterns that have no code and lint should not be attempted |
Looks good to me! Can you take a look at the potential improvements above? |
The intent was that it would report all failing repos instead of just the first one. |
Sounds good, then the |
Great recommendations, I addressed each above (and improved output formatting), ready for re-review. |
Looks great, thanks! |
As described in phetsims/phet-info#150 (comment)
The migration guide is here: https://eslint.org/docs/user-guide/migrating-to-7.0.0
The text was updated successfully, but these errors were encountered: