-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.js
101 lines (101 loc) · 2.92 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
module.exports = {
parser: "@typescript-eslint/parser",
parserOptions: {
tsconfigRootDir: __dirname,
project: ["./tsconfig.lint.json"],
},
extends: [
"plugin:@typescript-eslint/recommended", // uses typescript-specific linting rules
"plugin:@typescript-eslint/recommended-requiring-type-checking", // enables additional rules with type definitions
"plugin:prettier/recommended", // enables eslint-plugin-prettier and eslint-config-prettier
"plugin:jest/recommended", // enforces Jest-specific rules
"plugin:jest/style", // enforces Jest-specific styles
"plugin:import/errors",
"plugin:import/warnings",
"plugin:import/typescript",
],
ignorePatterns: ["deno/", "dist/"],
rules: {
"no-console": "error",
"no-magic-numbers": ["error", { ignore: [0, 1, -1, 2, 0.5, -2, -0.5] }],
"no-multiple-empty-lines": ["error", { max: 1, maxEOF: 0 }],
"@typescript-eslint/camelcase": "off",
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/restrict-template-expressions": "off",
"@typescript-eslint/explicit-module-boundary-types": [
"error",
{
allowHigherOrderFunctions: true,
},
],
"@typescript-eslint/no-explicit-any": ["error"],
"@typescript-eslint/no-unused-vars": [
"error",
{ argsIgnorePattern: "^_", ignoreRestSiblings: true },
],
"@typescript-eslint/naming-convention": [
"error",
{
selector: "default",
format: ["camelCase", "PascalCase"],
},
{
selector: "typeParameter",
filter: "^[A-Z]$",
format: ["PascalCase"],
},
{
selector: "typeParameter",
filter: {
regex: "^.{2,}$",
match: true,
},
format: ["PascalCase"],
prefix: ["T"],
},
{
selector: "variable",
format: ["camelCase", "UPPER_CASE", "PascalCase"],
trailingUnderscore: "allowSingleOrDouble",
},
{
selector: "function",
format: ["PascalCase", "camelCase"],
trailingUnderscore: "allow",
},
{
selector: "function",
filter: "^(UNSAFE_|INTERNAL_|DEPRECATED_|__opt_)",
prefix: ["UNSAFE_", "INTERNAL_", "DEPRECATED_", "__opt_"],
format: ["camelCase"],
},
{
selector: "parameter",
format: ["camelCase"],
leadingUnderscore: "allow",
},
{
selector: "method",
filter: "^UNSAFE_",
prefix: ["UNSAFE_"],
format: ["camelCase"],
},
{
selector: "property",
modifiers: ["readonly"],
format: ["camelCase", "PascalCase", "UPPER_CASE"],
},
],
"jest/no-commented-out-tests": "error",
"jest/no-disabled-tests": "error",
},
plugins: ["@typescript-eslint", "jest"],
overrides: [
{
files: ["*.test.ts", "*.test.tsx"],
rules: {
"no-magic-numbers": "off",
},
},
],
};