-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheslint.config.js
80 lines (76 loc) · 2.57 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
import eslintConfigPrettier from 'eslint-config-prettier';
import eslintPluginReact from 'eslint-plugin-react';
import importPlugin from 'eslint-plugin-import';
import pluginJs from '@eslint/js';
// eslint-disable-next-line import/no-unresolved
import tsParser from '@typescript-eslint/parser';
// eslint-disable-next-line import/no-unresolved
import tseslint from 'typescript-eslint';
const OFF = 0;
const WARNING = 1;
const ERROR = 2;
export default [
{
settings: {
react: {
version: 'detect',
},
'import/resolver': {
node: {
extensions: ['.js', '.jsx', '.ts', '.tsx', '.less', '.scss'],
moduleDirectory: ['node_modules', 'src/'],
},
},
},
},
{
name: 'base-config',
files: ['**/*.{js,mjs,ts,jsx,tsx}'],
ignores: ['node_modules/**/*', 'dist/**/*', '.yarn/**/*', '.yarn', 'src/app/build/**/*', '.storybook/**/*'], // specify ignored files
languageOptions: {
parser: tsParser,
// parserOptions: {
// project: './tsconfig.json', // Point to your tsconfig.json file
//},
sourceType: 'module',
ecmaVersion: 'latest',
},
},
pluginJs.configs.recommended,
eslintPluginReact.configs.flat.recommended,
...tseslint.configs.recommended,
eslintConfigPrettier,
importPlugin.flatConfigs.recommended,
{
rules: {
'no-console': WARNING,
'no-debugger': WARNING,
'no-duplicate-imports': ERROR,
'no-use-before-define': OFF,
'no-shadow': OFF,
'no-unused-vars': OFF,
'no-undef': OFF,
'react/no-unused-prop-types': WARNING,
'react/prop-types': OFF,
'react/forbid-prop-types': OFF,
'react/react-in-jsx-scope': OFF,
'react/display-name': OFF,
'@typescript-eslint/no-use-before-define': [ERROR],
'@typescript-eslint/no-shadow': ERROR,
'@typescript-eslint/ban-ts-comment': OFF,
'@typescript-eslint/no-explicit-any': OFF,
'import/prefer-default-export': OFF,
'import/no-unresolved': ERROR,
'import/named': OFF,
},
},
{
name: 'test-specific',
files: ['*.spec.ts', '*.spec.tsx'],
rules: {
'@typescript-eslint/no-explicit-any': OFF,
'@typescript-eslint/ban-ts-comment': OFF,
'import/no-named-as-default-member': OFF,
},
},
];