-
Notifications
You must be signed in to change notification settings - Fork 3
/
.eslintrc.cjs
85 lines (84 loc) · 2.98 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
module.exports = {
parser: '@typescript-eslint/parser',
parserOptions: {
project: 'tsconfig.json',
ecmaVersion: 2021, // Allows for the parsing of modern ECMAScript features
sourceType: 'module', // Allows for the use of imports
tsconfigRootDir: __dirname,
},
overrides: [
{
files: ['*.ts', '*.tsx'],
parserOptions: {
project: ['./tsconfig.json'],
},
},
],
root: true,
plugins: ['@typescript-eslint', 'import'],
extends: [
'airbnb-base',
'airbnb-typescript/base',
'plugin:@typescript-eslint/recommended',
'prettier',
// 'plugin:prettier/recommended', // Enables eslint-plugin-prettier and eslint-config-prettier. This will display prettier errors as ESLint errors. Make sure this is always the last configuration in the extends array.
],
rules: {
eqeqeq: 2, // error
// 'no-underscore-dangle' : ['error', {allowAfterThis: true}],
'no-underscore-dangle': ['off'],
// 'max-len': ["error", { "code": 120 ,"ignoreComments": true }],
'class-methods-use-this': 'off',
// Place to specify ESLint rules. Can be used to overwrite rules specified from the extended configs
// e.g. "@typescript-eslint/explicit-function-return-type": "off",
// 'newline-per-chained-call': 'error',
'import/extensions': 'off',
'import/prefer-default-export': 'off',
// TODO: remove rules quotes and semi, should be in prettier config. Cannot do it for now, as wrong nvim config
'@typescript-eslint/quotes': [
'error',
'single',
{
avoidEscape: true,
},
],
semi: 'off',
'@typescript-eslint/semi': 'error',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
// '@typescript-eslint/indent': ["error", 2],
'@typescript-eslint/camelcase': 'off',
'@typescript-eslint/no-empty-interface': [
'error',
{
allowSingleExtends: true,
},
],
'@typescript-eslint/no-unused-vars': [
'error',
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_', // https://github.com/typescript-eslint/typescript-eslint/issues/1054
},
],
'@typescript-eslint/no-explicit-any': ['warn'],
'@typescript-eslint/no-useless-constructor': 'error',
'@typescript-eslint/no-use-before-define': [
'error',
{ functions: false, classes: true },
],
'@typescript-eslint/no-shadow': ['warn'],
'no-throw-literal': 'off',
'@typescript-eslint/no-throw-literal': ['error'],
// prefer es2015 import/export over namespaces and modules
// only allow declare module for external modules in .d.ts files
'@typescript-eslint/no-namespace': ['error'],
// prefer foo as string type assertion to <string>foo
// and
// prefer `const foo:someType = bar` over `const foo = bar as someType`
'@typescript-eslint/consistent-type-assertions': [
'error',
{ assertionStyle: 'as', objectLiteralTypeAssertions: 'never' },
],
},
};