-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.js
156 lines (156 loc) · 4.39 KB
/
.eslintrc.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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
module.exports = {
parser: '@typescript-eslint/parser',
parserOptions: {
project: 'tsconfig.json',
tsconfigRootDir: __dirname,
sourceType: 'module',
},
globals: {
Atomics: 'readonly',
SharedArrayBuffer: 'readonly',
},
plugins: ['@typescript-eslint/eslint-plugin', 'jsdoc'],
extends: [
'plugin:@typescript-eslint/recommended',
'plugin:prettier/recommended',
'airbnb-base',
'airbnb-typescript',
],
root: true,
env: {
node: true,
jest: true,
},
ignorePatterns: ['.eslintrc.js'],
rules: {
'import/no-cycle': 'off',
'@typescript-eslint/interface-name-prefix': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'import/prefer-default-export': 'off',
'react/jsx-filename-extension': 'off',
'eol-last': ['error', 'always'],
'prettier/prettier': 'error',
'class-methods-use-this': 'off',
'import/no-extraneous-dependencies': 'off',
'indent': ['error', 2],
'object-curly-newline': [
'error',
{
ObjectExpression: { multiline: true, minProperties: 1 },
ObjectPattern: { multiline: true, minProperties: 6 },
ImportDeclaration: { multiline: true, minProperties: 5 },
ExportDeclaration: { multiline: true, minProperties: 5 },
},
],
'import/no-extraneous-dependencies': [
'error',
{
devDependencies: [
'**/test.js', // Example: allowing devDependencies in test files
'**/*.test.js', // or any other pattern for test files
'**/webpack.config.js', // if you're using Webpack and want to allow devDependencies here
],
optionalDependencies: false,
peerDependencies: false,
},
],
'import/no-extraneous-dependencies': [
'error',
{
devDependencies: [
'**/*.test.js', // Allow devDependencies in test files
'**/*.spec.ts', // Allow in TypeScript test files
'test/**', // Allow in test directories
'tests/**', // Another common test directory
'spec/**', // Allow in spec directories
'**/__tests__/**', // Allow in Jest's __tests__ directories
'**/*.test.ts', // Specific pattern for TypeScript test files
'**/*.spec.js', // Specific pattern for JavaScript spec files
],
optionalDependencies: false,
peerDependencies: false,
},
],
'operator-linebreak': [
'error',
'before', // Enforce operators to be placed after the line break
{
overrides: {
'=': 'after', // Ensure no line break before or after '='
},
},
],
'require-jsdoc': [
'error',
{
require: {
FunctionDeclaration: true,
MethodDefinition: true,
ClassDeclaration: true,
},
},
],
'valid-jsdoc': [
'error',
{
requireReturn: true,
requireReturnType: true,
requireParamDescription: true,
requireReturnDescription: true,
},
],
"prettier/prettier": "off",
'max-lines-per-function': ['error', { max: 250, skipBlankLines: true, skipComments: true }],
'max-len': ['error', { code: 180, ignoreUrls: true }],
'max-lines': ['error', { max: 1000, skipBlankLines: true, skipComments: true }],
'max-depth': ['error', 4],
'max-params': ['error', 4],
'max-statements': ['error', 30],
'max-statements-per-line': ['error', { max: 1 }],
complexity: ['error', 20],
'max-nested-callbacks': ['error', 10],
'import/no-extraneous-dependencies': ['error', { devDependencies: true }],
'import/order': [
'error',
{
groups: ['builtin', 'external', 'internal', ['parent', 'sibling', 'index']],
'newlines-between': 'always',
},
],
'import/extensions': [
'error',
'ignorePackages',
{
js: 'never',
ts: 'never',
},
],
'@typescript-eslint/ban-types': [
'error',
{
types: {
object: false,
},
},
],
},
overrides: [
{
files: ['**/*.ts'],
parser: '@typescript-eslint/parser',
rules: {
'no-undef': 'off',
},
},
],
settings: {
'import/resolver': {
node: {
paths: ['.'],
extensions: ['.js', '.ts', '.d.ts'],
},
},
},
};