-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/y-hsgw/eslint-plugin-react …
…into feature/add-jsdoc-annotations
- Loading branch information
Showing
169 changed files
with
1,901 additions
and
725 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,6 +26,7 @@ jobs: | |
matrix: | ||
node-version: ${{ fromJson(needs.matrix.outputs.latest) }} | ||
eslint: | ||
- 9 | ||
- 8 | ||
- 7 | ||
- 6 | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,13 @@ | ||
'use strict'; | ||
|
||
const fromEntries = require('object.fromentries'); | ||
const entries = require('object.entries'); | ||
const plugin = require('..'); | ||
|
||
const allRules = require('../lib/rules'); | ||
|
||
function filterRules(rules, predicate) { | ||
return fromEntries(entries(rules).filter((entry) => predicate(entry[1]))); | ||
} | ||
|
||
/** | ||
* @param {object} rules - rules object mapping rule name to rule module | ||
* @returns {Record<string, 2>} | ||
*/ | ||
function configureAsError(rules) { | ||
return fromEntries(Object.keys(rules).map((key) => [`react/${key}`, 2])); | ||
} | ||
|
||
const activeRules = filterRules(allRules, (rule) => !rule.meta.deprecated); | ||
const activeRulesConfig = configureAsError(activeRules); | ||
|
||
const deprecatedRules = filterRules(allRules, (rule) => rule.meta.deprecated); | ||
const legacyConfig = plugin.configs.all; | ||
|
||
module.exports = { | ||
plugins: { | ||
/** | ||
* @type {{ | ||
* deprecatedRules: Record<string, import('eslint').Rule.RuleModule>, | ||
* rules: Record<string, import('eslint').Rule.RuleModule>, | ||
* }} | ||
*/ | ||
react: { | ||
deprecatedRules, | ||
rules: allRules, | ||
}, | ||
}, | ||
rules: activeRulesConfig, | ||
languageOptions: { | ||
parserOptions: { | ||
ecmaFeatures: { | ||
jsx: true, | ||
}, | ||
}, | ||
}, | ||
plugins: { react: plugin }, | ||
rules: legacyConfig.rules, | ||
languageOptions: { parserOptions: legacyConfig.parserOptions }, | ||
}; | ||
|
||
// this is so the `languageOptions` property won't be warned in the new config system | ||
Object.defineProperty(module.exports, 'languageOptions', { enumerable: false }); |
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 |
---|---|---|
@@ -1,18 +1,13 @@ | ||
'use strict'; | ||
|
||
const all = require('./all'); | ||
const plugin = require('..'); | ||
|
||
module.exports = Object.assign({}, all, { | ||
languageOptions: Object.assign({}, all.languageOptions, { | ||
parserOptions: Object.assign({}, all.languageOptions.parserOptions, { | ||
jsxPragma: null, // for @typescript/eslint-parser | ||
}), | ||
}), | ||
rules: { | ||
'react/react-in-jsx-scope': 0, | ||
'react/jsx-uses-react': 0, | ||
}, | ||
}); | ||
const legacyConfig = plugin.configs['jsx-runtime']; | ||
|
||
module.exports = { | ||
plugins: { react: plugin }, | ||
rules: legacyConfig.rules, | ||
languageOptions: { parserOptions: legacyConfig.parserOptions }, | ||
}; | ||
|
||
// this is so the `languageOptions` property won't be warned in the new config system | ||
Object.defineProperty(module.exports, 'languageOptions', { enumerable: false }); |
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 |
---|---|---|
@@ -1,34 +1,13 @@ | ||
'use strict'; | ||
|
||
const all = require('./all'); | ||
const plugin = require('..'); | ||
|
||
module.exports = Object.assign({}, all, { | ||
languageOptions: all.languageOptions, | ||
rules: { | ||
'react/display-name': 2, | ||
'react/jsx-key': 2, | ||
'react/jsx-no-comment-textnodes': 2, | ||
'react/jsx-no-duplicate-props': 2, | ||
'react/jsx-no-target-blank': 2, | ||
'react/jsx-no-undef': 2, | ||
'react/jsx-uses-react': 2, | ||
'react/jsx-uses-vars': 2, | ||
'react/no-children-prop': 2, | ||
'react/no-danger-with-children': 2, | ||
'react/no-deprecated': 2, | ||
'react/no-direct-mutation-state': 2, | ||
'react/no-find-dom-node': 2, | ||
'react/no-is-mounted': 2, | ||
'react/no-render-return-value': 2, | ||
'react/no-string-refs': 2, | ||
'react/no-unescaped-entities': 2, | ||
'react/no-unknown-property': 2, | ||
'react/no-unsafe': 0, | ||
'react/prop-types': 2, | ||
'react/react-in-jsx-scope': 2, | ||
'react/require-render-return': 2, | ||
}, | ||
}); | ||
const legacyConfig = plugin.configs.recommended; | ||
|
||
module.exports = { | ||
plugins: { react: plugin }, | ||
rules: legacyConfig.rules, | ||
languageOptions: { parserOptions: legacyConfig.parserOptions }, | ||
}; | ||
|
||
// this is so the `languageOptions` property won't be warned in the new config system | ||
Object.defineProperty(module.exports, 'languageOptions', { enumerable: false }); |
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
Oops, something went wrong.