-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy patheslint.config.mjs
More file actions
76 lines (75 loc) · 3.54 KB
/
eslint.config.mjs
File metadata and controls
76 lines (75 loc) · 3.54 KB
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
import eslint from '@eslint/js';
import stylisticTs from '@stylistic/eslint-plugin';
import tseslint from 'typescript-eslint';
export default tseslint.config(
eslint.configs.recommended,
tseslint.configs.strictTypeChecked,
tseslint.configs.stylisticTypeChecked,
stylisticTs.configs.all,
{
languageOptions: {
parserOptions: {
ecmaVersion: 5,
projectService: true,
}
},
rules: {
"@typescript-eslint/consistent-type-assertions": ["error", { assertionStyle: "angle-bracket" }],
"@typescript-eslint/prefer-includes": "off", // not in es5
"@typescript-eslint/prefer-literal-enum-member": "off", // enums are used as bit flags for clean efficiency
"@typescript-eslint/prefer-nullish-coalescing": "off", // too verbose in es5
"@typescript-eslint/prefer-optional-chain": "off", // too verbose in es5
"@typescript-eslint/prefer-string-starts-ends-with": "off", // not in es5
"@typescript-eslint/no-confusing-void-expression": ["error", { ignoreArrowShorthand: true }],
"@typescript-eslint/no-inferrable-types": "warn",
"@typescript-eslint/no-unnecessary-condition": "warn",
"@typescript-eslint/no-unsafe-enum-comparison": "off", // enums are only used as labelled numbers
"@typescript-eslint/restrict-plus-operands": ["error", { allowNumberAndString: true }],
"@typescript-eslint/restrict-template-expressions": ["error", { allowArray: true, allowBoolean: true, allowNullish: true, allowNumber: true }],
"@typescript-eslint/triple-slash-reference": "off", // needed for openrct2 symbols
"@typescript-eslint/unified-signatures": "off", // signatures are split for easier readability
"@stylistic/array-bracket-newline": ["error", "consistent"],
"@stylistic/array-element-newline": ["error", "consistent"],
"@stylistic/arrow-parens": ["error", "as-needed"],
"@stylistic/brace-style": ["error", "allman"],
"@stylistic/dot-location": ["error", "property"],
"@stylistic/function-call-argument-newline": ["error", "consistent"],
"@stylistic/function-paren-newline": ["error", "consistent"],
"@stylistic/implicit-arrow-linebreak": "off", // depends on situation
"@stylistic/indent": ["error", "tab", { "flatTernaryExpressions": true, "ignoredNodes": ["ArrowFunctionExpression", "ImportDeclaration", "ObjectExpression"], "SwitchCase": 1 }],
"@stylistic/indent-binary-ops": ["error", "tab"],
"@stylistic/keyword-spacing": ["error", { "overrides": { "this": { "before": false } } }],
"@stylistic/linebreak-style": ["error", "windows"],
"@stylistic/lines-around-comment": "off",
"@stylistic/lines-between-class-members": "off",
"@stylistic/multiline-ternary": ["error", "always-multiline"],
"@stylistic/nonblock-statement-body-position": ["error", "below"],
"@stylistic/operator-linebreak": ["error", "before"],
"@stylistic/no-extra-parens": "off",
"@stylistic/no-multi-spaces": ["error", { ignoreEOLComments: true }],
"@stylistic/padded-blocks": "off", // not needed with Allman braces
"@stylistic/quote-props": "off",
"@stylistic/object-curly-spacing": "off",
"@stylistic/object-property-newline": "off",
"@stylistic/space-before-function-paren": ["error", "never"],
}
},
{
files: [
"**/tests/**/*.ts"
],
rules: {
"@typescript-eslint/dot-notation": "off", // by-passes allowed in tests
"@typescript-eslint/no-non-null-assertion": "off", // allowed in tests
"@stylistic/brace-style": ["error", "allman", { "allowSingleLine": true }], // single lines allowed in tests
}
},
{
ignores: [
"**/dist/**",
"**/lib/**",
"**/*.config.{js,mjs}",
"**/_setup.cjs"
]
}
);