-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.js
84 lines (83 loc) · 2.87 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
const base = require('@patract/dev/config/eslint');
// add override for any (a metric ton of them, initial conversion)
module.exports = {
...base,
plugins: [...base.plugins, 'header', 'react-hooks', 'sort-destructure-keys', 'simple-import-sort'],
ignorePatterns: [
'.eslintrc.js',
'.github/**',
'.vscode/**',
'.yarn/**',
'**/build/*',
'**/coverage/*',
'**/node_modules/*'
],
parserOptions: {
...base.parserOptions,
project: ['./tsconfig.json']
},
extends: [...base.extends, 'plugin:react/recommended', 'plugin:prettier/recommended'],
rules: {
...base.rules,
// required as 'off' since typescript-eslint has own versions
'prettier/prettier': ['error', {}, { usePrettierrc: true }],
indent: 'off',
'no-use-before-define': 'off',
'@typescript-eslint/indent': 'off',
// specific overrides
'default-param-last': [0], // conflicts with TS version (this one doesn't allow TS ?)
'react/prop-types': [0], // this is a completely broken rule
'padding-line-between-statements': [
1,
{ blankLine: 'always', prev: ['const', 'let', 'var'], next: '*' },
{ blankLine: 'any', prev: ['const', 'let', 'var'], next: ['const', 'let', 'var'] },
{ blankLine: 'always', prev: '*', next: 'block-like' },
{ blankLine: 'always', prev: 'block-like', next: '*' },
{ blankLine: 'always', prev: '*', next: 'function' },
{ blankLine: 'always', prev: 'function', next: '*' },
{ blankLine: 'always', prev: '*', next: 'try' },
{ blankLine: 'always', prev: 'try', next: '*' },
{ blankLine: 'always', prev: '*', next: 'return' }
],
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'error',
'react/jsx-sort-props': [
1,
{
noSortAlphabetically: false
}
],
'sort-destructure-keys/sort-destructure-keys': [
1,
{
caseSensitive: true
}
],
// needs to be switched on at some point
'@typescript-eslint/no-explicit-any': 'off',
// this seems very broken atm, false positives
'@typescript-eslint/unbound-method': 'off',
'@typescript-eslint/restrict-template-expressions': 'off',
'@typescript-eslint/no-unsafe-member-access': 'off',
'@typescript-eslint/no-unsafe-assignment': 'off',
'@typescript-eslint/no-unsafe-return': 'off',
'header/header': 'off',
'object-curly-newline': 'off',
'sort-keys': 'off',
'simple-import-sort/imports': [2, {
groups: [
['^\u0000'], // all side-effects (0 at start)
['\u0000$', '^@polkadot.*\u0000$', '^\\..*\u0000$'], // types (0 at end)
['^[^/\\.]'], // non-polkadot
['^@polkadot'], // polkadot
['^\\.\\.(?!/?$)', '^\\.\\./?$', '^\\./(?=.*/)(?!/?$)', '^\\.(?!/?$)', '^\\./?$'] // local (. last)
]
}],
},
settings: {
...base.settings,
react: {
version: 'detect'
}
}
};