forked from adevinta/spark
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.cjs
112 lines (112 loc) · 3.6 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
109
110
111
112
module.exports = {
overrides: [
{
files: ['**/*.tsx'],
rules: {
'max-lines-per-function': [1, { max: 200, skipBlankLines: true, skipComments: true }],
},
},
{
files: ['**/*.test.ts', '**/*.test.tsx', '**/*.stories.tsx'],
rules: {
'max-lines-per-function': [1, { max: 500, skipBlankLines: true, skipComments: true }],
'max-nested-callbacks': [1, 8],
'no-console': 0,
},
},
{
files: ['packages/components/icons/src/tags.ts', 'packages/components/icons/src/index.ts'],
rules: {
'max-lines': 0,
},
},
],
settings: {
react: {
version: 'detect',
},
},
parser: '@typescript-eslint/parser',
plugins: ['@nx', '@typescript-eslint', 'react-hooks', 'simple-import-sort', 'prettier'],
extends: [
'standard',
'plugin:@typescript-eslint/recommended',
'plugin:tailwindcss/recommended',
'plugin:react/recommended',
'plugin:prettier/recommended',
],
globals: {
fetch: 'readonly',
},
parserOptions: {
project: './tsconfig.json',
ecmaVersion: 2018, // Allows for the parsing of modern ECMAScript features
sourceType: 'module', // Allows for the use of imports
},
rules: {
// Overwrite rules specified from the extended configs or add ones
// NX
'@nx/enforce-module-boundaries': 2,
// Prettier
"prettier/prettier": [1, { "endOfLine": "auto" }],
// Typescript
'@typescript-eslint/consistent-type-definitions': [1, 'interface'],
'@typescript-eslint/array-type': [2, { default: 'array', readonly: 'array' }],
'@typescript-eslint/explicit-module-boundary-types': 0,
'@typescript-eslint/prefer-interface': 0,
'@typescript-eslint/no-object-literal-type-assertion': 0,
'@typescript-eslint/no-shadow': 0,
'@typescript-eslint/explicit-function-return-type': 0,
'@typescript-eslint/no-unused-vars': [2, { varsIgnorePattern: '^_', argsIgnorePattern: '^_' }],
'@typescript-eslint/no-use-before-define': [
2,
{ functions: false, classes: true, variables: false },
],
'@typescript-eslint/switch-exhaustiveness-check': 2,
// React
'jsx-quotes': [1, 'prefer-double'],
'react/react-in-jsx-scope': 0,
'react-hooks/rules-of-hooks': 2,
'react-hooks/exhaustive-deps': 1,
'react/prop-types': 0,
'react/jsx-key': 0,
'react/display-name': [0, { ignoreTranspilerName: false }],
// Tailwind
'tailwindcss/classnames-order': 0,
'tailwindcss/no-custom-classname': [
2,
{
config: './tailwind.config.cjs',
callees: ['cx', 'classnames', 'clsx', 'cva', 'tw', 'makeVariants'],
whitelist: ['sb-unstyled'],
},
],
// import
'import/no-absolute-path': 0,
'import/exports-last': 0,
// simple-import-sort
'simple-import-sort/imports': 1,
// Misc
'array-callback-return': 1,
complexity: [1, 8],
curly: [1, 'multi-line'],
'max-lines': [1, { max: 300, skipBlankLines: true, skipComments: true }],
'max-lines-per-function': [1, { max: 100, skipBlankLines: true, skipComments: true }],
'max-depth': [2, 5],
'max-nested-callbacks': [1, 5],
'newline-before-return': 1,
'no-console': [1, { allow: ['error'] }],
'no-debugger': 1,
'no-nested-ternary': 2,
'no-shadow': 0,
'no-unneeded-ternary': 2,
'no-unused-expressions': [1, { allowShortCircuit: true }],
'no-use-before-define': 0,
'no-var': 2,
quotes: [1, 'single', { allowTemplateLiterals: false, avoidEscape: true }],
'space-before-function-paren': [
1,
{ anonymous: 'always', named: 'never', asyncArrow: 'always' },
],
},
}