-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eslintrc.cjs
77 lines (77 loc) · 3.28 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
/* eslint-env node */
module.exports = {
extends: ["@lp/eslint-config"],
plugins: ["@typescript-eslint"],
parser: "@typescript-eslint/parser",
parserOptions: {
project: true,
tsconfigRootDir: __dirname,
},
/**
* You can use the rules inside this overrides to specify the rules you want
* to use on a one by one / case by case basis. If you simply want to go with
* the default, just remove or uncomment the whole "rules" section inside the
* "overrides" property and you are done.
*
* The following rules are my personal preference and reflect a subset of the
* recommended options. They also include a lot of the more strict options NOT
* included in the recommended ones. My goal is to simplify having a
* consistent code base/code style, to avoid catchable bugs early and advocate
* for usage of newer features of the language.
**/
overrides: [
{
// Enables type checking for typescript files.
// Src for the overrides from here :
// https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/configs/eslint-recommended.ts
files: ["*.ts", "*.tsx", "*.mts", "*.cts"],
rules: {
// "eslint" rules
// check https://eslint.org/docs/latest/rules/ for reference
"no-cond-assign": ["error", "always"],
eqeqeq: ["error"],
"no-constant-binary-expression": "error",
curly: "error",
"default-case": "error",
"default-case-last": "error",
"no-constant-condition": "error",
"no-duplicate-imports": "error",
"no-fallthrough": "error",
"use-isnan": "error",
"arrow-body-style": ["error", "always"],
"no-loss-of-precision": "error",
"no-promise-executor-return": "error",
"arrow-body-style": "off",
// See "when not to use it", and check your use case, if you think this
// rule should be disabled.
// "no-await-in-loop": "error",
"no-useless-escape": "error",
"prefer-object-spread": "error",
"prefer-spread": "error",
"no-empty": "error",
"no-useless-catch": "error",
// See "when not to use it", and check your use case, if you think this
// rule should be disabled.
"no-bitwise": "error",
// typescript-eslint rules
// check https://typescript-eslint.io/rules/ for reference
"@typescript-eslint/array-type": "error",
"@typescript-eslint/consistent-type-definitions": ["error", "type"],
"@typescript-eslint/no-unnecessary-condition": "error",
"@typescript-eslint/prefer-includes": "error",
"@typescript-eslint/prefer-optional-chain": "error",
"@typescript-eslint/prefer-reduce-type-parameter": "error",
"@typescript-eslint/prefer-string-starts-ends-with": "error",
"@typescript-eslint/ban-types": "error",
// "@typescript-eslint/no-explicit-any": "",
// "@typescript-eslint/no-for-in-array": "error",
"@typescript-eslint/no-unsafe-call": "off",
// "@typescript-eslint/no-unsafe-return": "error",
// "@typescript-eslint/no-unsafe-member-access": "error",
"@typescript-eslint/no-var-requires": "error",
"@typescript-eslint/restrict-plus-operands": "error",
},
},
],
root: true,
};