-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheslint.config.js
105 lines (98 loc) · 2.95 KB
/
eslint.config.js
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
104
105
import eslint from '@eslint/js';
import singlestoreReactHooksDisableImport from '@singlestore/eslint-plugin-react-hooks-disable-import';
import eslintConfigPrettier from 'eslint-config-prettier';
import jsxA11y from 'eslint-plugin-jsx-a11y';
import react from 'eslint-plugin-react';
import hooksPlugin from 'eslint-plugin-react-hooks';
import reactRefresh from 'eslint-plugin-react-refresh';
import sonarjs from 'eslint-plugin-sonarjs';
import storybook from 'eslint-plugin-storybook';
import globals from 'globals';
import tseslint from 'typescript-eslint';
import { fileURLToPath } from 'url';
const __dirname = fileURLToPath(new URL('.', import.meta.url));
export default [
{
files: ['**/*.ts', '**/*.tsx'],
},
{
ignores: [
'**/dist',
'**/eslint.config.js',
'**/postcss.config.js',
'storybook-static',
'!.storybook',
'**/**.stories.tsx',
],
},
eslint.configs.recommended,
jsxA11y.flatConfigs.recommended,
react.configs.flat.recommended,
react.configs.flat['jsx-runtime'],
...storybook.configs['flat/recommended'],
...tseslint.configs.recommendedTypeChecked,
...tseslint.configs.stylisticTypeChecked,
sonarjs.configs.recommended,
eslintConfigPrettier, // must be last, override other configs
{
plugins: {
'@singlestore/react-hooks-disable-import': singlestoreReactHooksDisableImport,
react: react,
'react-hooks': hooksPlugin,
'react-refresh': reactRefresh,
},
},
{
languageOptions: {
globals: {
...globals.browser,
},
ecmaVersion: 5,
sourceType: 'script',
parserOptions: {
ecmaVersion: 2020,
sourceType: 'module',
project: ['./tsconfig.json', './tsconfig.node.json'],
tsconfigRootDir: __dirname,
},
},
settings: {
react: {
version: 'detect',
},
},
rules: {
'react-refresh/only-export-components': [
'warn',
{
allowConstantExport: true,
},
],
'no-useless-rename': 'error',
'no-console': 'warn',
'react/jsx-child-element-spacing': 'error',
'@typescript-eslint/consistent-indexed-object-style': 'warn',
'@typescript-eslint/no-misused-promises': 'warn',
'@typescript-eslint/no-floating-promises': 'warn',
'@typescript-eslint/no-unused-vars': [
'error',
{
args: 'all',
argsIgnorePattern: '^_',
caughtErrors: 'all',
caughtErrorsIgnorePattern: '^_',
destructuredArrayIgnorePattern: '^_',
varsIgnorePattern: '^_',
ignoreRestSiblings: true,
},
],
'@singlestore/react-hooks-disable-import/react-hooks-disable-import': 'error',
'react/no-unstable-nested-components': 'warn',
'react/no-array-index-key': 'warn',
'sonarjs/no-ignored-exceptions': 'off',
'sonarjs/todo-tag': 'warn',
'sonarjs/slow-regex': 'error',
...hooksPlugin.configs.recommended.rules,
},
},
];