@cany748/eslint-config 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +366 -0
- package/package.json +26 -0
package/index.js
ADDED
|
@@ -0,0 +1,366 @@
|
|
|
1
|
+
/* eslint-disable unicorn/prefer-module */
|
|
2
|
+
module.exports = {
|
|
3
|
+
env: {
|
|
4
|
+
browser: true,
|
|
5
|
+
},
|
|
6
|
+
reportUnusedDisableDirectives: true,
|
|
7
|
+
extends: [
|
|
8
|
+
"eslint:recommended",
|
|
9
|
+
"standard",
|
|
10
|
+
"plugin:unicorn/recommended",
|
|
11
|
+
"plugin:import/recommended",
|
|
12
|
+
"plugin:n/recommended",
|
|
13
|
+
"plugin:eslint-comments/recommended",
|
|
14
|
+
"plugin:prettier/recommended",
|
|
15
|
+
"plugin:jsonc/recommended-with-jsonc",
|
|
16
|
+
"plugin:jsonc/prettier",
|
|
17
|
+
"plugin:yml/recommended",
|
|
18
|
+
"plugin:yml/prettier",
|
|
19
|
+
],
|
|
20
|
+
ignorePatterns: [
|
|
21
|
+
"*.min.*",
|
|
22
|
+
"dist",
|
|
23
|
+
"build",
|
|
24
|
+
"LICENSE*",
|
|
25
|
+
"fixtures",
|
|
26
|
+
".nuxt",
|
|
27
|
+
"output",
|
|
28
|
+
".output",
|
|
29
|
+
"out",
|
|
30
|
+
"coverage",
|
|
31
|
+
"public",
|
|
32
|
+
"temp",
|
|
33
|
+
"auto-import.d.ts",
|
|
34
|
+
"components.d.ts",
|
|
35
|
+
"package-lock.json",
|
|
36
|
+
"pnpm-lock.yaml",
|
|
37
|
+
"yarn.lock",
|
|
38
|
+
"__snapshots__",
|
|
39
|
+
// ignore for in lint-staged
|
|
40
|
+
"*.css",
|
|
41
|
+
"*.png",
|
|
42
|
+
"*.ico",
|
|
43
|
+
"*.toml",
|
|
44
|
+
"*.patch",
|
|
45
|
+
"*.txt",
|
|
46
|
+
"*.crt",
|
|
47
|
+
"*.key",
|
|
48
|
+
"Dockerfile",
|
|
49
|
+
"vendor/*",
|
|
50
|
+
// force include
|
|
51
|
+
"!.github",
|
|
52
|
+
"!.vitepress",
|
|
53
|
+
"!.vscode",
|
|
54
|
+
// force exclude
|
|
55
|
+
"**/.vitepress/cache",
|
|
56
|
+
],
|
|
57
|
+
plugins: ["html", "unused-imports"],
|
|
58
|
+
settings: {
|
|
59
|
+
"import/resolver": {
|
|
60
|
+
node: { extensions: [".js", ".jsx", ".mjs", ".ts", ".tsx", ".d.ts"] },
|
|
61
|
+
},
|
|
62
|
+
node: {
|
|
63
|
+
version: ">=16.0.0",
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
overrides: [
|
|
67
|
+
{
|
|
68
|
+
files: ["*.json", "*.json5", "*.jsonc"],
|
|
69
|
+
parser: "jsonc-eslint-parser",
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
files: ["*.yaml", "*.yml"],
|
|
73
|
+
parser: "yaml-eslint-parser",
|
|
74
|
+
},
|
|
75
|
+
// package.json sorting
|
|
76
|
+
{
|
|
77
|
+
files: ["package.json"],
|
|
78
|
+
parser: "jsonc-eslint-parser",
|
|
79
|
+
rules: {
|
|
80
|
+
"jsonc/sort-keys": [
|
|
81
|
+
"error",
|
|
82
|
+
{
|
|
83
|
+
pathPattern: "^$",
|
|
84
|
+
order: [
|
|
85
|
+
"publisher",
|
|
86
|
+
"name",
|
|
87
|
+
"displayName",
|
|
88
|
+
"type",
|
|
89
|
+
"version",
|
|
90
|
+
"private",
|
|
91
|
+
"packageManager",
|
|
92
|
+
"description",
|
|
93
|
+
"author",
|
|
94
|
+
"license",
|
|
95
|
+
"funding",
|
|
96
|
+
"homepage",
|
|
97
|
+
"repository",
|
|
98
|
+
"bugs",
|
|
99
|
+
"keywords",
|
|
100
|
+
"categories",
|
|
101
|
+
"sideEffects",
|
|
102
|
+
"exports",
|
|
103
|
+
"main",
|
|
104
|
+
"module",
|
|
105
|
+
"unpkg",
|
|
106
|
+
"jsdelivr",
|
|
107
|
+
"types",
|
|
108
|
+
"typesVersions",
|
|
109
|
+
"bin",
|
|
110
|
+
"icon",
|
|
111
|
+
"files",
|
|
112
|
+
"engines",
|
|
113
|
+
"activationEvents",
|
|
114
|
+
"contributes",
|
|
115
|
+
"scripts",
|
|
116
|
+
"peerDependencies",
|
|
117
|
+
"peerDependenciesMeta",
|
|
118
|
+
"dependencies",
|
|
119
|
+
"optionalDependencies",
|
|
120
|
+
"devDependencies",
|
|
121
|
+
"pnpm",
|
|
122
|
+
"overrides",
|
|
123
|
+
"resolutions",
|
|
124
|
+
"husky",
|
|
125
|
+
"simple-git-hooks",
|
|
126
|
+
"lint-staged",
|
|
127
|
+
"eslintConfig",
|
|
128
|
+
"prettier",
|
|
129
|
+
"stylelint",
|
|
130
|
+
],
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
pathPattern: "^(?:dev|peer|optional|bundled)?[Dd]ependencies$",
|
|
134
|
+
order: { type: "asc" },
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
pathPattern: "^resolutions$",
|
|
138
|
+
order: { type: "asc" },
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
pathPattern: "^pnpm.overrides$",
|
|
142
|
+
order: { type: "asc" },
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
pathPattern: "^exports.*$",
|
|
146
|
+
order: ["types", "import", "require", "default"],
|
|
147
|
+
},
|
|
148
|
+
],
|
|
149
|
+
},
|
|
150
|
+
},
|
|
151
|
+
// tsconfig.json sorting
|
|
152
|
+
{
|
|
153
|
+
files: ["**/tsconfig.json", "**/tsconfig.*.json"],
|
|
154
|
+
parser: "jsonc-eslint-parser",
|
|
155
|
+
rules: {
|
|
156
|
+
"jsonc/sort-keys": [
|
|
157
|
+
"error",
|
|
158
|
+
{
|
|
159
|
+
pathPattern: "^$",
|
|
160
|
+
order: ["extends", "compilerOptions", "references", "files", "include", "exclude"],
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
pathPattern: "^compilerOptions$",
|
|
164
|
+
order: [
|
|
165
|
+
/* Projects */
|
|
166
|
+
"incremental",
|
|
167
|
+
"composite",
|
|
168
|
+
"tsBuildInfoFile",
|
|
169
|
+
"disableSourceOfProjectReferenceRedirect",
|
|
170
|
+
"disableSolutionSearching",
|
|
171
|
+
"disableReferencedProjectLoad",
|
|
172
|
+
/* Language and Environment */
|
|
173
|
+
"target",
|
|
174
|
+
"lib",
|
|
175
|
+
"jsx",
|
|
176
|
+
"experimentalDecorators",
|
|
177
|
+
"emitDecoratorMetadata",
|
|
178
|
+
"jsxFactory",
|
|
179
|
+
"jsxFragmentFactory",
|
|
180
|
+
"jsxImportSource",
|
|
181
|
+
"reactNamespace",
|
|
182
|
+
"noLib",
|
|
183
|
+
"useDefineForClassFields",
|
|
184
|
+
"moduleDetection",
|
|
185
|
+
/* Modules */
|
|
186
|
+
"module",
|
|
187
|
+
"rootDir",
|
|
188
|
+
"moduleResolution",
|
|
189
|
+
"baseUrl",
|
|
190
|
+
"paths",
|
|
191
|
+
"rootDirs",
|
|
192
|
+
"typeRoots",
|
|
193
|
+
"types",
|
|
194
|
+
"allowUmdGlobalAccess",
|
|
195
|
+
"moduleSuffixes",
|
|
196
|
+
"allowImportingTsExtensions",
|
|
197
|
+
"resolvePackageJsonExports",
|
|
198
|
+
"resolvePackageJsonImports",
|
|
199
|
+
"customConditions",
|
|
200
|
+
"resolveJsonModule",
|
|
201
|
+
"allowArbitraryExtensions",
|
|
202
|
+
"noResolve",
|
|
203
|
+
/* JavaScript Support */
|
|
204
|
+
"allowJs",
|
|
205
|
+
"checkJs",
|
|
206
|
+
"maxNodeModuleJsDepth",
|
|
207
|
+
/* Emit */
|
|
208
|
+
"declaration",
|
|
209
|
+
"declarationMap",
|
|
210
|
+
"emitDeclarationOnly",
|
|
211
|
+
"sourceMap",
|
|
212
|
+
"inlineSourceMap",
|
|
213
|
+
"outFile",
|
|
214
|
+
"outDir",
|
|
215
|
+
"removeComments",
|
|
216
|
+
"noEmit",
|
|
217
|
+
"importHelpers",
|
|
218
|
+
"importsNotUsedAsValues",
|
|
219
|
+
"downlevelIteration",
|
|
220
|
+
"sourceRoot",
|
|
221
|
+
"mapRoot",
|
|
222
|
+
"inlineSources",
|
|
223
|
+
"emitBOM",
|
|
224
|
+
"newLine",
|
|
225
|
+
"stripInternal",
|
|
226
|
+
"noEmitHelpers",
|
|
227
|
+
"noEmitOnError",
|
|
228
|
+
"preserveConstEnums",
|
|
229
|
+
"declarationDir",
|
|
230
|
+
"preserveValueImports",
|
|
231
|
+
/* Interop Constraints */
|
|
232
|
+
"isolatedModules",
|
|
233
|
+
"verbatimModuleSyntax",
|
|
234
|
+
"allowSyntheticDefaultImports",
|
|
235
|
+
"esModuleInterop",
|
|
236
|
+
"preserveSymlinks",
|
|
237
|
+
"forceConsistentCasingInFileNames",
|
|
238
|
+
/* Type Checking */
|
|
239
|
+
"strict",
|
|
240
|
+
"strictBindCallApply",
|
|
241
|
+
"strictFunctionTypes",
|
|
242
|
+
"strictNullChecks",
|
|
243
|
+
"strictPropertyInitialization",
|
|
244
|
+
"allowUnreachableCode",
|
|
245
|
+
"allowUnusedLabels",
|
|
246
|
+
"alwaysStrict",
|
|
247
|
+
"exactOptionalPropertyTypes",
|
|
248
|
+
"noFallthroughCasesInSwitch",
|
|
249
|
+
"noImplicitAny",
|
|
250
|
+
"noImplicitOverride",
|
|
251
|
+
"noImplicitReturns",
|
|
252
|
+
"noImplicitThis",
|
|
253
|
+
"noPropertyAccessFromIndexSignature",
|
|
254
|
+
"noUncheckedIndexedAccess",
|
|
255
|
+
"noUnusedLocals",
|
|
256
|
+
"noUnusedParameters",
|
|
257
|
+
"useUnknownInCatchVariables",
|
|
258
|
+
/* Completeness */
|
|
259
|
+
"skipDefaultLibCheck",
|
|
260
|
+
"skipLibCheck",
|
|
261
|
+
],
|
|
262
|
+
},
|
|
263
|
+
],
|
|
264
|
+
},
|
|
265
|
+
},
|
|
266
|
+
{
|
|
267
|
+
files: ["*.d.ts"],
|
|
268
|
+
rules: {
|
|
269
|
+
"import/no-duplicates": "off",
|
|
270
|
+
"unused-imports/no-unused-vars": "off",
|
|
271
|
+
"eslint-comments/no-unlimited-disable": "off",
|
|
272
|
+
},
|
|
273
|
+
},
|
|
274
|
+
{
|
|
275
|
+
files: ["*.test.js", "*.spec.js"],
|
|
276
|
+
rules: {
|
|
277
|
+
"no-unused-expressions": "off",
|
|
278
|
+
"unicorn/no-null": "off",
|
|
279
|
+
"unicorn/no-useless-undefined": "off",
|
|
280
|
+
},
|
|
281
|
+
},
|
|
282
|
+
],
|
|
283
|
+
rules: {
|
|
284
|
+
"import/order": "error",
|
|
285
|
+
"import/no-mutable-exports": "error",
|
|
286
|
+
"import/no-unresolved": "off",
|
|
287
|
+
"import/newline-after-import": ["error", { count: 1, considerComments: true }],
|
|
288
|
+
|
|
289
|
+
"unused-imports/no-unused-imports": "error",
|
|
290
|
+
"no-unused-vars": "off",
|
|
291
|
+
"unused-imports/no-unused-vars": [
|
|
292
|
+
"warn",
|
|
293
|
+
{
|
|
294
|
+
vars: "all",
|
|
295
|
+
varsIgnorePattern: "^_",
|
|
296
|
+
args: "after-used",
|
|
297
|
+
argsIgnorePattern: "^_",
|
|
298
|
+
},
|
|
299
|
+
],
|
|
300
|
+
|
|
301
|
+
"no-restricted-syntax": ["error", "ForInStatement", "DebuggerStatement", "LabeledStatement", "WithStatement"],
|
|
302
|
+
|
|
303
|
+
"prefer-arrow-callback": [
|
|
304
|
+
"error",
|
|
305
|
+
{
|
|
306
|
+
allowNamedFunctions: false,
|
|
307
|
+
allowUnboundThis: true,
|
|
308
|
+
},
|
|
309
|
+
],
|
|
310
|
+
|
|
311
|
+
"prefer-exponentiation-operator": "error",
|
|
312
|
+
"prefer-rest-params": "error",
|
|
313
|
+
"prefer-spread": "error",
|
|
314
|
+
"prefer-template": "error",
|
|
315
|
+
|
|
316
|
+
"object-shorthand": ["error", "always", { ignoreConstructors: false, avoidQuotes: true }],
|
|
317
|
+
"require-await": "error",
|
|
318
|
+
"block-scoped-var": "error",
|
|
319
|
+
"no-invalid-this": "error",
|
|
320
|
+
"vars-on-top": "error",
|
|
321
|
+
"no-void": ["error", { allowAsStatement: true }],
|
|
322
|
+
|
|
323
|
+
"n/prefer-global/buffer": ["error", "always"],
|
|
324
|
+
"n/prefer-global/console": ["error", "always"],
|
|
325
|
+
"n/prefer-global/process": ["error", "always"],
|
|
326
|
+
"n/prefer-global/text-decoder": ["error", "always"],
|
|
327
|
+
"n/prefer-global/text-encoder": ["error", "always"],
|
|
328
|
+
"n/prefer-global/url-search-params": ["error", "always"],
|
|
329
|
+
"n/prefer-global/url": ["error", "always"],
|
|
330
|
+
|
|
331
|
+
"n/no-extraneous-import": "off",
|
|
332
|
+
"n/no-missing-import": "off",
|
|
333
|
+
"eslint-comments/disable-enable-pair": "off",
|
|
334
|
+
"unicorn/filename-case": "off",
|
|
335
|
+
"unicorn/consistent-function-scoping": "off",
|
|
336
|
+
"unicorn/prevent-abbreviations": "off",
|
|
337
|
+
"unicorn/prefer-top-level-await": "off",
|
|
338
|
+
"unicorn/prefer-string-replace-all": "off",
|
|
339
|
+
|
|
340
|
+
"no-restricted-globals": [
|
|
341
|
+
"error",
|
|
342
|
+
{ name: "global", message: "Use `globalThis` instead." },
|
|
343
|
+
{ name: "self", message: "Use `globalThis` instead." },
|
|
344
|
+
],
|
|
345
|
+
|
|
346
|
+
"no-restricted-properties": [
|
|
347
|
+
"error",
|
|
348
|
+
{ property: "__proto__", message: "Use `Object.getPrototypeOf` or `Object.setPrototypeOf` instead." },
|
|
349
|
+
{ property: "__defineGetter__", message: "Use `Object.defineProperty` instead." },
|
|
350
|
+
{ property: "__defineSetter__", message: "Use `Object.defineProperty` instead." },
|
|
351
|
+
{ property: "__lookupGetter__", message: "Use `Object.getOwnPropertyDescriptor` instead." },
|
|
352
|
+
{ property: "__lookupSetter__", message: "Use `Object.getOwnPropertyDescriptor` instead." },
|
|
353
|
+
],
|
|
354
|
+
|
|
355
|
+
"sort-imports": [
|
|
356
|
+
"error",
|
|
357
|
+
{
|
|
358
|
+
ignoreCase: false,
|
|
359
|
+
ignoreDeclarationSort: true,
|
|
360
|
+
ignoreMemberSort: false,
|
|
361
|
+
memberSyntaxSortOrder: ["none", "all", "multiple", "single"],
|
|
362
|
+
allowSeparatedGroups: false,
|
|
363
|
+
},
|
|
364
|
+
],
|
|
365
|
+
},
|
|
366
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@cany748/eslint-config",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"main": "index.js",
|
|
5
|
+
"files": [
|
|
6
|
+
"index.js"
|
|
7
|
+
],
|
|
8
|
+
"dependencies": {
|
|
9
|
+
"eslint": "^8.50.0",
|
|
10
|
+
"eslint-config-prettier": "^9.0.0",
|
|
11
|
+
"eslint-config-standard": "^17.1.0",
|
|
12
|
+
"eslint-plugin-eslint-comments": "^3.2.0",
|
|
13
|
+
"eslint-plugin-html": "^7.1.0",
|
|
14
|
+
"eslint-plugin-import": "^2.28.1",
|
|
15
|
+
"eslint-plugin-jsonc": "^2.9.0",
|
|
16
|
+
"eslint-plugin-n": "^16.1.0",
|
|
17
|
+
"eslint-plugin-prettier": "5.0.0",
|
|
18
|
+
"eslint-plugin-promise": "^6.1.1",
|
|
19
|
+
"eslint-plugin-unicorn": "^48.0.1",
|
|
20
|
+
"eslint-plugin-unused-imports": "^3.0.0",
|
|
21
|
+
"eslint-plugin-yml": "^1.9.0",
|
|
22
|
+
"jsonc-eslint-parser": "^2.3.0",
|
|
23
|
+
"prettier": "^3.0.3",
|
|
24
|
+
"yaml-eslint-parser": "^1.2.2"
|
|
25
|
+
}
|
|
26
|
+
}
|