-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eslintrc.cjs
108 lines (107 loc) · 2.28 KB
/
.eslintrc.cjs
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
106
107
108
module.exports = {
env: {
browser: true,
es2021: true,
},
extends: [
'eslint:recommended',
'plugin:react/recommended',
'plugin:@typescript-eslint/recommended',
'airbnb',
'airbnb-typescript',
'plugin:storybook/recommended',
'prettier',
],
overrides: [
{
files: ['**/*.stories.@(js|jsx|ts|tsx)'],
rules: {
'react/jsx-props-no-spreading': ['off'],
},
},
],
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
project: './tsconfig.eslint.json',
tsconfigRootDir: __dirname,
},
plugins: ['react', '@typescript-eslint'],
rules: {
// Disable React import.
'react/react-in-jsx-scope': 0,
// Sort imports.
'sort-imports': [
'warn',
{
ignoreCase: true,
ignoreDeclarationSort: true,
},
],
'import/order': [
'warn',
{
groups: [
['external', 'builtin'],
'internal',
['sibling', 'parent'],
'index',
],
pathGroups: [
{
pattern: '@(react|react-native)',
group: 'external',
position: 'before',
},
{
pattern: 'src/**',
group: 'internal',
},
],
pathGroupsExcludedImportTypes: ['internal', 'react'],
'newlines-between': 'always',
alphabetize: {
order: 'asc',
caseInsensitive: true,
},
},
],
// Require default arguments for optional props.
'react/require-default-props': [
'error',
{
forbidDefaultForRequired: true,
// functions: 'defaultArguments',
},
],
// Allow use of arrow functions.
'arrow-body-style': ['warn', 'always'],
'react/function-component-definition': [
'error',
{
namedComponents: ['function-declaration', 'arrow-function'],
unnamedComponents: 'arrow-function',
},
],
// Disable extraneous dependencies for tests and specific files.
'import/no-extraneous-dependencies': [
'error',
{
devDependencies: [
// Repos with a single test file.
'test.{ts,tsx}',
// Repos with multiple top-level test files.
'test-*.{ts,tsx}',
// Tests where the extension or filename suffix denotes that it is a test.
'**/*{.,_}{test,spec,stories}.{ts,tsx}',
// Vite config file.
'vite.config.ts',
// Tailwind config file.
'tailwind.config.js',
],
optionalDependencies: false,
},
],
},
}