Skip to content

Commit

Permalink
Enable all recommended configs for all plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
gzdunek committed Dec 13, 2024
1 parent ae160ce commit 0e12583
Showing 1 changed file with 24 additions and 12 deletions.
36 changes: 24 additions & 12 deletions web/packages/build/eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,16 @@ export default tseslint.config(
},
eslint.configs.recommended,
...tseslint.configs.recommended,
reactPlugin.configs.flat.recommended,
importPlugin.flatConfigs.errors,
importPlugin.flatConfigs.warnings,
importPlugin.flatConfigs.typescript,
{
settings: {
react: {
version: 'detect',
},
},
languageOptions: {
ecmaVersion: 6,
sourceType: 'module',
Expand All @@ -51,19 +60,13 @@ export default tseslint.config(
jest: 'readonly',
},
parser: tseslint.parser,
parserOptions: {
ecmaFeatures: {
jsx: true,
},
},
},
plugins: {
'@typescript-eslint': tseslint.plugin,
react: reactPlugin,
'react-hooks': reactHooksPlugin,
import: importPlugin,
// There is no flat config available.
'react-hooks': reactHooksPlugin.configs,
},
rules: {
...reactHooksPlugin.configs.recommended.rules,
'import/order': [
'error',
{
Expand Down Expand Up @@ -120,6 +123,14 @@ export default tseslint.config(
// allowExpressions allow single expressions in a fragment eg: <>{children}</>
// https://github.com/jsx-eslint/eslint-plugin-react/blob/f83b38869c7fc2c6a84ef8c2639ac190b8fef74f/docs/rules/jsx-no-useless-fragment.md#allowexpressions
'react/jsx-no-useless-fragment': ['error', { allowExpressions: true }],
'react/display-name': 'off',
'react/no-children-prop': 'warn',
'react/no-unescaped-entities': 'warn',
'react/jsx-key': 'warn',
'react/jsx-no-target-blank': 'warn',
// Turned off because we use automatic runtime.
'react/jsx-uses-react': 'off',
'react/react-in-jsx-scope': 'off',

'react-hooks/rules-of-hooks': 'warn',
'react-hooks/exhaustive-deps': 'warn',
Expand All @@ -128,16 +139,17 @@ export default tseslint.config(
{
files: ['**/*.test.{ts,tsx,js,jsx}'],
languageOptions: {
globals: {
...globals.jest,
},
globals: globals.jest,
},
plugins: {
jest: jestPlugin,
'testing-library': testingLibraryPlugin,
'jest-dom': jestDomPlugin,
},
rules: {
...jestPlugin.configs['flat/recommended'].rules,
...testingLibraryPlugin.configs['flat/react'].rules,
...jestDomPlugin.configs['flat/recommended'].rules,
'jest/prefer-called-with': 'off',
'jest/prefer-expect-assertions': 'off',
'jest/consistent-test-it': 'off',
Expand Down

0 comments on commit 0e12583

Please sign in to comment.