eslint-config-decent 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/dist/index.mjs ADDED
@@ -0,0 +1,520 @@
1
+ import eslint from '@eslint/js';
2
+ import globals from 'globals';
3
+ import tsEslint from 'typescript-eslint';
4
+ import prettier from 'eslint-plugin-prettier/recommended';
5
+ import jsdoc from 'eslint-plugin-jsdoc';
6
+ import mocha from 'eslint-plugin-mocha';
7
+ import promise from 'eslint-plugin-promise';
8
+ import security from 'eslint-plugin-security';
9
+ import unicorn from 'eslint-plugin-unicorn';
10
+
11
+ const base$6 = {
12
+ rules: {
13
+ "array-callback-return": ["error", { allowImplicit: true }],
14
+ "block-scoped-var": "error",
15
+ "callback-return": ["error", ["callback", "cb", "next", "done"]],
16
+ "class-methods-use-this": [
17
+ "error",
18
+ {
19
+ exceptMethods: []
20
+ }
21
+ ],
22
+ "default-case": ["error", { commentPattern: "^no default$" }],
23
+ "default-case-last": "error",
24
+ eqeqeq: ["error", "smart"],
25
+ "func-names": "error",
26
+ "func-style": [
27
+ "error",
28
+ "declaration",
29
+ {
30
+ allowArrowFunctions: false
31
+ }
32
+ ],
33
+ "global-require": "error",
34
+ "grouped-accessor-pairs": "error",
35
+ "guard-for-in": "error",
36
+ "id-length": [
37
+ "error",
38
+ {
39
+ exceptions: ["_", "$", "e", "i", "j", "k", "q", "x", "y"]
40
+ }
41
+ ],
42
+ "lines-around-directive": [
43
+ "error",
44
+ {
45
+ before: "always",
46
+ after: "always"
47
+ }
48
+ ],
49
+ "handle-callback-err": ["error", "^.*err"],
50
+ "max-classes-per-file": ["error", 1],
51
+ "object-shorthand": [
52
+ "error",
53
+ "always",
54
+ {
55
+ ignoreConstructors: false,
56
+ avoidQuotes: true,
57
+ avoidExplicitReturnArrows: true
58
+ }
59
+ ],
60
+ "one-var": ["error", "never"],
61
+ "operator-assignment": ["error", "always"],
62
+ "no-await-in-loop": "error",
63
+ "no-bitwise": "error",
64
+ "no-buffer-constructor": "error",
65
+ "no-caller": "error",
66
+ "no-cond-assign": ["error", "always"],
67
+ "no-console": "error",
68
+ "no-constructor-return": "error",
69
+ "no-else-return": ["error", { allowElseIf: false }],
70
+ "no-empty-static-block": "error",
71
+ "no-eval": "error",
72
+ "no-extend-native": "error",
73
+ "no-extra-bind": "error",
74
+ "no-extra-label": "error",
75
+ "no-inner-declarations": "error",
76
+ "no-iterator": "error",
77
+ "no-label-var": "error",
78
+ "no-labels": ["error", { allowLoop: false, allowSwitch: false }],
79
+ "no-lone-blocks": "error",
80
+ "no-lonely-if": "error",
81
+ "no-mixed-spaces-and-tabs": "error",
82
+ "no-multi-assign": ["error"],
83
+ "no-multi-str": "error",
84
+ "no-negated-condition": "error",
85
+ "no-nested-ternary": "error",
86
+ "no-new-object": "error",
87
+ "no-new-require": "error",
88
+ "no-new-wrappers": "error",
89
+ "no-octal-escape": "error",
90
+ "no-path-concat": "error",
91
+ "no-promise-executor-return": "error",
92
+ "no-proto": "error",
93
+ "no-restricted-exports": [
94
+ "error",
95
+ {
96
+ restrictedNamedExports: [
97
+ "default",
98
+ // use `export default` to provide a default export
99
+ "then"
100
+ // this will cause tons of confusion when your module is dynamically `import()`ed, and will break in most node ESM versions
101
+ ]
102
+ }
103
+ ],
104
+ "no-restricted-globals": [
105
+ "error",
106
+ {
107
+ name: "isFinite",
108
+ message: "Use Number.isFinite instead https://github.com/airbnb/javascript#standard-library--isfinite"
109
+ },
110
+ {
111
+ name: "isNaN",
112
+ message: "Use Number.isNaN instead https://github.com/airbnb/javascript#standard-library--isnan"
113
+ }
114
+ ],
115
+ "no-restricted-properties": [
116
+ "error",
117
+ {
118
+ object: "arguments",
119
+ property: "callee",
120
+ message: "arguments.callee is deprecated"
121
+ },
122
+ {
123
+ property: "__defineGetter__",
124
+ message: "Please use Object.defineProperty instead."
125
+ },
126
+ {
127
+ property: "__defineSetter__",
128
+ message: "Please use Object.defineProperty instead."
129
+ }
130
+ ],
131
+ "no-restricted-syntax": ["error", "DebuggerStatement", "LabeledStatement", "WithStatement"],
132
+ "no-return-assign": ["error", "always"],
133
+ "no-self-compare": "error",
134
+ "no-sequences": "error",
135
+ "no-script-url": "error",
136
+ "no-template-curly-in-string": "error",
137
+ "no-undef-init": "error",
138
+ "no-unneeded-ternary": ["error", { defaultAssignment: false }],
139
+ "no-unreachable-loop": [
140
+ "error",
141
+ {
142
+ ignore: []
143
+ // WhileStatement, DoWhileStatement, ForStatement, ForInStatement, ForOfStatement
144
+ }
145
+ ],
146
+ "no-unused-expressions": [
147
+ "error",
148
+ {
149
+ allowShortCircuit: false,
150
+ allowTernary: false,
151
+ allowTaggedTemplates: false
152
+ }
153
+ ],
154
+ "no-useless-computed-key": "error",
155
+ "no-useless-concat": "error",
156
+ "no-useless-rename": "error",
157
+ "no-useless-return": "error",
158
+ "padding-line-between-statements": [
159
+ "error",
160
+ {
161
+ blankLine: "always",
162
+ prev: ["directive", "block", "block-like", "multiline-block-like", "cjs-export", "cjs-import", "class", "export", "import", "if"],
163
+ next: "*"
164
+ },
165
+ {
166
+ blankLine: "never",
167
+ prev: "directive",
168
+ next: "directive"
169
+ },
170
+ {
171
+ blankLine: "any",
172
+ prev: "*",
173
+ next: ["if", "for", "cjs-import", "import"]
174
+ },
175
+ {
176
+ blankLine: "any",
177
+ prev: ["export", "import"],
178
+ next: ["export", "import"]
179
+ },
180
+ {
181
+ blankLine: "always",
182
+ prev: "*",
183
+ next: ["try", "function", "switch"]
184
+ },
185
+ {
186
+ blankLine: "always",
187
+ prev: "if",
188
+ next: "if"
189
+ },
190
+ {
191
+ blankLine: "never",
192
+ prev: ["return", "throw"],
193
+ next: "*"
194
+ }
195
+ ],
196
+ "prefer-const": [
197
+ "error",
198
+ {
199
+ destructuring: "any",
200
+ ignoreReadBeforeAssign: true
201
+ }
202
+ ],
203
+ "prefer-exponentiation-operator": "error",
204
+ "prefer-numeric-literals": "error",
205
+ "prefer-object-spread": "error",
206
+ "prefer-regex-literals": [
207
+ "error",
208
+ {
209
+ disallowRedundantWrapping: true
210
+ }
211
+ ],
212
+ "prefer-template": "error",
213
+ "symbol-description": "error",
214
+ "unicode-bom": ["error", "never"],
215
+ "vars-on-top": "error",
216
+ yoda: "error"
217
+ }
218
+ };
219
+ const cjsAndEsm = {
220
+ rules: {
221
+ curly: ["error", "multi-line"],
222
+ "dot-notation": ["error", { allowKeywords: true }],
223
+ "dot-location": ["error", "property"],
224
+ "getter-return": ["error", { allowImplicit: true }],
225
+ "lines-between-class-members": ["error", "always", { exceptAfterSingleLine: false }],
226
+ "no-array-constructor": "error",
227
+ "no-empty-function": [
228
+ "error",
229
+ {
230
+ allow: ["arrowFunctions", "functions", "methods"]
231
+ }
232
+ ],
233
+ "no-new-func": "error",
234
+ "no-new-symbol": "error",
235
+ "no-return-await": "error",
236
+ "no-shadow": "error",
237
+ "no-undef": "error",
238
+ "no-unexpected-multiline": "error",
239
+ "no-use-before-define": ["error", { functions: true, classes: true, variables: true }],
240
+ "no-useless-constructor": "error",
241
+ "no-var": "error",
242
+ "prefer-arrow-callback": [
243
+ "error",
244
+ {
245
+ allowNamedFunctions: false,
246
+ allowUnboundThis: true
247
+ }
248
+ ],
249
+ "prefer-promise-reject-errors": ["error", { allowEmptyReject: true }],
250
+ "wrap-iife": ["error", "outside", { functionPrototypeMethods: false }]
251
+ }
252
+ };
253
+ const cjs = {
254
+ rules: {
255
+ strict: ["error", "global"]
256
+ }
257
+ };
258
+ const configs$6 = {
259
+ base: base$6,
260
+ cjsAndEsm,
261
+ cjs
262
+ };
263
+
264
+ const base$5 = {
265
+ settings: {
266
+ jsdoc: {
267
+ preferredTypes: {
268
+ Array: "Array<object>",
269
+ "Array.": "Array<object>",
270
+ "Array<>": "[]",
271
+ "Array.<>": "[]",
272
+ "Promise.<>": "Promise<>"
273
+ }
274
+ }
275
+ },
276
+ plugins: {
277
+ jsdoc
278
+ },
279
+ rules: {
280
+ "unicorn/better-regex": "error",
281
+ "unicorn/custom-error-definition": "error",
282
+ "unicorn/no-array-method-this-argument": "error",
283
+ "unicorn/no-for-loop": "error",
284
+ "unicorn/prefer-array-find": "error",
285
+ "unicorn/prefer-object-from-entries": "error",
286
+ "unicorn/prefer-set-has": "error"
287
+ }
288
+ };
289
+ const configs$5 = {
290
+ base: base$5
291
+ };
292
+
293
+ const base$4 = {
294
+ plugins: {
295
+ mocha
296
+ },
297
+ rules: {
298
+ ...mocha.configs.recommended.rules,
299
+ "max-classes-per-file": "off",
300
+ "@typescript-eslint/no-empty-function": "off",
301
+ "@typescript-eslint/no-unsafe-member-access": "off",
302
+ "@typescript-eslint/no-unsafe-argument": "off",
303
+ "@typescript-eslint/no-unsafe-call": "off",
304
+ "@typescript-eslint/no-unused-vars": "off",
305
+ "@typescript-eslint/unbound-method": "off",
306
+ "mocha/no-exclusive-tests": "error",
307
+ "mocha/no-pending-tests": "error",
308
+ "mocha/no-mocha-arrows": "off"
309
+ }
310
+ };
311
+ const configs$4 = {
312
+ base: base$4
313
+ };
314
+
315
+ const base$3 = {
316
+ plugins: {
317
+ promise
318
+ },
319
+ rules: {
320
+ "promise/always-return": "error",
321
+ "promise/always-catch": "off",
322
+ "promise/catch-or-return": [
323
+ "error",
324
+ {
325
+ allowThen: true
326
+ }
327
+ ],
328
+ "promise/no-native": "off",
329
+ "promise/param-names": "error"
330
+ }
331
+ };
332
+ const configs$3 = {
333
+ base: base$3
334
+ };
335
+
336
+ const base$2 = {
337
+ plugins: {
338
+ security
339
+ },
340
+ rules: {
341
+ "security/detect-buffer-noassert": "error",
342
+ "security/detect-child-process": "error",
343
+ "security/detect-disable-mustache-escape": "error",
344
+ "security/detect-eval-with-expression": "error",
345
+ "security/detect-new-buffer": "error",
346
+ "security/detect-no-csrf-before-method-override": "error",
347
+ "security/detect-non-literal-fs-filename": "error",
348
+ "security/detect-non-literal-regexp": "error",
349
+ "security/detect-non-literal-require": "error",
350
+ "security/detect-object-injection": "off",
351
+ "security/detect-possible-timing-attacks": "error",
352
+ "security/detect-pseudoRandomBytes": "error",
353
+ "security/detect-unsafe-regex": "error"
354
+ }
355
+ };
356
+ const configs$2 = {
357
+ base: base$2
358
+ };
359
+
360
+ const base$1 = {
361
+ rules: {
362
+ "no-loss-of-precision": "off",
363
+ "no-loop-func": "off",
364
+ "no-return-await": "off",
365
+ "no-unused-expressions": "off",
366
+ "no-use-before-defined": "off",
367
+ "@typescript-eslint/array-type": [
368
+ "error",
369
+ {
370
+ default: "array"
371
+ }
372
+ ],
373
+ "@typescript-eslint/consistent-type-imports": "error",
374
+ "@typescript-eslint/default-param-last": "error",
375
+ "@typescript-eslint/explicit-function-return-type": "error",
376
+ "@typescript-eslint/explicit-member-accessibility": "error",
377
+ "@typescript-eslint/naming-convention": [
378
+ "error",
379
+ {
380
+ selector: "enumMember",
381
+ format: ["camelCase", "PascalCase", "UPPER_CASE"],
382
+ trailingUnderscore: "forbid"
383
+ }
384
+ ],
385
+ "@typescript-eslint/no-dupe-class-members": "error",
386
+ "@typescript-eslint/no-loop-func": "error",
387
+ "@typescript-eslint/no-redeclare": "error",
388
+ "@typescript-eslint/member-ordering": [
389
+ "error",
390
+ {
391
+ default: [
392
+ "signature",
393
+ "private-field",
394
+ "public-field",
395
+ "protected-field",
396
+ "public-constructor",
397
+ "protected-constructor",
398
+ "private-constructor",
399
+ "public-method",
400
+ "protected-method",
401
+ "private-method"
402
+ ]
403
+ }
404
+ ],
405
+ "@typescript-eslint/only-throw-error": "error",
406
+ "@typescript-eslint/no-empty-interface": "error",
407
+ "@typescript-eslint/no-extra-semi": "error",
408
+ "@typescript-eslint/no-shadow": "error",
409
+ "@typescript-eslint/no-use-before-define": [
410
+ "error",
411
+ {
412
+ functions: true,
413
+ classes: true,
414
+ variables: true
415
+ }
416
+ ],
417
+ "@typescript-eslint/parameter-properties": [
418
+ "error",
419
+ {
420
+ allow: ["readonly"]
421
+ }
422
+ ],
423
+ "@typescript-eslint/restrict-template-expressions": ["error", { allowNumber: true }],
424
+ "@typescript-eslint/return-await": "error",
425
+ "@typescript-eslint/sort-type-constituents": "error"
426
+ }
427
+ };
428
+ const configs$1 = {
429
+ base: base$1
430
+ };
431
+
432
+ const base = {
433
+ plugins: {
434
+ unicorn
435
+ },
436
+ rules: {
437
+ "unicorn/better-regex": "error",
438
+ "unicorn/custom-error-definition": "error",
439
+ "unicorn/no-array-method-this-argument": "error",
440
+ "unicorn/no-for-loop": "error",
441
+ "unicorn/prefer-array-find": "error",
442
+ "unicorn/prefer-object-from-entries": "error",
443
+ "unicorn/prefer-set-has": "error"
444
+ }
445
+ };
446
+ const configs = {
447
+ base
448
+ };
449
+
450
+ function defaultConfig(parserOptions) {
451
+ const languageOptions = {
452
+ globals: {
453
+ ...globals.node
454
+ },
455
+ parserOptions: {
456
+ // @ts-expect-error - This is a valid option
457
+ projectService: {
458
+ allowedDefaultProject: ["./*.js", "./*.cjs", "./*.mjs", "./tests/**/*.ts", "./tests/**/*.js", "./tests/**/*.cjs", "./tests/**/*.mjs"],
459
+ defaultProject: "tsconfig.json"
460
+ },
461
+ tsconfigRootDir: import.meta.dirname,
462
+ ...parserOptions
463
+ }
464
+ };
465
+ return [
466
+ {
467
+ ignores: ["**/dist/**", "**/node_modules/**"]
468
+ },
469
+ eslint.configs.recommended,
470
+ ...tsEslint.configs.strictTypeChecked,
471
+ ...tsEslint.configs.stylisticTypeChecked,
472
+ {
473
+ languageOptions,
474
+ settings: {
475
+ ...configs$5.base.settings
476
+ }
477
+ },
478
+ {
479
+ files: ["**/*.ts", "**/*.js", "**/*.cjs", "**/*.mjs"],
480
+ plugins: {
481
+ ...configs$5.base.plugins,
482
+ ...configs$3.base.plugins,
483
+ ...configs$2.base.plugins,
484
+ ...configs.base.plugins
485
+ },
486
+ rules: {
487
+ ...configs$6.base.rules,
488
+ ...configs$5.base.rules,
489
+ ...configs$3.base.rules,
490
+ ...configs$2.base.rules,
491
+ ...configs.base.rules
492
+ }
493
+ },
494
+ {
495
+ files: ["**/*.js", "**/*.cjs", "**/*.mjs"],
496
+ languageOptions: {
497
+ sourceType: "script"
498
+ },
499
+ ...configs$6.cjsAndEsm
500
+ },
501
+ {
502
+ files: ["**/*.js", "**/*.cjs"],
503
+ languageOptions: {
504
+ sourceType: "script"
505
+ },
506
+ ...configs$6.cjs
507
+ },
508
+ {
509
+ files: ["**/*.ts"],
510
+ ...configs$1.base
511
+ },
512
+ {
513
+ files: ["**/*.tests.ts", "tests/tests.ts"],
514
+ ...configs$4.base
515
+ },
516
+ prettier
517
+ ];
518
+ }
519
+
520
+ export { defaultConfig, configs$6 as eslintConfigs, configs$5 as jsdocConfigs, configs$3 as promiseConfigs, configs$2 as securityConfigs, configs$1 as typescriptEslintConfigs, configs as unicornConfigs };
package/package.json ADDED
@@ -0,0 +1,100 @@
1
+ {
2
+ "name": "eslint-config-decent",
3
+ "version": "1.0.0",
4
+ "description": "A decent ESLint configuration",
5
+ "main": "./dist/index.cjs",
6
+ "module": "./dist/index.mjs",
7
+ "types": "./dist/index.d.ts",
8
+ "type": "module",
9
+ "exports": {
10
+ ".": {
11
+ "import": {
12
+ "types": "./dist/index.d.ts",
13
+ "default": "./dist/index.mjs"
14
+ },
15
+ "require": {
16
+ "types": "./dist/index.d.cts",
17
+ "default": "./dist/index.cjs"
18
+ }
19
+ }
20
+ },
21
+ "files": [
22
+ "dist",
23
+ "src"
24
+ ],
25
+ "scripts": {
26
+ "build": "unbuild",
27
+ "test": "tsc --noEmit --skipLibCheck",
28
+ "lint:markdown": "prettier --cache --write '*.md' '!(node_modules|dist)/**/*.md' && markdownlint '*.md' '!(node_modules|dist)/**/*.md' --config=.github/linters/.markdown-lint.yml --fix",
29
+ "lint:code": "eslint --fix",
30
+ "prelint": "npm run build",
31
+ "lint": "run-p lint:*",
32
+ "lint-staged": "lint-staged",
33
+ "beta": "npm publish --tag beta",
34
+ "prepublishOnly": "npm run lint && npm run test && npm run build && pinst --disable",
35
+ "postpublish": "pinst --enable",
36
+ "prepare": "husky"
37
+ },
38
+ "lint-staged": {
39
+ "*.md": [
40
+ "prettier --write --cache",
41
+ "markdownlint --config=.github/linters/.markdown-lint.yml --fix"
42
+ ],
43
+ "*.js": [
44
+ "eslint --fix"
45
+ ],
46
+ "*.cjs": [
47
+ "eslint --fix"
48
+ ],
49
+ "*.mjs": [
50
+ "eslint --fix"
51
+ ],
52
+ "*.ts": [
53
+ "eslint --fix"
54
+ ]
55
+ },
56
+ "repository": {
57
+ "type": "git",
58
+ "url": "git+https://github.com/jgeurts/eslint-config-decent.git"
59
+ },
60
+ "keywords": [
61
+ "eslint",
62
+ "config",
63
+ "decent"
64
+ ],
65
+ "author": "Jim Geurts <jim@biacreations.com>",
66
+ "license": "MIT",
67
+ "bugs": {
68
+ "url": "https://github.com/jgeurts/eslint-config-decent/issues"
69
+ },
70
+ "homepage": "https://github.com/jgeurts/eslint-config-decent#readme",
71
+ "engines": {
72
+ "node": ">=20.11.0"
73
+ },
74
+ "dependencies": {
75
+ "@eslint/js": "^9.4.0",
76
+ "eslint-config-prettier": "^9.1.0",
77
+ "eslint-plugin-jsdoc": "^48.2.7",
78
+ "eslint-plugin-mocha": "^10.4.3",
79
+ "eslint-plugin-prettier": "^5.1.3",
80
+ "eslint-plugin-promise": "^6.2.0",
81
+ "eslint-plugin-security": "^3.0.0",
82
+ "eslint-plugin-unicorn": "^53.0.0",
83
+ "globals": "^15.3.0",
84
+ "typescript-eslint": "^8.0.0-alpha.25"
85
+ },
86
+ "devDependencies": {
87
+ "@swc/core": "1.5.24",
88
+ "@types/node": ">=20",
89
+ "eslint": "^9.4.0",
90
+ "husky": "^9.0.11",
91
+ "lint-staged": "^15.2.5",
92
+ "markdownlint-cli": "^0.41.0",
93
+ "npm-run-all": "^4.1.5",
94
+ "pinst": "^3.0.0",
95
+ "prettier": "^3.3.0",
96
+ "rimraf": "^5.0.7",
97
+ "typescript": "^5.4.5",
98
+ "unbuild": "2.0.0"
99
+ }
100
+ }