-
-
Notifications
You must be signed in to change notification settings - Fork 635
/
eslint.config.mjs
134 lines (133 loc) · 5.97 KB
/
eslint.config.mjs
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
// eslint.config.js
import jsdoc from "eslint-plugin-jsdoc";
export default [
{
name: "eslint/global-ignores",
// globally ignore below directories and files
ignores: [
"*.config.mjs",
"dist/**/*",
"build/**/*",
"tests/**/*",
"docs/**/*"]
},
{
name: "eslint/global-rules",
languageOptions: {
"ecmaVersion" : 2020,
"sourceType": "module"
},
files: ["src/**/*.js"],
plugins: {
jsdoc
},
rules: {
// http://eslint.org/docs/rules/
"accessor-pairs": "error",
"array-callback-return": "error",
"arrow-body-style": ["error", "as-needed"],
"arrow-spacing": ["error", { "before": true, "after": true }],
"block-spacing": ["error", "always"],
"block-scoped-var": "error",
"brace-style": ["off", "1tbs", { "allowSingleLine": true }],
"camelcase": ["off", { "properties": "never" }],
"comma-dangle": ["error", "never"],
"comma-spacing": ["error", { "before": false, "after": true }],
"comma-style": ["error", "last"],
"constructor-super": "error",
"curly": ["error", "multi-line"],
"dot-location": ["error", "property"],
"eol-last": "error",
"eqeqeq": ["error", "allow-null"],
"func-call-spacing": ["error", "never"],
"for-direction": "error",
"handle-callback-err": ["error", "^(err|error)$" ],
"indent": ["error", 4, { "ignoredNodes": ["SwitchCase"]}],
"key-spacing": ["off", { "beforeColon": false, "afterColon": true }],
"keyword-spacing": ["error", { "before": true, "after": true }],
"new-cap": ["error", { "newIsCap": true, "capIsNew": false }],
"new-parens": "error",
"no-array-constructor": "error",
"no-caller": "error",
"no-class-assign": "error",
"no-case-declarations": "error",
"no-constructor-return": "error",
"no-duplicate-imports": "error",
"no-dupe-class-members": "error",
"no-eval": "error",
"no-extend-native": "error",
"no-extra-bind": "error",
"no-extra-parens": ["error", "functions"],
"no-floating-decimal": "error",
"no-implied-eval": "error",
"no-implicit-coercion": "off",
"no-implicit-globals": "error",
"no-import-assign": "error",
"no-iterator": "error",
"no-label-var": "error",
"no-labels": ["error", { "allowLoop": false, "allowSwitch": false }],
"no-lone-blocks": "error",
"no-loss-of-precision": "error",
"no-mixed-spaces-and-tabs": "error",
"no-multi-spaces": ["off", { "ignoreEOLComments": true }],
"no-multi-str": "error",
"no-multiple-empty-lines": ["off", { "max": 1 }],
"no-native-reassign": "error",
"no-negated-in-lhs": "error",
"no-new": "error",
"no-new-func": "error",
"no-object-constructor": "error",
"no-new-native-nonconstructor": "error",
"no-new-require": "error",
"no-new-wrappers": "error",
"no-octal-escape": "error",
"no-path-concat": "error",
"no-proto": "error",
"no-prototype-builtins": "off",
"no-promise-executor-return": "error",
"no-return-assign": ["error", "except-parens"],
"no-self-compare": "error",
"no-sequences": "off",
"no-tabs": "error",
"no-template-curly-in-string": "off",
"no-this-before-super": "error",
"no-throw-literal": "off",
"no-trailing-spaces": "error",
"no-undef-init": "error",
"no-unmodified-loop-condition": "error",
"no-unneeded-ternary": ["off", { "defaultAssignment": false }],
"no-unreachable": "error",
"no-unused-vars" : ["error", { "args": "after-used" }],
"no-unused-private-class-members": "error",
"no-useless-call": "off",
"no-useless-computed-key": "error",
"no-useless-constructor": "error",
// used in RegExp
"no-useless-escape" : "off",
"no-useless-rename": "error",
"no-whitespace-before-property": "error",
"object-property-newline": ["error", { "allowMultiplePropertiesPerLine": true }],
"one-var": ["off", { "initialized": "never" }],
"operator-linebreak": ["off", "after", { "overrides": { "?": "before", ":": "before" } }],
"padded-blocks": ["off", "never"],
"prefer-arrow-callback" : "error",
"quotes": ["error", "double", { "avoidEscape": true, "allowTemplateLiterals": true }],
"rest-spread-spacing": ["error", "never"],
"semi": ["error", "always"],
"semi-spacing": ["error", { "before": false, "after": true }],
"space-before-blocks": ["error", "always"],
"space-before-function-paren": ["off", "always"],
"space-in-parens": "error", // ["error", "never"],
"space-infix-ops": "error",
"space-unary-ops": ["off", { "words": true, "nonwords": false }],
"spaced-comment": ["off", "always", { "line": { "markers": ["*package", "!", ","] }, "block": { "balanced": true, "markers": ["*package", "!", ","], "exceptions": ["*"] } }],
"template-curly-spacing": ["error", "never"],
"unicode-bom": ["error", "never"],
"valid-typeof": ["error", { "requireStringLiterals": true }],
"yield-star-spacing": ["error", "both"],
"yoda": ["error", "never"],
"jsdoc/require-hyphen-before-param-description": "error",
"jsdoc/no-undefined-types" : "off"
}
}
];