-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.js
81 lines (72 loc) · 2.08 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
const path = require('path');
const fs = require('fs');
const workspace = process.cwd();
const rootWorkspace = findRootWorkspace(workspace);
const projectConfig = path.join(rootWorkspace, 'tsconfig.test.json');
const relativeRoot = path.relative(rootWorkspace, workspace);
const ignorePaths = [
'dev/*',
'dist/*',
'draft/*',
'coverage/*',
'.vscode/*',
'.eslintrc.js',
'**/*.js',
].map((name) => path.join(relativeRoot, name).replace(/\\+/g, '/'));
function findRootWorkspace(fsPath) {
const isRoot = (fsPath) => fs.existsSync(path.join(fsPath, 'pnpm-lock.yaml'));
let current = fsPath;
let last;
while (!isRoot(current) && last !== current) {
current = path.dirname(current);
}
return current;
}
module.exports = {
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint', 'react', 'prettier'],
ignorePatterns: ignorePaths,
parserOptions: {
project: projectConfig,
ecmaFeatures: {
jsx: true,
},
},
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:react/recommended',
],
settings: {
react: {
pragma: 'React',
version: '17',
},
},
rules: {
"prettier/prettier": "error",
'no-prototype-builtins': 'off',
'no-sparse-arrays': 'off',
'indent': 'off',
'brace-style': 'off',
'no-debugger': 'off',
'max-len': ['warn', {
code: 100,
}],
'keyword-spacing': 'error',
'curly': 'error',
'eqeqeq': ['error', 'always'],
'no-extra-label': 'error',
'no-implicit-coercion': 'error',
'no-multi-spaces': 'error',
'react/prop-types': 'off',
'@typescript-eslint/indent': 'off',
'@typescript-eslint/no-var-requires': 'off',
'@typescript-eslint/no-empty-interface': 'off',
'@typescript-eslint/no-this-alias': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/brace-style': 'off',
},
};