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