This repository has been archived by the owner on Aug 16, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eslintrc.js
94 lines (85 loc) · 3.02 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
module.exports = {
root: true,
// rule presets and plugins
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"plugin:import/recommended",
"plugin:import/typescript",
],
parser: "@typescript-eslint/parser",
plugins: ["@typescript-eslint"],
env: {
es2022: true,
browser: false,
node: true,
mocha: true,
},
// custom rules
// see https://eslint.org/docs/latest/rules
rules: {
// logic
"prefer-const": "warn",
"no-promise-executor-return": "warn",
"consistent-return": "warn",
"no-unneeded-ternary": "warn",
yoda: "warn",
"@typescript-eslint/no-unused-vars": ["warn", { argsIgnorePattern: "^_" }],
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/ban-ts-comment": "off",
// imports
"import/order": [
"warn",
{
alphabetize: { order: "asc", caseInsensitive: true },
pathGroups: [{ pattern: "@klaytn/**", group: "parent", position: "after" }],
"newlines-between": "always",
pathGroupsExcludedImportTypes: ["@klaytn/**"],
},
],
// formatting
curly: ["warn", "all"],
"brace-style": ["warn", "1tbs", { allowSingleLine: true }],
semi: "warn",
"no-extra-semi": "warn",
quotes: ["warn", "double", { avoidEscape: true }],
"comma-dangle": ["warn", "only-multiline"],
"arrow-parens": "warn",
"wrap-iife": "warn",
// formatting about spaces
"max-len": ["off", 180],
indent: ["warn", 4],
"linebreak-style": ["warn", "unix"],
"no-trailing-spaces": "warn",
"no-multiple-empty-lines": "warn",
"no-multi-spaces": "warn",
"padded-blocks": ["warn", "never", { allowSingleLineBlocks: true }],
"lines-between-class-members": ["warn", "always", { exceptAfterSingleLine: true }],
"space-before-blocks": ["warn", "always"],
"space-before-function-paren": ["warn", { named: "never", anonymous: "always", asyncArrow: "always" }],
"space-in-parens": ["warn", "never"],
"space-infix-ops": "warn",
"spaced-comment": "warn",
"no-whitespace-before-property": "warn",
"array-bracket-spacing": "warn",
"arrow-spacing": "warn",
"block-spacing": "warn",
"comma-spacing": "warn",
"key-spacing": ["warn", { mode: "minimum" }],
"keyword-spacing": "warn",
"semi-spacing": "warn",
},
overrides: [
{
// tests use relaxed rules
files: ["test/**/*"],
rules: {
"@typescript-eslint/no-var-requires": "off",
// give some flexibility adding and deleting variables
"@typescript-eslint/no-unused-vars": "off",
"prefer-const": "off",
},
},
],
};