-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Eslint config: upgrade
eslint-plugin-react
to version 7.26.0
This change updates `eslint-plugin-react` to the latest version 7.26.0 and workarounds `fbt` oddities discovered in the previous version (jsx-eslint/eslint-plugin-react#3080). I added 2 fixtures to make sure `no-unused-vars` rule works as expected with FBT. Additionally, it removes unused suppression comments that were also fixed in previous React plugin version (jsx-eslint/eslint-plugin-react#3063). Changelog: https://github.com/yannickcr/eslint-plugin-react/blob/eeb0144f14aa972f533e2ef0b094f6742d63c492/CHANGELOG.md#7260---20210920
- Loading branch information
Showing
10 changed files
with
112 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
...lint-config-adeira/__tests__/__fixtures__/invalid-eslint-examples/react/no-unused-vars.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// @flow strict | ||
|
||
// eslint-disable-next-line no-unused-vars | ||
const someUnusedVar = 42; | ||
|
||
// eslint-disable-next-line no-unused-vars | ||
function fact(n) { | ||
if (n < 2) { | ||
return 1; | ||
} | ||
return n * fact(n - 1); | ||
} |
13 changes: 13 additions & 0 deletions
13
...eslint-config-adeira/__tests__/__fixtures__/valid-eslint-examples/react/no-unused-vars.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/** | ||
* This code should NOT report `no-unused-vars` error on FBT import, see: | ||
* https://github.com/yannickcr/eslint-plugin-react/issues/3080 | ||
* | ||
* @flow | ||
*/ | ||
|
||
import fbt from 'fbt'; // eslint-disable-line import/no-extraneous-dependencies | ||
import type { Node } from 'react'; | ||
|
||
export default function MyComponent(): Node { | ||
return <fbt desc="…">test</fbt>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters