-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
109 lines (91 loc) · 4.75 KB
/
index.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
module.exports = {
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: "es2020", // Allows for the parsing of modern ECMAScript features
sourceType: "module", // Allows for the use of imports
},
ignorePatterns: ['.*rc.js', '*.config.js', '*.config.*.js'],
plugins: [
'@typescript-eslint',
],
extends: [
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended-requiring-type-checking',
"plugin:prettier/recommended",
],
rules: {
"@typescript-eslint/no-explicit-any": "off", // We are not ready yet
"@typescript-eslint/consistent-type-imports": "error",
"@typescript-eslint/no-import-type-side-effects": "error",
"spaced-comment": ["warn", "always", { "block": { "balanced": true, "exceptions": ["/"] }, }],
"@typescript-eslint/no-unsafe-return": "off",
"@typescript-eslint/explicit-member-accessibility": ["error", { "overrides": { constructors: 'off' } }],
"@typescript-eslint/explicit-function-return-type": ["error", { allowExpressions: true }],
//This one was HARD to write. This should enforce pretty much all the naming conventions...
"@typescript-eslint/naming-convention": [
"error",
{ selector: "memberLike", modifiers: ['static'], format: ["UPPER_CASE", "camelCase"], leadingUnderscore: "forbid", trailingUnderscore: "forbid" }, //static members can be UPPER_CASE
{ selector: "memberLike", modifiers: ['private', 'readonly'], format: ["UPPER_CASE", "camelCase"], leadingUnderscore: "allow", trailingUnderscore: "forbid" }, //static members can be UPPER_CASE
{ selector: "memberLike", modifiers: ['static', 'private'], format: ["UPPER_CASE", "camelCase"], leadingUnderscore: "allow", trailingUnderscore: "forbid" }, //need to duplicate the rule above
{ selector: "memberLike", modifiers: ["private"], format: ["camelCase"], leadingUnderscore: "allow", trailingUnderscore: "forbid" }, //privates can start with underscore only if they shadow fields
{ selector: "variable", modifiers: ['const'], format: ["UPPER_CASE", "camelCase"], leadingUnderscore: "forbid", trailingUnderscore: "forbid" }, //const global variables can be UPPER_CASE
{ selector: "variableLike", format: ["camelCase"], leadingUnderscore: "forbid", trailingUnderscore: "forbid" }, //variables have to be camel
{ selector: "memberLike", format: ["camelCase"], leadingUnderscore: "forbid", trailingUnderscore: "forbid" }, //members have to be camel
{ selector: "parameter", format: ["camelCase"], leadingUnderscore: "allow", trailingUnderscore: "forbid" }, //privates can start with underscore only if they shadow fields
{ selector: "enumMember", format: ["UPPER_CASE"], leadingUnderscore: "forbid", trailingUnderscore: "forbid" }, //Enums Memebers are UPPER_CASE
{ selector: "typeLike", format: ["PascalCase"], leadingUnderscore: "forbid", trailingUnderscore: "forbid" }, // Types are PascalCase
],
"no-implicit-coercion": "error",
"curly": "error",
"@typescript-eslint/no-floating-promises": "off",
"prefer-template": 1,
"template-curly-spacing": [1, "never"],
"@typescript-eslint/no-unsafe-member-access": "off",
"@typescript-eslint/no-unsafe-call": "off",
"@typescript-eslint/no-unsafe-assignment": "off",
"@typescript-eslint/unbound-method": "off", //pixijs binds differently to .bind
"@typescript-eslint/no-unsafe-argument": "off",
"prettier/prettier": [
"warn",
{
semi: true,
trailingComma: "es5",
singleQuote: false,
printWidth: 180,
tabWidth: 4,
useTabs: true,
}
],
"@typescript-eslint/no-misused-promises": [
"error",
{
"checksVoidReturn": false
}
],
"@typescript-eslint/consistent-type-imports": "error",
"@typescript-eslint/no-import-type-side-effects": "error",
// I trust ts
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": "off",
//I don't understand it
"@typescript-eslint/no-namespace": "off",
// enums don't work with this
"@typescript-eslint/no-unsafe-enum-comparison": "off",
//
"@typescript-eslint/ban-types": ["error",
{
extendDefaults: true,
types: {
Function: {
message: [
'The `Function` type accepts any function-like value.',
'It provides no type safety when calling the function, which can be a common source of bugs.',
'It also accepts things like class declarations, which will throw at runtime as they will not be called with `new`.',
'If you are expecting the function to accept certain arguments, you should explicitly define the function shape.',
].join('\n'),
fixWith: '() => void',
},
}
}]
}
};