-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjs.js
135 lines (123 loc) · 3.54 KB
/
js.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
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
135
/** @type {import("eslint").Linter.Config} */
const config = {
plugins: [
"unused-imports",
"no-relative-import-paths",
"jsdoc",
"prefer-arrow-functions",
"@stylistic",
"import",
],
extends: [
"eslint:recommended",
"plugin:jsdoc/recommended",
"plugin:import/typescript",
],
settings: {
"import/resolver": {
typescript: true,
node: true,
},
},
overrides: [
{
files: ["*.js", "*.jsx"],
extends: ["biome"],
},
],
rules: {
/** ignoreRestSiblings: Ignore {unusedProp, ...rest} */
"no-unused-vars": ["warn", { ignoreRestSiblings: true }],
/** https://eslint.org/docs/rules/require-await */
"require-await": "warn",
/**
* Disallow Number Literals That Lose Precision
* https://eslint.org/docs/rules/no-loss-of-precision
*/
"no-loss-of-precision": "error",
/** Warn about unreachable code. */
"no-unreachable-loop": "warn",
/** Disable error about empty functions. This is good to allow .catch(() => {}) */
"no-empty-function": "off",
/**
* Space after comment.
* https://eslint.org/docs/rules/spaced-comment
*/
"spaced-comment": [
"warn",
"always",
{ exceptions: ["-", "+"], markers: ["/"] },
],
/**
* Newline after class members.
* https://eslint.org/docs/latest/rules/lines-between-class-members
*/
"lines-between-class-members": [
"warn",
"always",
{
exceptAfterSingleLine: true,
},
],
/**
* Automatically removes unused imports. Saves time!
*
* https://github.com/sweepline/eslint-plugin-unused-imports
*/
"unused-imports/no-unused-imports": "warn",
/**
* Simplify objects.
* https://eslint.org/docs/rules/object-shorthand
*/
"object-shorthand": ["warn", "always"],
/**
* Disallow `throw 4` and `throw 'error'`. It will be required to always throw an Error-like object,
* such as `throw new Error('error')`.
*
* https://eslint.org/docs/latest/rules/no-throw-literal
*/
"no-throw-literal": "warn",
/**
* https://github.com/JamieMason/eslint-plugin-prefer-arrow-functions
*/
"prefer-arrow-functions/prefer-arrow-functions": [
"warn",
{
allowNamedFunctions: true,
},
],
/** https://github.com/gajus/eslint-plugin-jsdoc */
"jsdoc/require-jsdoc": "off",
"jsdoc/require-param": "off",
"jsdoc/require-returns": "off",
"@stylistic/padding-line-between-statements": [
"warn",
// Line before return
{ blankLine: "always", prev: "*", next: "return" },
// Line after vars block
{ blankLine: "always", prev: ["const", "let", "var"], next: "*" },
{
blankLine: "any",
prev: ["const", "let", "var"],
next: ["const", "let", "var"],
},
// Line before function
{ blankLine: "always", prev: "*", next: "function" },
// Line before type/interface (TS)
{ blankLine: "always", prev: "*", next: ["interface", "type"] },
// Line after import block
{ blankLine: "always", prev: "import", next: "*" },
{ blankLine: "any", prev: "import", next: "import" },
// Line before export block
{ blankLine: "always", prev: "*", next: "export" },
],
/**
* Remove wrapping braces if they can be omitted
* https://eslint.org/docs/latest/rules/arrow-body-style
*/
"arrow-body-style": "warn",
"import/no-anonymous-default-export": "off",
"import/no-unresolved": "error",
},
}
module.exports = config