@kouts/eslint-config 1.3.1 → 1.3.3

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.cjs ADDED
@@ -0,0 +1,551 @@
1
+ 'use strict';
2
+
3
+ var pluginVitest = require('@vitest/eslint-plugin');
4
+ var pluginHtml = require('eslint-plugin-html');
5
+ var pluginImport = require('eslint-plugin-import-x');
6
+ var pluginPrettier = require('eslint-plugin-prettier/recommended');
7
+ var pluginSimpleImportSort = require('eslint-plugin-simple-import-sort');
8
+ var neostandard = require('neostandard');
9
+ var pluginVue = require('eslint-plugin-vue');
10
+
11
+ function getDefaultExportFromCjs (x) {
12
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
13
+ }
14
+
15
+ /*
16
+ * WARNING: This file is autogenerated using the tools/update-eslint-all.js
17
+ * script. Do not edit manually.
18
+ */
19
+
20
+ /* eslint quote-props: off -- autogenerated so don't lint */
21
+
22
+ /*
23
+ * IMPORTANT!
24
+ *
25
+ * We cannot add a "name" property to this object because it's still used in eslintrc
26
+ * which doesn't support the "name" property. If we add a "name" property, it will
27
+ * cause an error.
28
+ */
29
+
30
+ var eslintAll = Object.freeze({
31
+ "rules": {
32
+ "accessor-pairs": "error",
33
+ "array-callback-return": "error",
34
+ "arrow-body-style": "error",
35
+ "block-scoped-var": "error",
36
+ "camelcase": "error",
37
+ "capitalized-comments": "error",
38
+ "class-methods-use-this": "error",
39
+ "complexity": "error",
40
+ "consistent-return": "error",
41
+ "consistent-this": "error",
42
+ "constructor-super": "error",
43
+ "curly": "error",
44
+ "default-case": "error",
45
+ "default-case-last": "error",
46
+ "default-param-last": "error",
47
+ "dot-notation": "error",
48
+ "eqeqeq": "error",
49
+ "for-direction": "error",
50
+ "func-name-matching": "error",
51
+ "func-names": "error",
52
+ "func-style": "error",
53
+ "getter-return": "error",
54
+ "grouped-accessor-pairs": "error",
55
+ "guard-for-in": "error",
56
+ "id-denylist": "error",
57
+ "id-length": "error",
58
+ "id-match": "error",
59
+ "init-declarations": "error",
60
+ "logical-assignment-operators": "error",
61
+ "max-classes-per-file": "error",
62
+ "max-depth": "error",
63
+ "max-lines": "error",
64
+ "max-lines-per-function": "error",
65
+ "max-nested-callbacks": "error",
66
+ "max-params": "error",
67
+ "max-statements": "error",
68
+ "new-cap": "error",
69
+ "no-alert": "error",
70
+ "no-array-constructor": "error",
71
+ "no-async-promise-executor": "error",
72
+ "no-await-in-loop": "error",
73
+ "no-bitwise": "error",
74
+ "no-caller": "error",
75
+ "no-case-declarations": "error",
76
+ "no-class-assign": "error",
77
+ "no-compare-neg-zero": "error",
78
+ "no-cond-assign": "error",
79
+ "no-console": "error",
80
+ "no-const-assign": "error",
81
+ "no-constant-binary-expression": "error",
82
+ "no-constant-condition": "error",
83
+ "no-constructor-return": "error",
84
+ "no-continue": "error",
85
+ "no-control-regex": "error",
86
+ "no-debugger": "error",
87
+ "no-delete-var": "error",
88
+ "no-div-regex": "error",
89
+ "no-dupe-args": "error",
90
+ "no-dupe-class-members": "error",
91
+ "no-dupe-else-if": "error",
92
+ "no-dupe-keys": "error",
93
+ "no-duplicate-case": "error",
94
+ "no-duplicate-imports": "error",
95
+ "no-else-return": "error",
96
+ "no-empty": "error",
97
+ "no-empty-character-class": "error",
98
+ "no-empty-function": "error",
99
+ "no-empty-pattern": "error",
100
+ "no-empty-static-block": "error",
101
+ "no-eq-null": "error",
102
+ "no-eval": "error",
103
+ "no-ex-assign": "error",
104
+ "no-extend-native": "error",
105
+ "no-extra-bind": "error",
106
+ "no-extra-boolean-cast": "error",
107
+ "no-extra-label": "error",
108
+ "no-fallthrough": "error",
109
+ "no-func-assign": "error",
110
+ "no-global-assign": "error",
111
+ "no-implicit-coercion": "error",
112
+ "no-implicit-globals": "error",
113
+ "no-implied-eval": "error",
114
+ "no-import-assign": "error",
115
+ "no-inline-comments": "error",
116
+ "no-inner-declarations": "error",
117
+ "no-invalid-regexp": "error",
118
+ "no-invalid-this": "error",
119
+ "no-irregular-whitespace": "error",
120
+ "no-iterator": "error",
121
+ "no-label-var": "error",
122
+ "no-labels": "error",
123
+ "no-lone-blocks": "error",
124
+ "no-lonely-if": "error",
125
+ "no-loop-func": "error",
126
+ "no-loss-of-precision": "error",
127
+ "no-magic-numbers": "error",
128
+ "no-misleading-character-class": "error",
129
+ "no-multi-assign": "error",
130
+ "no-multi-str": "error",
131
+ "no-negated-condition": "error",
132
+ "no-nested-ternary": "error",
133
+ "no-new": "error",
134
+ "no-new-func": "error",
135
+ "no-new-native-nonconstructor": "error",
136
+ "no-new-wrappers": "error",
137
+ "no-nonoctal-decimal-escape": "error",
138
+ "no-obj-calls": "error",
139
+ "no-object-constructor": "error",
140
+ "no-octal": "error",
141
+ "no-octal-escape": "error",
142
+ "no-param-reassign": "error",
143
+ "no-plusplus": "error",
144
+ "no-promise-executor-return": "error",
145
+ "no-proto": "error",
146
+ "no-prototype-builtins": "error",
147
+ "no-redeclare": "error",
148
+ "no-regex-spaces": "error",
149
+ "no-restricted-exports": "error",
150
+ "no-restricted-globals": "error",
151
+ "no-restricted-imports": "error",
152
+ "no-restricted-properties": "error",
153
+ "no-restricted-syntax": "error",
154
+ "no-return-assign": "error",
155
+ "no-script-url": "error",
156
+ "no-self-assign": "error",
157
+ "no-self-compare": "error",
158
+ "no-sequences": "error",
159
+ "no-setter-return": "error",
160
+ "no-shadow": "error",
161
+ "no-shadow-restricted-names": "error",
162
+ "no-sparse-arrays": "error",
163
+ "no-template-curly-in-string": "error",
164
+ "no-ternary": "error",
165
+ "no-this-before-super": "error",
166
+ "no-throw-literal": "error",
167
+ "no-undef": "error",
168
+ "no-undef-init": "error",
169
+ "no-undefined": "error",
170
+ "no-underscore-dangle": "error",
171
+ "no-unexpected-multiline": "error",
172
+ "no-unmodified-loop-condition": "error",
173
+ "no-unneeded-ternary": "error",
174
+ "no-unreachable": "error",
175
+ "no-unreachable-loop": "error",
176
+ "no-unsafe-finally": "error",
177
+ "no-unsafe-negation": "error",
178
+ "no-unsafe-optional-chaining": "error",
179
+ "no-unused-expressions": "error",
180
+ "no-unused-labels": "error",
181
+ "no-unused-private-class-members": "error",
182
+ "no-unused-vars": "error",
183
+ "no-use-before-define": "error",
184
+ "no-useless-assignment": "error",
185
+ "no-useless-backreference": "error",
186
+ "no-useless-call": "error",
187
+ "no-useless-catch": "error",
188
+ "no-useless-computed-key": "error",
189
+ "no-useless-concat": "error",
190
+ "no-useless-constructor": "error",
191
+ "no-useless-escape": "error",
192
+ "no-useless-rename": "error",
193
+ "no-useless-return": "error",
194
+ "no-var": "error",
195
+ "no-void": "error",
196
+ "no-warning-comments": "error",
197
+ "no-with": "error",
198
+ "object-shorthand": "error",
199
+ "one-var": "error",
200
+ "operator-assignment": "error",
201
+ "prefer-arrow-callback": "error",
202
+ "prefer-const": "error",
203
+ "prefer-destructuring": "error",
204
+ "prefer-exponentiation-operator": "error",
205
+ "prefer-named-capture-group": "error",
206
+ "prefer-numeric-literals": "error",
207
+ "prefer-object-has-own": "error",
208
+ "prefer-object-spread": "error",
209
+ "prefer-promise-reject-errors": "error",
210
+ "prefer-regex-literals": "error",
211
+ "prefer-rest-params": "error",
212
+ "prefer-spread": "error",
213
+ "prefer-template": "error",
214
+ "radix": "error",
215
+ "require-atomic-updates": "error",
216
+ "require-await": "error",
217
+ "require-unicode-regexp": "error",
218
+ "require-yield": "error",
219
+ "sort-imports": "error",
220
+ "sort-keys": "error",
221
+ "sort-vars": "error",
222
+ "strict": "error",
223
+ "symbol-description": "error",
224
+ "unicode-bom": "error",
225
+ "use-isnan": "error",
226
+ "valid-typeof": "error",
227
+ "vars-on-top": "error",
228
+ "yoda": "error"
229
+ }
230
+ });
231
+
232
+ /**
233
+ * @fileoverview Configuration applied when a user configuration extends from
234
+ * eslint:recommended.
235
+ * @author Nicholas C. Zakas
236
+ */
237
+
238
+ /* eslint sort-keys: ["error", "asc"] -- Long, so make more readable */
239
+
240
+ /*
241
+ * IMPORTANT!
242
+ *
243
+ * We cannot add a "name" property to this object because it's still used in eslintrc
244
+ * which doesn't support the "name" property. If we add a "name" property, it will
245
+ * cause an error.
246
+ */
247
+
248
+ var eslintRecommended = Object.freeze({
249
+ rules: Object.freeze({
250
+ "constructor-super": "error",
251
+ "for-direction": "error",
252
+ "getter-return": "error",
253
+ "no-async-promise-executor": "error",
254
+ "no-case-declarations": "error",
255
+ "no-class-assign": "error",
256
+ "no-compare-neg-zero": "error",
257
+ "no-cond-assign": "error",
258
+ "no-const-assign": "error",
259
+ "no-constant-binary-expression": "error",
260
+ "no-constant-condition": "error",
261
+ "no-control-regex": "error",
262
+ "no-debugger": "error",
263
+ "no-delete-var": "error",
264
+ "no-dupe-args": "error",
265
+ "no-dupe-class-members": "error",
266
+ "no-dupe-else-if": "error",
267
+ "no-dupe-keys": "error",
268
+ "no-duplicate-case": "error",
269
+ "no-empty": "error",
270
+ "no-empty-character-class": "error",
271
+ "no-empty-pattern": "error",
272
+ "no-empty-static-block": "error",
273
+ "no-ex-assign": "error",
274
+ "no-extra-boolean-cast": "error",
275
+ "no-fallthrough": "error",
276
+ "no-func-assign": "error",
277
+ "no-global-assign": "error",
278
+ "no-import-assign": "error",
279
+ "no-invalid-regexp": "error",
280
+ "no-irregular-whitespace": "error",
281
+ "no-loss-of-precision": "error",
282
+ "no-misleading-character-class": "error",
283
+ "no-new-native-nonconstructor": "error",
284
+ "no-nonoctal-decimal-escape": "error",
285
+ "no-obj-calls": "error",
286
+ "no-octal": "error",
287
+ "no-prototype-builtins": "error",
288
+ "no-redeclare": "error",
289
+ "no-regex-spaces": "error",
290
+ "no-self-assign": "error",
291
+ "no-setter-return": "error",
292
+ "no-shadow-restricted-names": "error",
293
+ "no-sparse-arrays": "error",
294
+ "no-this-before-super": "error",
295
+ "no-undef": "error",
296
+ "no-unexpected-multiline": "error",
297
+ "no-unreachable": "error",
298
+ "no-unsafe-finally": "error",
299
+ "no-unsafe-negation": "error",
300
+ "no-unsafe-optional-chaining": "error",
301
+ "no-unused-labels": "error",
302
+ "no-unused-private-class-members": "error",
303
+ "no-unused-vars": "error",
304
+ "no-useless-backreference": "error",
305
+ "no-useless-catch": "error",
306
+ "no-useless-escape": "error",
307
+ "no-with": "error",
308
+ "require-yield": "error",
309
+ "use-isnan": "error",
310
+ "valid-typeof": "error"
311
+ })
312
+ });
313
+
314
+ /**
315
+ * @fileoverview Main package entrypoint.
316
+ * @author Nicholas C. Zakas
317
+ */
318
+
319
+ //------------------------------------------------------------------------------
320
+ // Public Interface
321
+ //------------------------------------------------------------------------------
322
+
323
+ var src = {
324
+ configs: {
325
+ all: eslintAll,
326
+ recommended: eslintRecommended
327
+ }
328
+ };
329
+
330
+ var js = /*@__PURE__*/getDefaultExportFromCjs(src);
331
+
332
+ const typescript = [
333
+ ...neostandard.plugins["typescript-eslint"].configs.recommended,
334
+ {
335
+ name: "kouts/typescript",
336
+ rules: {
337
+ // Prefer T[] instead of Array<T>
338
+ "@typescript-eslint/array-type": ["error", { default: "array" }],
339
+ // Prefer type over interface for objects
340
+ "@typescript-eslint/consistent-type-definitions": ["error", "type"],
341
+ // Fix type imports
342
+ "@typescript-eslint/consistent-type-imports": [
343
+ "error",
344
+ {
345
+ prefer: "type-imports",
346
+ fixStyle: "inline-type-imports"
347
+ }
348
+ ],
349
+ // Allow _ for unused variables
350
+ "@typescript-eslint/no-unused-vars": [
351
+ "error",
352
+ {
353
+ args: "none",
354
+ caughtErrors: "none",
355
+ ignoreRestSiblings: true,
356
+ vars: "all",
357
+ argsIgnorePattern: "^_"
358
+ }
359
+ ]
360
+ }
361
+ }
362
+ ];
363
+
364
+ const vue = (options) => {
365
+ const opts = {
366
+ version: 3,
367
+ ts: true,
368
+ ...options
369
+ };
370
+ const vueConfig = opts.version === 3 ? pluginVue.configs["flat/recommended"] : pluginVue.configs["flat/vue2-recommended"];
371
+ const languageOptions = opts.ts ? {
372
+ languageOptions: {
373
+ parserOptions: {
374
+ parser: neostandard.plugins["typescript-eslint"].parser
375
+ }
376
+ }
377
+ } : {};
378
+ const config = [
379
+ ...vueConfig,
380
+ {
381
+ name: "kouts/vue",
382
+ files: ["*.vue", "**/*.vue"],
383
+ ...languageOptions,
384
+ rules: {
385
+ // Overrides for vue/(vue3-)recommended preset
386
+ "vue/max-attributes-per-line": "off",
387
+ "vue/singleline-html-element-content-newline": "off",
388
+ // Strengthen vue/(vue3-)recommended preset for autofix
389
+ // https://github.com/vuejs/eslint-plugin-vue/blob/master/lib/configs/recommended.js
390
+ "vue/attributes-order": "error",
391
+ "vue/component-tags-order": "error",
392
+ "vue/no-lone-template": "error",
393
+ "vue/no-multiple-slot-args": "error",
394
+ "vue/no-v-html": "error",
395
+ "vue/order-in-components": "error",
396
+ "vue/this-in-template": "error",
397
+ "vue/require-prop-types": "error",
398
+ // Enforce PascalCase for Vue components
399
+ "vue/component-name-in-template-casing": ["error", "PascalCase", { registeredComponentsOnly: false, ignores: [] }],
400
+ // Do not allow inline styles
401
+ "vue/no-static-inline-styles": ["error", { allowBinding: false }],
402
+ // Require explicit emits
403
+ "vue/require-explicit-emits": "error",
404
+ // Require component to have a name property
405
+ "vue/require-name-property": "error",
406
+ // Require components that don't have any content to self-close
407
+ "vue/html-self-closing": [
408
+ "error",
409
+ {
410
+ html: {
411
+ void: "always",
412
+ normal: "never",
413
+ component: "always"
414
+ },
415
+ svg: "always",
416
+ math: "always"
417
+ }
418
+ ]
419
+ }
420
+ }
421
+ ];
422
+ return config;
423
+ };
424
+
425
+ const config = (options) => {
426
+ const opts = {
427
+ noJsx: true,
428
+ noStyle: true,
429
+ semi: false,
430
+ ts: true,
431
+ vue: true,
432
+ vueVersion: 3,
433
+ vitest: true,
434
+ ...options
435
+ };
436
+ const linterConfig = [
437
+ {
438
+ name: "kouts/ignores",
439
+ ignores: [
440
+ "**/node_modules/**",
441
+ "{tmp,temp}/**",
442
+ "**/*.min.js",
443
+ "vendor/**",
444
+ "dist/**",
445
+ "public/**",
446
+ ...neostandard.resolveIgnoresFromGitignore()
447
+ ]
448
+ },
449
+ // JavaScript
450
+ {
451
+ name: "kouts/javascript",
452
+ ...js.configs.recommended
453
+ },
454
+ // TypeScript
455
+ ...opts.ts ? typescript : [],
456
+ // Neostandard
457
+ ...neostandard(opts),
458
+ {
459
+ name: "kouts/neostandard-overrides",
460
+ rules: {
461
+ // Enforce blank lines between the given 2 kinds of statements
462
+ "padding-line-between-statements": [
463
+ "error",
464
+ { blankLine: "always", prev: "*", next: "return" },
465
+ { blankLine: "always", prev: ["const", "let", "var"], next: "*" },
466
+ { blankLine: "any", prev: ["const", "let", "var"], next: ["const", "let", "var"] },
467
+ { blankLine: "always", prev: "directive", next: "*" },
468
+ { blankLine: "any", prev: "directive", next: "directive" }
469
+ ],
470
+ // Console and debugger settings depending whether we're on production or not
471
+ "no-console": process.env.NODE_ENV === "production" ? "warn" : "off",
472
+ "no-debugger": process.env.NODE_ENV === "production" ? "warn" : "off"
473
+ }
474
+ },
475
+ // Import
476
+ {
477
+ name: "kouts/import",
478
+ plugins: {
479
+ import: pluginImport
480
+ },
481
+ rules: {
482
+ "import/export": "error",
483
+ "import/first": "error",
484
+ "import/no-duplicates": "error",
485
+ "import/no-mutable-exports": "error",
486
+ "import/no-named-default": "error",
487
+ "import/no-self-import": "error",
488
+ "import/no-webpack-loader-syntax": "error",
489
+ "import/no-absolute-path": ["error", { esmodule: true, commonjs: true, amd: false }],
490
+ "import/newline-after-import": ["error", { count: 1 }]
491
+ }
492
+ },
493
+ // Sort imports
494
+ {
495
+ name: "kouts/sort-imports",
496
+ plugins: {
497
+ "simple-import-sort": pluginSimpleImportSort
498
+ },
499
+ rules: {
500
+ "simple-import-sort/imports": [
501
+ "error",
502
+ // Remove all blank lines between imports
503
+ {
504
+ groups: [["^\\u0000", "^node:", "^@?\\w", "^", "^\\."]]
505
+ }
506
+ ],
507
+ "simple-import-sort/exports": "error"
508
+ }
509
+ },
510
+ // HTML
511
+ {
512
+ name: "kouts/html",
513
+ files: ["**/*.html"],
514
+ plugins: {
515
+ html: pluginHtml
516
+ }
517
+ },
518
+ // Vue
519
+ ...opts.vue ? vue({ version: opts.vueVersion, ts: opts.ts }) : [],
520
+ // Vitest
521
+ ...opts.vitest ? [
522
+ {
523
+ name: "kouts/vitest",
524
+ files: ["test/**", "tests/**", "**/*.test.{js,ts}*", "**/*.spec.{js,ts}"],
525
+ plugins: {
526
+ vitest: pluginVitest
527
+ },
528
+ rules: {
529
+ ...pluginVitest.configs.recommended.rules
530
+ },
531
+ languageOptions: {
532
+ globals: {
533
+ ...pluginVitest.environments.env.globals
534
+ }
535
+ }
536
+ }
537
+ ] : [],
538
+ // Prettier
539
+ {
540
+ name: "kouts/prettier",
541
+ ...pluginPrettier
542
+ }
543
+ ];
544
+ return linterConfig;
545
+ };
546
+
547
+ Object.defineProperty(exports, "plugins", {
548
+ enumerable: true,
549
+ get: function () { return neostandard.plugins; }
550
+ });
551
+ exports.config = config;
@@ -0,0 +1,12 @@
1
+ import { Linter } from 'eslint';
2
+ import { NeostandardOptions } from 'neostandard';
3
+ export { plugins } from 'neostandard';
4
+
5
+ type Options = {
6
+ vue?: boolean;
7
+ vueVersion?: 2 | 3;
8
+ vitest: boolean;
9
+ } & NeostandardOptions;
10
+ declare const config: (options?: Options) => Linter.Config<Linter.RulesRecord>[];
11
+
12
+ export { config };
@@ -0,0 +1,12 @@
1
+ import { Linter } from 'eslint';
2
+ import { NeostandardOptions } from 'neostandard';
3
+ export { plugins } from 'neostandard';
4
+
5
+ type Options = {
6
+ vue?: boolean;
7
+ vueVersion?: 2 | 3;
8
+ vitest: boolean;
9
+ } & NeostandardOptions;
10
+ declare const config: (options?: Options) => Linter.Config<Linter.RulesRecord>[];
11
+
12
+ export { config };
package/dist/index.js ADDED
@@ -0,0 +1,546 @@
1
+ import pluginVitest from '@vitest/eslint-plugin';
2
+ import pluginHtml from 'eslint-plugin-html';
3
+ import pluginImport from 'eslint-plugin-import-x';
4
+ import pluginPrettier from 'eslint-plugin-prettier/recommended';
5
+ import pluginSimpleImportSort from 'eslint-plugin-simple-import-sort';
6
+ import neostandard, { plugins, resolveIgnoresFromGitignore } from 'neostandard';
7
+ export { plugins } from 'neostandard';
8
+ import pluginVue from 'eslint-plugin-vue';
9
+
10
+ function getDefaultExportFromCjs (x) {
11
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
12
+ }
13
+
14
+ /*
15
+ * WARNING: This file is autogenerated using the tools/update-eslint-all.js
16
+ * script. Do not edit manually.
17
+ */
18
+
19
+ /* eslint quote-props: off -- autogenerated so don't lint */
20
+
21
+ /*
22
+ * IMPORTANT!
23
+ *
24
+ * We cannot add a "name" property to this object because it's still used in eslintrc
25
+ * which doesn't support the "name" property. If we add a "name" property, it will
26
+ * cause an error.
27
+ */
28
+
29
+ var eslintAll = Object.freeze({
30
+ "rules": {
31
+ "accessor-pairs": "error",
32
+ "array-callback-return": "error",
33
+ "arrow-body-style": "error",
34
+ "block-scoped-var": "error",
35
+ "camelcase": "error",
36
+ "capitalized-comments": "error",
37
+ "class-methods-use-this": "error",
38
+ "complexity": "error",
39
+ "consistent-return": "error",
40
+ "consistent-this": "error",
41
+ "constructor-super": "error",
42
+ "curly": "error",
43
+ "default-case": "error",
44
+ "default-case-last": "error",
45
+ "default-param-last": "error",
46
+ "dot-notation": "error",
47
+ "eqeqeq": "error",
48
+ "for-direction": "error",
49
+ "func-name-matching": "error",
50
+ "func-names": "error",
51
+ "func-style": "error",
52
+ "getter-return": "error",
53
+ "grouped-accessor-pairs": "error",
54
+ "guard-for-in": "error",
55
+ "id-denylist": "error",
56
+ "id-length": "error",
57
+ "id-match": "error",
58
+ "init-declarations": "error",
59
+ "logical-assignment-operators": "error",
60
+ "max-classes-per-file": "error",
61
+ "max-depth": "error",
62
+ "max-lines": "error",
63
+ "max-lines-per-function": "error",
64
+ "max-nested-callbacks": "error",
65
+ "max-params": "error",
66
+ "max-statements": "error",
67
+ "new-cap": "error",
68
+ "no-alert": "error",
69
+ "no-array-constructor": "error",
70
+ "no-async-promise-executor": "error",
71
+ "no-await-in-loop": "error",
72
+ "no-bitwise": "error",
73
+ "no-caller": "error",
74
+ "no-case-declarations": "error",
75
+ "no-class-assign": "error",
76
+ "no-compare-neg-zero": "error",
77
+ "no-cond-assign": "error",
78
+ "no-console": "error",
79
+ "no-const-assign": "error",
80
+ "no-constant-binary-expression": "error",
81
+ "no-constant-condition": "error",
82
+ "no-constructor-return": "error",
83
+ "no-continue": "error",
84
+ "no-control-regex": "error",
85
+ "no-debugger": "error",
86
+ "no-delete-var": "error",
87
+ "no-div-regex": "error",
88
+ "no-dupe-args": "error",
89
+ "no-dupe-class-members": "error",
90
+ "no-dupe-else-if": "error",
91
+ "no-dupe-keys": "error",
92
+ "no-duplicate-case": "error",
93
+ "no-duplicate-imports": "error",
94
+ "no-else-return": "error",
95
+ "no-empty": "error",
96
+ "no-empty-character-class": "error",
97
+ "no-empty-function": "error",
98
+ "no-empty-pattern": "error",
99
+ "no-empty-static-block": "error",
100
+ "no-eq-null": "error",
101
+ "no-eval": "error",
102
+ "no-ex-assign": "error",
103
+ "no-extend-native": "error",
104
+ "no-extra-bind": "error",
105
+ "no-extra-boolean-cast": "error",
106
+ "no-extra-label": "error",
107
+ "no-fallthrough": "error",
108
+ "no-func-assign": "error",
109
+ "no-global-assign": "error",
110
+ "no-implicit-coercion": "error",
111
+ "no-implicit-globals": "error",
112
+ "no-implied-eval": "error",
113
+ "no-import-assign": "error",
114
+ "no-inline-comments": "error",
115
+ "no-inner-declarations": "error",
116
+ "no-invalid-regexp": "error",
117
+ "no-invalid-this": "error",
118
+ "no-irregular-whitespace": "error",
119
+ "no-iterator": "error",
120
+ "no-label-var": "error",
121
+ "no-labels": "error",
122
+ "no-lone-blocks": "error",
123
+ "no-lonely-if": "error",
124
+ "no-loop-func": "error",
125
+ "no-loss-of-precision": "error",
126
+ "no-magic-numbers": "error",
127
+ "no-misleading-character-class": "error",
128
+ "no-multi-assign": "error",
129
+ "no-multi-str": "error",
130
+ "no-negated-condition": "error",
131
+ "no-nested-ternary": "error",
132
+ "no-new": "error",
133
+ "no-new-func": "error",
134
+ "no-new-native-nonconstructor": "error",
135
+ "no-new-wrappers": "error",
136
+ "no-nonoctal-decimal-escape": "error",
137
+ "no-obj-calls": "error",
138
+ "no-object-constructor": "error",
139
+ "no-octal": "error",
140
+ "no-octal-escape": "error",
141
+ "no-param-reassign": "error",
142
+ "no-plusplus": "error",
143
+ "no-promise-executor-return": "error",
144
+ "no-proto": "error",
145
+ "no-prototype-builtins": "error",
146
+ "no-redeclare": "error",
147
+ "no-regex-spaces": "error",
148
+ "no-restricted-exports": "error",
149
+ "no-restricted-globals": "error",
150
+ "no-restricted-imports": "error",
151
+ "no-restricted-properties": "error",
152
+ "no-restricted-syntax": "error",
153
+ "no-return-assign": "error",
154
+ "no-script-url": "error",
155
+ "no-self-assign": "error",
156
+ "no-self-compare": "error",
157
+ "no-sequences": "error",
158
+ "no-setter-return": "error",
159
+ "no-shadow": "error",
160
+ "no-shadow-restricted-names": "error",
161
+ "no-sparse-arrays": "error",
162
+ "no-template-curly-in-string": "error",
163
+ "no-ternary": "error",
164
+ "no-this-before-super": "error",
165
+ "no-throw-literal": "error",
166
+ "no-undef": "error",
167
+ "no-undef-init": "error",
168
+ "no-undefined": "error",
169
+ "no-underscore-dangle": "error",
170
+ "no-unexpected-multiline": "error",
171
+ "no-unmodified-loop-condition": "error",
172
+ "no-unneeded-ternary": "error",
173
+ "no-unreachable": "error",
174
+ "no-unreachable-loop": "error",
175
+ "no-unsafe-finally": "error",
176
+ "no-unsafe-negation": "error",
177
+ "no-unsafe-optional-chaining": "error",
178
+ "no-unused-expressions": "error",
179
+ "no-unused-labels": "error",
180
+ "no-unused-private-class-members": "error",
181
+ "no-unused-vars": "error",
182
+ "no-use-before-define": "error",
183
+ "no-useless-assignment": "error",
184
+ "no-useless-backreference": "error",
185
+ "no-useless-call": "error",
186
+ "no-useless-catch": "error",
187
+ "no-useless-computed-key": "error",
188
+ "no-useless-concat": "error",
189
+ "no-useless-constructor": "error",
190
+ "no-useless-escape": "error",
191
+ "no-useless-rename": "error",
192
+ "no-useless-return": "error",
193
+ "no-var": "error",
194
+ "no-void": "error",
195
+ "no-warning-comments": "error",
196
+ "no-with": "error",
197
+ "object-shorthand": "error",
198
+ "one-var": "error",
199
+ "operator-assignment": "error",
200
+ "prefer-arrow-callback": "error",
201
+ "prefer-const": "error",
202
+ "prefer-destructuring": "error",
203
+ "prefer-exponentiation-operator": "error",
204
+ "prefer-named-capture-group": "error",
205
+ "prefer-numeric-literals": "error",
206
+ "prefer-object-has-own": "error",
207
+ "prefer-object-spread": "error",
208
+ "prefer-promise-reject-errors": "error",
209
+ "prefer-regex-literals": "error",
210
+ "prefer-rest-params": "error",
211
+ "prefer-spread": "error",
212
+ "prefer-template": "error",
213
+ "radix": "error",
214
+ "require-atomic-updates": "error",
215
+ "require-await": "error",
216
+ "require-unicode-regexp": "error",
217
+ "require-yield": "error",
218
+ "sort-imports": "error",
219
+ "sort-keys": "error",
220
+ "sort-vars": "error",
221
+ "strict": "error",
222
+ "symbol-description": "error",
223
+ "unicode-bom": "error",
224
+ "use-isnan": "error",
225
+ "valid-typeof": "error",
226
+ "vars-on-top": "error",
227
+ "yoda": "error"
228
+ }
229
+ });
230
+
231
+ /**
232
+ * @fileoverview Configuration applied when a user configuration extends from
233
+ * eslint:recommended.
234
+ * @author Nicholas C. Zakas
235
+ */
236
+
237
+ /* eslint sort-keys: ["error", "asc"] -- Long, so make more readable */
238
+
239
+ /*
240
+ * IMPORTANT!
241
+ *
242
+ * We cannot add a "name" property to this object because it's still used in eslintrc
243
+ * which doesn't support the "name" property. If we add a "name" property, it will
244
+ * cause an error.
245
+ */
246
+
247
+ var eslintRecommended = Object.freeze({
248
+ rules: Object.freeze({
249
+ "constructor-super": "error",
250
+ "for-direction": "error",
251
+ "getter-return": "error",
252
+ "no-async-promise-executor": "error",
253
+ "no-case-declarations": "error",
254
+ "no-class-assign": "error",
255
+ "no-compare-neg-zero": "error",
256
+ "no-cond-assign": "error",
257
+ "no-const-assign": "error",
258
+ "no-constant-binary-expression": "error",
259
+ "no-constant-condition": "error",
260
+ "no-control-regex": "error",
261
+ "no-debugger": "error",
262
+ "no-delete-var": "error",
263
+ "no-dupe-args": "error",
264
+ "no-dupe-class-members": "error",
265
+ "no-dupe-else-if": "error",
266
+ "no-dupe-keys": "error",
267
+ "no-duplicate-case": "error",
268
+ "no-empty": "error",
269
+ "no-empty-character-class": "error",
270
+ "no-empty-pattern": "error",
271
+ "no-empty-static-block": "error",
272
+ "no-ex-assign": "error",
273
+ "no-extra-boolean-cast": "error",
274
+ "no-fallthrough": "error",
275
+ "no-func-assign": "error",
276
+ "no-global-assign": "error",
277
+ "no-import-assign": "error",
278
+ "no-invalid-regexp": "error",
279
+ "no-irregular-whitespace": "error",
280
+ "no-loss-of-precision": "error",
281
+ "no-misleading-character-class": "error",
282
+ "no-new-native-nonconstructor": "error",
283
+ "no-nonoctal-decimal-escape": "error",
284
+ "no-obj-calls": "error",
285
+ "no-octal": "error",
286
+ "no-prototype-builtins": "error",
287
+ "no-redeclare": "error",
288
+ "no-regex-spaces": "error",
289
+ "no-self-assign": "error",
290
+ "no-setter-return": "error",
291
+ "no-shadow-restricted-names": "error",
292
+ "no-sparse-arrays": "error",
293
+ "no-this-before-super": "error",
294
+ "no-undef": "error",
295
+ "no-unexpected-multiline": "error",
296
+ "no-unreachable": "error",
297
+ "no-unsafe-finally": "error",
298
+ "no-unsafe-negation": "error",
299
+ "no-unsafe-optional-chaining": "error",
300
+ "no-unused-labels": "error",
301
+ "no-unused-private-class-members": "error",
302
+ "no-unused-vars": "error",
303
+ "no-useless-backreference": "error",
304
+ "no-useless-catch": "error",
305
+ "no-useless-escape": "error",
306
+ "no-with": "error",
307
+ "require-yield": "error",
308
+ "use-isnan": "error",
309
+ "valid-typeof": "error"
310
+ })
311
+ });
312
+
313
+ /**
314
+ * @fileoverview Main package entrypoint.
315
+ * @author Nicholas C. Zakas
316
+ */
317
+
318
+ //------------------------------------------------------------------------------
319
+ // Public Interface
320
+ //------------------------------------------------------------------------------
321
+
322
+ var src = {
323
+ configs: {
324
+ all: eslintAll,
325
+ recommended: eslintRecommended
326
+ }
327
+ };
328
+
329
+ var js = /*@__PURE__*/getDefaultExportFromCjs(src);
330
+
331
+ const typescript = [
332
+ ...plugins["typescript-eslint"].configs.recommended,
333
+ {
334
+ name: "kouts/typescript",
335
+ rules: {
336
+ // Prefer T[] instead of Array<T>
337
+ "@typescript-eslint/array-type": ["error", { default: "array" }],
338
+ // Prefer type over interface for objects
339
+ "@typescript-eslint/consistent-type-definitions": ["error", "type"],
340
+ // Fix type imports
341
+ "@typescript-eslint/consistent-type-imports": [
342
+ "error",
343
+ {
344
+ prefer: "type-imports",
345
+ fixStyle: "inline-type-imports"
346
+ }
347
+ ],
348
+ // Allow _ for unused variables
349
+ "@typescript-eslint/no-unused-vars": [
350
+ "error",
351
+ {
352
+ args: "none",
353
+ caughtErrors: "none",
354
+ ignoreRestSiblings: true,
355
+ vars: "all",
356
+ argsIgnorePattern: "^_"
357
+ }
358
+ ]
359
+ }
360
+ }
361
+ ];
362
+
363
+ const vue = (options) => {
364
+ const opts = {
365
+ version: 3,
366
+ ts: true,
367
+ ...options
368
+ };
369
+ const vueConfig = opts.version === 3 ? pluginVue.configs["flat/recommended"] : pluginVue.configs["flat/vue2-recommended"];
370
+ const languageOptions = opts.ts ? {
371
+ languageOptions: {
372
+ parserOptions: {
373
+ parser: plugins["typescript-eslint"].parser
374
+ }
375
+ }
376
+ } : {};
377
+ const config = [
378
+ ...vueConfig,
379
+ {
380
+ name: "kouts/vue",
381
+ files: ["*.vue", "**/*.vue"],
382
+ ...languageOptions,
383
+ rules: {
384
+ // Overrides for vue/(vue3-)recommended preset
385
+ "vue/max-attributes-per-line": "off",
386
+ "vue/singleline-html-element-content-newline": "off",
387
+ // Strengthen vue/(vue3-)recommended preset for autofix
388
+ // https://github.com/vuejs/eslint-plugin-vue/blob/master/lib/configs/recommended.js
389
+ "vue/attributes-order": "error",
390
+ "vue/component-tags-order": "error",
391
+ "vue/no-lone-template": "error",
392
+ "vue/no-multiple-slot-args": "error",
393
+ "vue/no-v-html": "error",
394
+ "vue/order-in-components": "error",
395
+ "vue/this-in-template": "error",
396
+ "vue/require-prop-types": "error",
397
+ // Enforce PascalCase for Vue components
398
+ "vue/component-name-in-template-casing": ["error", "PascalCase", { registeredComponentsOnly: false, ignores: [] }],
399
+ // Do not allow inline styles
400
+ "vue/no-static-inline-styles": ["error", { allowBinding: false }],
401
+ // Require explicit emits
402
+ "vue/require-explicit-emits": "error",
403
+ // Require component to have a name property
404
+ "vue/require-name-property": "error",
405
+ // Require components that don't have any content to self-close
406
+ "vue/html-self-closing": [
407
+ "error",
408
+ {
409
+ html: {
410
+ void: "always",
411
+ normal: "never",
412
+ component: "always"
413
+ },
414
+ svg: "always",
415
+ math: "always"
416
+ }
417
+ ]
418
+ }
419
+ }
420
+ ];
421
+ return config;
422
+ };
423
+
424
+ const config = (options) => {
425
+ const opts = {
426
+ noJsx: true,
427
+ noStyle: true,
428
+ semi: false,
429
+ ts: true,
430
+ vue: true,
431
+ vueVersion: 3,
432
+ vitest: true,
433
+ ...options
434
+ };
435
+ const linterConfig = [
436
+ {
437
+ name: "kouts/ignores",
438
+ ignores: [
439
+ "**/node_modules/**",
440
+ "{tmp,temp}/**",
441
+ "**/*.min.js",
442
+ "vendor/**",
443
+ "dist/**",
444
+ "public/**",
445
+ ...resolveIgnoresFromGitignore()
446
+ ]
447
+ },
448
+ // JavaScript
449
+ {
450
+ name: "kouts/javascript",
451
+ ...js.configs.recommended
452
+ },
453
+ // TypeScript
454
+ ...opts.ts ? typescript : [],
455
+ // Neostandard
456
+ ...neostandard(opts),
457
+ {
458
+ name: "kouts/neostandard-overrides",
459
+ rules: {
460
+ // Enforce blank lines between the given 2 kinds of statements
461
+ "padding-line-between-statements": [
462
+ "error",
463
+ { blankLine: "always", prev: "*", next: "return" },
464
+ { blankLine: "always", prev: ["const", "let", "var"], next: "*" },
465
+ { blankLine: "any", prev: ["const", "let", "var"], next: ["const", "let", "var"] },
466
+ { blankLine: "always", prev: "directive", next: "*" },
467
+ { blankLine: "any", prev: "directive", next: "directive" }
468
+ ],
469
+ // Console and debugger settings depending whether we're on production or not
470
+ "no-console": process.env.NODE_ENV === "production" ? "warn" : "off",
471
+ "no-debugger": process.env.NODE_ENV === "production" ? "warn" : "off"
472
+ }
473
+ },
474
+ // Import
475
+ {
476
+ name: "kouts/import",
477
+ plugins: {
478
+ import: pluginImport
479
+ },
480
+ rules: {
481
+ "import/export": "error",
482
+ "import/first": "error",
483
+ "import/no-duplicates": "error",
484
+ "import/no-mutable-exports": "error",
485
+ "import/no-named-default": "error",
486
+ "import/no-self-import": "error",
487
+ "import/no-webpack-loader-syntax": "error",
488
+ "import/no-absolute-path": ["error", { esmodule: true, commonjs: true, amd: false }],
489
+ "import/newline-after-import": ["error", { count: 1 }]
490
+ }
491
+ },
492
+ // Sort imports
493
+ {
494
+ name: "kouts/sort-imports",
495
+ plugins: {
496
+ "simple-import-sort": pluginSimpleImportSort
497
+ },
498
+ rules: {
499
+ "simple-import-sort/imports": [
500
+ "error",
501
+ // Remove all blank lines between imports
502
+ {
503
+ groups: [["^\\u0000", "^node:", "^@?\\w", "^", "^\\."]]
504
+ }
505
+ ],
506
+ "simple-import-sort/exports": "error"
507
+ }
508
+ },
509
+ // HTML
510
+ {
511
+ name: "kouts/html",
512
+ files: ["**/*.html"],
513
+ plugins: {
514
+ html: pluginHtml
515
+ }
516
+ },
517
+ // Vue
518
+ ...opts.vue ? vue({ version: opts.vueVersion, ts: opts.ts }) : [],
519
+ // Vitest
520
+ ...opts.vitest ? [
521
+ {
522
+ name: "kouts/vitest",
523
+ files: ["test/**", "tests/**", "**/*.test.{js,ts}*", "**/*.spec.{js,ts}"],
524
+ plugins: {
525
+ vitest: pluginVitest
526
+ },
527
+ rules: {
528
+ ...pluginVitest.configs.recommended.rules
529
+ },
530
+ languageOptions: {
531
+ globals: {
532
+ ...pluginVitest.environments.env.globals
533
+ }
534
+ }
535
+ }
536
+ ] : [],
537
+ // Prettier
538
+ {
539
+ name: "kouts/prettier",
540
+ ...pluginPrettier
541
+ }
542
+ ];
543
+ return linterConfig;
544
+ };
545
+
546
+ export { config };
@@ -0,0 +1,12 @@
1
+ 'use strict';
2
+
3
+ const configPrettier = {
4
+ trailingComma: "all",
5
+ printWidth: 128,
6
+ tabWidth: 2,
7
+ semi: false,
8
+ singleQuote: true,
9
+ arrowParens: "always"
10
+ };
11
+
12
+ module.exports = configPrettier;
@@ -0,0 +1,5 @@
1
+ import { Options } from 'prettier';
2
+
3
+ declare const configPrettier: Options;
4
+
5
+ export { configPrettier as default };
@@ -0,0 +1,5 @@
1
+ import { Options } from 'prettier';
2
+
3
+ declare const configPrettier: Options;
4
+
5
+ export { configPrettier as default };
@@ -0,0 +1,10 @@
1
+ const configPrettier = {
2
+ trailingComma: "all",
3
+ printWidth: 128,
4
+ tabWidth: 2,
5
+ semi: false,
6
+ singleQuote: true,
7
+ arrowParens: "always"
8
+ };
9
+
10
+ export { configPrettier as default };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@kouts/eslint-config",
3
3
  "type": "module",
4
- "version": "1.3.1",
4
+ "version": "1.3.3",
5
5
  "packageManager": "pnpm@9.7.1",
6
6
  "engines": {
7
7
  "node": "^18.18.0 || ^20.9.0 || >=21.1.0"