-
Notifications
You must be signed in to change notification settings - Fork 57
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 eslint-plugins and drop eslint@6 support #210
Conversation
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.
Added notes on potential additions / tweaks. I don't recall what our convention is for shipping without integrating new rules so I'll leave it to a proper Web Foundation dev to approve.
"@typescript-eslint/eslint-plugin": "^4.1.0", | ||
"@typescript-eslint/parser": "^4.1.0", | ||
"@typescript-eslint/eslint-plugin": "^4.15.0", | ||
"@typescript-eslint/parser": "^4.15.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.
Potential new rules for lib/config/rules/typescript.js
:
object-curly-spacing
sort-type-union-intersection-members
non-nullable-type-assertion-style
no-confusing-void-expression
no-unnecessary-type-constraint
space-infix-ops
consistent-indexed-object-style
Also, naming-convention
has a few new options in 4.9.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.
I turned on the ones that work out of the box. There are a few that require the project
option to be set on typescript-eslint/parser
that I will need to figure out in another PR.
The sort-type-union-intersection-members
will need more thought. It rejects a large amount of code, but it's not clear how to "fix" it.
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 wonder if we could code mod? Example on how to fix: https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/sort-type-union-intersection-members.md That being said could this work be done in a follow PR?
62d4f3a
to
f7b0e41
Compare
@@ -10,5 +10,6 @@ module.exports = { | |||
rules: merge(require('./rules/node'), { | |||
'no-process-env': 'off', | |||
'no-console': 'off', | |||
'no-useless-token-range': 'off', |
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.
We are turning this off as stuff will break? This will make rules less performant...
https://github.com/not-an-aardvark/eslint-plugin-eslint-plugin/blob/master/docs/rules/no-useless-token-range.md
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 forgot I turned this off. Nice catch.
@@ -10,6 +10,8 @@ module.exports = { | |||
'@shopify/class-property-semi': 'off', | |||
'@shopify/binary-assignment-parens': 'off', | |||
'babel/semi': 'off', | |||
'prefer-arrow-callback': 'off', |
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.
We are doing this to support function Foo(){}
over const
I assume? Or as things well break?
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 documentation recommended following the defaults which is off, because we have the prettier plugin.
// Prevent usage of javascript: in URLs | ||
'react/jsx-no-script-url': 'error', | ||
// Prevent react contexts from taking non-stable values | ||
'react/jsx-no-constructed-context-values': 'error', |
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.
🎖️
'error', | ||
{ | ||
checkFragmentShorthand: true, | ||
checkKeyMustBeforeSpread: true, |
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.
We want people to override keys?
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.
We want to prevent them from overriding a key. To prevent createElement fallback as seen here:
facebook/react#20031 (comment)
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 as long as this passes a sweeping 🎩 in our most important consumer web
then I think its gtg. Any new rules might be broken out into new PRs. 🤷
This is a major release (breaking change). Which is why I thought the new rules were ok in this. |
Description
This PR updates the
eslint-plugins
and drops support foreslint@6
.eslint-config-prettier
6.14.0
7.2.0
eslint-plugin-jest-formatting
2.0.0
2.0.1
eslint-plugin-promise
4.2.1
4.3.1
eslint-plugin-jest
24.1.0
24.1.3
eslint-plugin-react
7.21.5
7.22.0
eslint-plugin-sort-class-members
1.8.0
1.9.0
@typescript-eslint/eslint-plugin
4.1.0
4.15.0
@typescript-eslint/parser
4.1.0
4.15.0
change-case
4.1.0
4.1.2
This PR also enables and disables new rules.
I disabled
arrow-body-style
andprefer-arrow-callback
, because they defaulted to off before and are turned off by default inprettier-config/recommended
I 🎩 ed this by using
tophat eslint-plugin ../web
.Note web has a package resolution for eslint-plugin-react that you will need to remove first.
Then I ran
Type of change
@shopify/eslint-plugin
Major: Breaking change (fix or feature that would cause existing functionality to not work as expected)Checklist