forked from gristlabs/grist-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.js
123 lines (121 loc) · 4.89 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
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
module.exports = {
// Basic settings for JS files.
extends: ['eslint:recommended'],
env: {
node: true,
es6: true,
mocha: true,
},
// Set parser to support, e.g. import() function for dynamic imports (see
// https://stackoverflow.com/a/47833471/328565 and https://stackoverflow.com/a/69557309/328565).
parser: '@babel/eslint-parser',
parserOptions: {
ecmaVersion: 2018,
requireConfigFile: false,
},
ignorePatterns: [
"/static/**/*.js", // Built JS bundles
"*-ti.ts", // Files generated by ts-interface-builder
],
rules: {
'no-unused-vars': ["error", {args: "none"}],
'no-prototype-builtins': 'off',
'no-trailing-spaces': 'warn',
'comma-spacing': 'warn',
'semi-spacing': 'warn',
},
// The Typescript-specific settings apply only to TS files. ESLint is expensive here, and has to
// analyze dependencies for type-checking. (In an editor, it's much faster when used with
// tsserver.)
overrides: [{
files: "**/*.ts",
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/recommended-requiring-type-checking',
],
parser: "@typescript-eslint/parser",
plugins: ["@typescript-eslint"],
parserOptions: {
tsconfigRootDir: __dirname,
project: ['./tsconfig.eslint.json'],
sourceType: 'module',
ecmaVersion: 2018,
},
env: {
node: true,
browser: true,
es6: true,
mocha: true,
},
globals: {
Promise: true
},
rules: {
// A lot of the options below would be helpful to keep on, but would need a lot of fix-ups.
"@typescript-eslint/ban-types": 'off',
"@typescript-eslint/explicit-member-accessibility": ["error", {overrides: {constructors: 'off'}}],
"@typescript-eslint/explicit-module-boundary-types": 'off',
// These settings mimic what we had before with tslint.
"@typescript-eslint/member-ordering": ["warn", {default: [
'public-static-field',
'public-static-method',
'protected-static-field', 'private-static-field', 'static-field',
'protected-static-method', 'private-static-method', 'static-method',
'public-field', 'protected-field', 'private-field', 'field',
'public-constructor', 'protected-constructor', 'private-constructor', 'constructor',
'public-method', 'protected-method', 'private-method', 'method',
]}],
"@typescript-eslint/naming-convention": ["warn", {
selector: "memberLike", filter: { match: false, regex: '(listenTo)' },
modifiers: ["private"], format: ["camelCase"], leadingUnderscore: "require"
}],
"@typescript-eslint/no-empty-function": 'off',
"@typescript-eslint/no-explicit-any": 'off',
"@typescript-eslint/no-inferrable-types": 'off',
"@typescript-eslint/no-misused-promises": ["error", {"checksVoidReturn": false}],
"@typescript-eslint/no-namespace": 'off',
"@typescript-eslint/no-non-null-assertion": 'off',
"@typescript-eslint/no-shadow": ["warn", { ignoreTypeValueShadow: true }],
"@typescript-eslint/no-this-alias": 'off',
"@typescript-eslint/no-type-alias": ["warn", {
"allowAliases": "always",
"allowCallbacks": "always",
"allowConditionalTypes": "always",
"allowConstructors": "always",
"allowLiterals": "in-unions-and-intersections",
"allowMappedTypes": "always",
"allowTupleTypes": "always",
"allowGenerics": "always",
}],
"@typescript-eslint/no-unsafe-assignment": 'off',
"@typescript-eslint/no-unsafe-argument": 'off',
"@typescript-eslint/no-unsafe-call": 'off',
"@typescript-eslint/no-unsafe-member-access": 'off',
"@typescript-eslint/no-unsafe-return": 'off',
"@typescript-eslint/no-unused-vars": ["error", { "vars": "all", "args": "none", "ignoreRestSiblings": false }],
"@typescript-eslint/no-var-requires": 'off',
"@typescript-eslint/prefer-regexp-exec": 'off',
"@typescript-eslint/require-await": 'off',
"@typescript-eslint/restrict-plus-operands": 'off',
"@typescript-eslint/restrict-template-expressions": 'off',
"@typescript-eslint/type-annotation-spacing": 'warn',
"@typescript-eslint/unbound-method": 'off',
'no-undef': 'off',
'no-prototype-builtins': 'off',
'prefer-rest-params': 'off',
'no-console': 'off',
'no-shadow': 'off',
'no-inner-declarations': 'off',
'max-len': ['warn', {code: 120, ignoreUrls: true}],
'sort-imports': ['warn', {ignoreDeclarationSort: true, ignoreCase: true, allowSeparatedGroups: true}],
'no-trailing-spaces': 'warn',
'no-unused-expressions': ["error", {allowShortCircuit: true, allowTernary: true}],
'block-spacing': ['warn', 'always'],
'comma-spacing': 'warn',
'curly': ['warn', 'all'],
'semi': ['warn', 'always'],
'semi-spacing': 'warn',
},
}]
}