-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eslintrc.js
72 lines (71 loc) · 3.2 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
module.exports = {
root: true,
env: {
node: true,
es2021: true,
},
plugins: ['@typescript-eslint', 'prettier'],
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:eslint-comments/recommended',
'plugin:prettier/recommended'
],
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 2021,
project: './tsconfig.eslint.json',
},
rules: {
'array-callback-return': ['error'], // Enforce return statements in callbacks of array methods
'no-constructor-return': ['error'], // Disallow returning value in constructor
'no-promise-executor-return': ['error'], // Disallow returning values from Promise executor
'no-template-curly-in-string': ['error'], // Disallow template literal placeholder syntax in regular strings
'require-atomic-updates': ['error'], // Disallow assignments that can lead to race conditions due to usage of await or yield
'no-self-compare': ['error'], // Disallow self compare
'no-console': ['warn', { allow: ['warn', 'error'] }], // Disallow the use of console, except for warn and error
'no-await-in-loop': ['warn'], // Disallow await inside of loops
'no-unmodified-loop-condition': ['warn'], // Disallow unmodified loop conditions
'no-use-before-define': 'off', // Turn off this rule as @typescript-eslint also has this rule
eqeqeq: ['error', 'always', { null: 'ignore' }], // Enforce the use of === and !==, but allow (==null)
'@typescript-eslint/no-unused-vars': ['error', { vars: 'all', args: 'none' }], // Disallow unused variables
'@typescript-eslint/no-inferrable-types': ['off'], // Disallow obvious type redundancies
'@typescript-eslint/consistent-type-imports': ['error'], // Enforce consistent import style
'@typescript-eslint/ban-tslint-comment': ['error'], // Disallow TSLint comments
'@typescript-eslint/class-literal-property-style': ['error'], // Enforce class members to use equals assignment
'@typescript-eslint/consistent-type-assertions': ['error'], // Enforce consistent type assertion style
'@typescript-eslint/no-misused-new': ['off'],
'@typescript-eslint/consistent-type-exports': [
// Enforce consistent export style
'error',
{
fixMixedExportsWithInlineTypeSpecifier: false,
},
],
'@typescript-eslint/ban-ts-comment': [
// Disallow TSLint comments, with a few exceptions
'error',
{
'ts-expect-error': { descriptionFormat: '^: TS\\d+ (?:because\\s).+$' },
'ts-ignore': 'allow-with-description',
'ts-nocheck': true,
'ts-check': false,
minimumDescriptionLength: 4,
},
],
'@typescript-eslint/no-explicit-any': ['error', { ignoreRestArgs: true, fixToUnknown: true }], // Disallow explicit use of any type
'@typescript-eslint/no-non-null-assertion': 'off', // Turn off the rule "Disallow non-null assertion"
'@typescript-eslint/no-use-before-define': [
'error',
{
functions: false,
classes: true,
variables: true,
allowNamedExports: false,
enums: true,
typedefs: false,
// ignoreTypeReferences: true,
},
], // Disallow the use of variables before they are defined
},
};