-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.cjs
140 lines (140 loc) · 3.86 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
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
module.exports = {
parser: '@typescript-eslint/parser',
env: {
browser: true,
},
parserOptions: {
ecmaVersion: 2020,
sourceType: 'module',
},
plugins: ['svelte3', '@typescript-eslint', 'prettier'],
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
'prettier',
],
overrides: [
{
files: ['*.svelte'],
processor: 'svelte3/svelte3',
},
],
rules: {
// Errors
'no-console': 'warn',
// Best practices
'array-callback-return': ['error', { allowImplicit: true }],
'block-scoped-var': 'error',
'consistent-return': 'error',
curly: ['error', 'multi-line'],
'default-param-last': 'error',
'dot-notation': ['error', { allowKeywords: true }],
eqeqeq: ['error', 'always', { null: 'ignore' }],
'guard-for-in': 'error',
'max-classes-per-file': ['error', 1],
'no-alert': 'error',
'no-caller': 'error',
'no-eval': 'error',
'no-extend-native': 'error',
'no-extra-bind': 'error',
'no-extra-label': 'error',
'no-floating-decimal': 'error',
'no-implicit-coercion': [
'off',
{
boolean: false,
number: true,
string: true,
allow: [],
},
],
'no-iterator': 'error',
'no-labels': ['error', { allowLoop: false, allowSwitch: false }],
'no-lone-blocks': 'error',
'no-loop-func': 'error',
'no-multi-str': 'error',
'no-new': 'error',
'no-new-func': 'error',
'no-new-wrappers': 'error',
'no-param-reassign': [
'error',
{
props: true,
ignorePropertyModificationsFor: [
'acc', // for reduce accumulators
'accumulator', // for reduce accumulators
'e', // for e.returnvalue
'ctx', // for Koa routing
'context', // for Koa routing
'req', // for Express requests
'request', // for Express requests
'res', // for Express responses
'response', // for Express responses
'$scope', // for Angular 1 scopes
'staticContext', // for ReactRouter context
],
},
],
'no-proto': 'error',
'no-return-assign': ['error', 'always'],
'no-return-await': 'error',
'no-script-url': 'error',
'no-self-assign': [
'error',
{
props: true,
},
],
'no-self-compare': 'error',
'no-sequences': 'error',
'no-unused-expressions': [
'error',
{
allowShortCircuit: false,
allowTernary: false,
allowTaggedTemplates: false,
},
],
'no-useless-concat': 'error',
'no-useless-return': 'error',
'prefer-promise-reject-errors': ['error', { allowEmptyReject: true }],
'vars-on-top': 'error',
// Variables:
'no-label-var': 'error',
'no-shadow': 'off',
'@typescript-eslint/no-shadow': ['error'],
'no-shadow-restricted-names': 'error',
'no-undef-init': 'error',
'no-unused-vars': 'off',
'@typescript-eslint/no-unused-vars': ['error'],
// 'no-use-before-define': ['error', { functions: true, classes: true, variables: true }],
'no-use-before-define': 'off',
'@typescript-eslint/no-use-before-define': ['error'],
'no-redeclare': 'off',
'@typescript-eslint/no-redeclare': ['error'],
// Style
semi: ['error', 'always'],
// ES6
'no-var': 'error',
// -------------
// TBD:
// https://eslint.org/docs/rules/no-extra-parens
// https://eslint.org/docs/rules/class-methods-use-this
// https://eslint.org/docs/rules/dot-location
// https://eslint.org/docs/rules/no-else-return
// -------------
},
settings: {
// eslint-disable-next-line global-require
'svelte3/typescript': require('typescript'),
},
ignorePatterns: [
'node_modules/*',
'dist/*',
'types',
'.prettierrc.js',
'.eslintrc.js',
'tailwind.config.js',
],
};