Skip to content

Commit 71b8b6b

Browse files
authored
Add changeset (#143)
1 parent 63d37c6 commit 71b8b6b

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

.changeset/soft-ladybugs-cough.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@eddeee888/eslint-plugin': patch
3+
---
4+
5+
Turn off react/react-in-jsx-scope to make it easier to integrate with modern React apps

packages/eslint-plugin/src/configs/react-typescript.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,20 @@ import * as jsxA11yPlugin from 'eslint-plugin-jsx-a11y';
33
import * as reactPlugin from 'eslint-plugin-react';
44
const reactHooksPlugin = require('eslint-plugin-react-hooks'); // We must use require() here because react-hooks is cjs, and import will use `default` instead of the cjs module.exports
55

6+
const filePatterns = ['**/*.ts', '**/*.cts', '**/*.mts', '**/*.tsx', '**/*.js', '**/*.cjs', '**/*.mjs', '**/*.jsx'];
7+
68
export const reactTypescriptConfig = defineConfig(
79
{
810
name: '@eddeee888/eslint-plugin/react-typescript/hooks',
9-
files: ['**/*.ts', '**/*.cts', '**/*.mts', '**/*.tsx', '**/*.js', '**/*.cjs', '**/*.mjs', '**/*.jsx'],
11+
files: filePatterns,
1012
plugins: {
1113
'react-hooks': reactHooksPlugin,
1214
},
1315
rules: reactHooksPlugin.configs.recommended.rules,
1416
},
1517
{
1618
name: '@eddeee888/eslint-plugin/react-typescript/react',
17-
files: ['**/*.ts', '**/*.cts', '**/*.mts', '**/*.tsx', '**/*.js', '**/*.cjs', '**/*.mjs', '**/*.jsx'],
19+
files: filePatterns,
1820
settings: { react: { version: 'detect' } },
1921
plugins: {
2022
'jsx-a11y': jsxA11yPlugin,
@@ -23,6 +25,7 @@ export const reactTypescriptConfig = defineConfig(
2325
rules: {
2426
...jsxA11yPlugin.flatConfigs.recommended.rules,
2527
...reactPlugin.configs.recommended.rules,
28+
'react/react-in-jsx-scope': 'off', // This is used for legacy React apps where `import React` must be explicit. Modern apps do not need this import.
2629
'react/jsx-no-useless-fragment': ['error', { allowExpressions: true }],
2730
},
2831
}

0 commit comments

Comments
 (0)