-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy patheslint.config.js
More file actions
103 lines (102 loc) · 3 KB
/
eslint.config.js
File metadata and controls
103 lines (102 loc) · 3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
import js from '@eslint/js';
import globals from 'globals';
import tsParser from '@typescript-eslint/parser';
import tsPlugin from '@typescript-eslint/eslint-plugin';
import pluginReact from 'eslint-plugin-react';
import importPlugin from 'eslint-plugin-import';
import jsxA11y from 'eslint-plugin-jsx-a11y';
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended';
export default [
// Configs further down the array will override rules from earlier configs
js.configs.recommended,
{
files: ['**/*.{ts,tsx}'],
languageOptions: {
parser: tsParser,
parserOptions: {
ecmaVersion: 2020,
sourceType: 'module',
ecmaFeatures: {
jsx: true,
},
project: ['./tsconfig.json', './packages/*/tsconfig.json'],
},
globals: globals.browser,
},
plugins: {
'@typescript-eslint': tsPlugin,
},
rules: {
...tsPlugin.configs.recommended.rules,
'@typescript-eslint/no-unused-vars': [
'warn', // or "error"
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
caughtErrorsIgnorePattern: '^_',
},
],
},
},
pluginReact.configs.flat.recommended,
importPlugin.flatConfigs.recommended,
eslintPluginPrettierRecommended,
{
files: ['**/*.{js,mjs,cjs,jsx}'],
languageOptions: {
globals: globals.browser,
},
},
{
plugins: {
'jsx-a11y': jsxA11y,
},
rules: {
'prettier/prettier': [
'error',
{
endOfLine: 'auto',
singleQuote: true,
trailingComma: 'all',
printWidth: 90,
semi: true,
tabWidth: 2,
useTabs: false,
},
],
'react/jsx-filename-extension': [2, { extensions: ['.js', '.jsx', '.ts', '.tsx'] }],
'import/prefer-default-export': 'off',
'react/function-component-definition': 'off',
'no-plusplus': ['warn', { allowForLoopAfterthoughts: true }],
'dot-notation': 'off',
'import/extensions': 'off',
'react/jsx-props-no-spreading': 'off',
'react/require-default-props': 'off',
'react/react-in-jsx-scope': 'off',
'react/no-unknown-property': ['error', { ignore: ['css'] }],
'operator-linebreak': 'off',
// needs to be duplicated because we have this rule in 2 plugins (=
'no-unused-vars': [
'warn', // or "error"
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
caughtErrorsIgnorePattern: '^_',
},
],
'max-len': 'off',
'no-param-reassign': 'off',
'import/no-cycle': 'off',
'no-underscore-dangle': 'off',
'no-nested-ternary': 'off',
'jsx-a11y/tabindex-no-positive': 'off',
'no-bitwise': 'warn',
'no-restricted-syntax': 'warn',
'no-trailing-spaces': 'error',
'import/named': 'off',
'import/no-unresolved': 'off',
'no-multiple-empty-lines': ['error', { max: 1, maxEOF: 0, maxBOF: 0 }],
'react/display-name': 'off',
},
},
];