fix(linter): add files entry to react flat configs to avoid applying TS rules to JSON files (#29457)
This PR fixes an issue with React libs, where TS rules are being applied to JSON files. <!-- Please make sure you have read the submission guidelines before posting an PR --> <!-- https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr --> <!-- Please make sure that your commit message follows our format --> <!-- Example: `fix(nx): must begin with lowercase` --> <!-- If this is a particularly complex change or feature addition, you can request a dedicated Nx release for this pull request branch. Mention someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they will confirm if the PR warrants its own release for testing purposes, and generate it for you if appropriate. --> ## Current Behavior <!-- This is the behavior we have today --> ## Expected Behavior <!-- This is the behavior we should expect with the changes in this PR --> ## Related Issue(s) <!-- Please link the issue being fixed so it gets closed when this is merged. --> Fixes #28245 --------- Co-authored-by: Colum Ferry <cferry09@gmail.com>
This commit is contained in:
parent
4406a7e681
commit
cbbe14b8e5
@ -18,6 +18,16 @@ import tseslint from 'typescript-eslint';
|
|||||||
* https://github.com/facebook/create-react-app/blob/567f36c9235f1e1fd4a76dc6d1ae00be754ca047/packages/eslint-config-react-app/index.js
|
* https://github.com/facebook/create-react-app/blob/567f36c9235f1e1fd4a76dc6d1ae00be754ca047/packages/eslint-config-react-app/index.js
|
||||||
*/
|
*/
|
||||||
export default tseslint.config({
|
export default tseslint.config({
|
||||||
|
files: [
|
||||||
|
'**/*.ts',
|
||||||
|
'**/*.cts',
|
||||||
|
'**/*.mts',
|
||||||
|
'**/*.tsx',
|
||||||
|
'**/*.js',
|
||||||
|
'**/*.cjs',
|
||||||
|
'**/*.mjs',
|
||||||
|
'**/*.jsx',
|
||||||
|
],
|
||||||
plugins: { import: importPlugin },
|
plugins: { import: importPlugin },
|
||||||
languageOptions: {
|
languageOptions: {
|
||||||
globals: {
|
globals: {
|
||||||
|
|||||||
@ -15,12 +15,32 @@ import tseslint from 'typescript-eslint';
|
|||||||
*/
|
*/
|
||||||
export default tseslint.config(
|
export default tseslint.config(
|
||||||
{
|
{
|
||||||
|
files: [
|
||||||
|
'**/*.ts',
|
||||||
|
'**/*.cts',
|
||||||
|
'**/*.mts',
|
||||||
|
'**/*.tsx',
|
||||||
|
'**/*.js',
|
||||||
|
'**/*.cjs',
|
||||||
|
'**/*.mjs',
|
||||||
|
'**/*.jsx',
|
||||||
|
],
|
||||||
plugins: {
|
plugins: {
|
||||||
'react-hooks': reactHooksPlugin,
|
'react-hooks': reactHooksPlugin,
|
||||||
},
|
},
|
||||||
rules: reactHooksPlugin.configs.recommended.rules,
|
rules: reactHooksPlugin.configs.recommended.rules,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
files: [
|
||||||
|
'**/*.ts',
|
||||||
|
'**/*.cts',
|
||||||
|
'**/*.mts',
|
||||||
|
'**/*.tsx',
|
||||||
|
'**/*.js',
|
||||||
|
'**/*.cjs',
|
||||||
|
'**/*.mjs',
|
||||||
|
'**/*.jsx',
|
||||||
|
],
|
||||||
settings: { react: { version: 'detect' } },
|
settings: { react: { version: 'detect' } },
|
||||||
plugins: {
|
plugins: {
|
||||||
'jsx-a11y': jsxA11yPlugin,
|
'jsx-a11y': jsxA11yPlugin,
|
||||||
|
|||||||
@ -11,6 +11,16 @@ import tseslint from 'typescript-eslint';
|
|||||||
* package.
|
* package.
|
||||||
*/
|
*/
|
||||||
export default tseslint.config({
|
export default tseslint.config({
|
||||||
|
files: [
|
||||||
|
'**/*.ts',
|
||||||
|
'**/*.cts',
|
||||||
|
'**/*.mts',
|
||||||
|
'**/*.tsx',
|
||||||
|
'**/*.js',
|
||||||
|
'**/*.cjs',
|
||||||
|
'**/*.mjs',
|
||||||
|
'**/*.jsx',
|
||||||
|
],
|
||||||
rules: {
|
rules: {
|
||||||
// TypeScript"s `noFallthroughCasesInSwitch` option is more robust (#6906)
|
// TypeScript"s `noFallthroughCasesInSwitch` option is more robust (#6906)
|
||||||
'default-case': 'off',
|
'default-case': 'off',
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user