-
Notifications
You must be signed in to change notification settings - Fork 1
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
feat!: add new rules for jest, react, and typescript #171
Conversation
BREAKING CHANGE added - @typescript-eslint/no-non-null-asserted-nullish-coalescing - @typescript-eslint/no-restricted-imports - jest/prefer-expect-resolves - jest/prefer-to-be - react/no-namespace
plugins/typescript.js
Outdated
// disallows using the non-null assertion on the left operand of the nullish coalescing operator | ||
'@typescript-eslint/no-non-null-asserted-nullish-coalescing': 2, | ||
// allows to specify new option `allowTypeImport` for path or pattern | ||
'@typescript-eslint/no-restricted-imports': [2, { | ||
paths: [], | ||
patterns: [] | ||
}] |
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.
Please note that no-restricted-imports
is an Extension Rule. Correct handling for an extension is to zero-out the base eslint rule at the top of this file, and then add the corresponding @typescript-eslint/no-restricted-imports
rule with the very same syntax that we see in
Lines 34 to 35 in 7fc5181
// restrict usage of specified node imports | |
'no-restricted-imports': 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.
and ditto re: alphabetical 😉
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.
Noted, thanks for sharing this.
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.
fwiw, it might still be a nice touch to add the no-restricted-imports: 0
to the top of this file just as a documented indicator that we're going with the typescript
version of the rule now. Even though they are all 0
throughout 😛
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. These seem helpful updates!
plugins/typescript.js
Outdated
@@ -190,6 +192,8 @@ module.exports = { | |||
'@typescript-eslint/no-redeclare': bestPractices['no-redeclare'], | |||
// disallows invocation of `require()` | |||
'@typescript-eslint/no-require-imports': 2, | |||
// allows to specify new option `allowTypeImport` for path or pattern | |||
'@typescript-eslint/no-restricted-imports': 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.
Please use '@typescript-eslint/no-restricted-imports': es6['no-restricted-imports']
and knock out the baseline no-restricted-imports
by setting it to zero in the top block of this 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.
🎉
BREAKING CHANGE added
Description
Adding the new rules introduced by the updates to the
jest
,react
andtypescript-eslint
plugins.Detail
There were three plugins that were updated that introduced new rules:
@typescript-eslint/eslint-plugin
version4.32.0
CHANGELOGeslint-plugin-jest
version24.5.0
CHANGELOG** There were deprecations made to the rule
jest/prefer-to-be-null
andjest/prefer-to-be-undefined
in favor ofjest/prefer-to-be
- more detail can be found in this PReslint-plugin-react
version7.26.0
CHANGELOG