@kouts/eslint-config 3.1.1 → 3.1.2

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 CHANGED
@@ -4,10 +4,640 @@ var js = require('@eslint/js');
4
4
  var pluginHtml = require('eslint-plugin-html');
5
5
  var pluginPrettier = require('eslint-plugin-prettier/recommended');
6
6
  var pluginSimpleImportSort = require('eslint-plugin-simple-import-sort');
7
- var neostandard = require('neostandard');
7
+ var node_fs = require('node:fs');
8
+ var node_path = require('node:path');
9
+ var compat = require('@eslint/compat');
10
+ var gitignoreToMinimatch = require('@humanwhocodes/gitignore-to-minimatch');
11
+ var stylistic = require('@stylistic/eslint-plugin');
12
+ var importX = require('eslint-plugin-import-x');
13
+ var pluginN = require('eslint-plugin-n');
14
+ var pluginPromise = require('eslint-plugin-promise');
15
+ var findUp = require('find-up');
16
+ var globals = require('globals');
17
+ var tseslint = require('typescript-eslint');
8
18
  var pluginVitest = require('@vitest/eslint-plugin');
9
19
  var pluginVue = require('eslint-plugin-vue');
10
20
 
21
+ const plugins = {
22
+ "@stylistic": stylistic,
23
+ "import-x": importX,
24
+ n: pluginN,
25
+ promise: pluginPromise,
26
+ // react: pluginReact,
27
+ "typescript-eslint": tseslint
28
+ };
29
+ const base = {
30
+ name: "neostandard/base",
31
+ languageOptions: {
32
+ ecmaVersion: 2022,
33
+ sourceType: "module",
34
+ globals: {
35
+ ...globals.es2022,
36
+ ...globals.node,
37
+ document: "readonly",
38
+ navigator: "readonly",
39
+ window: "readonly"
40
+ }
41
+ },
42
+ plugins: {
43
+ n: plugins.n
44
+ },
45
+ rules: {
46
+ "no-var": "warn",
47
+ "object-shorthand": ["warn", "properties"],
48
+ "accessor-pairs": ["error", { setWithoutGet: true, enforceForClassMembers: true }],
49
+ "array-callback-return": [
50
+ "error",
51
+ {
52
+ allowImplicit: false,
53
+ checkForEach: false
54
+ }
55
+ ],
56
+ camelcase: [
57
+ "error",
58
+ {
59
+ allow: ["^UNSAFE_"],
60
+ properties: "never",
61
+ ignoreGlobals: true
62
+ }
63
+ ],
64
+ "constructor-super": "error",
65
+ curly: ["error", "multi-line"],
66
+ "default-case-last": "error",
67
+ "dot-notation": ["error", { allowKeywords: true }],
68
+ eqeqeq: ["error", "always", { null: "ignore" }],
69
+ "new-cap": ["error", { newIsCap: true, capIsNew: false, properties: true }],
70
+ "no-array-constructor": "error",
71
+ "no-async-promise-executor": "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-const-assign": "error",
78
+ "no-constant-condition": ["error", { checkLoops: false }],
79
+ "no-control-regex": "error",
80
+ "no-debugger": "error",
81
+ "no-delete-var": "error",
82
+ "no-dupe-args": "error",
83
+ "no-dupe-class-members": "error",
84
+ "no-dupe-keys": "error",
85
+ "no-duplicate-case": "error",
86
+ "no-useless-backreference": "error",
87
+ "no-empty": ["error", { allowEmptyCatch: true }],
88
+ "no-empty-character-class": "error",
89
+ "no-empty-pattern": "error",
90
+ "no-eval": "error",
91
+ "no-ex-assign": "error",
92
+ "no-extend-native": "error",
93
+ "no-extra-bind": "error",
94
+ "no-extra-boolean-cast": "error",
95
+ "no-fallthrough": "error",
96
+ "no-func-assign": "error",
97
+ "no-global-assign": "error",
98
+ "no-implied-eval": "error",
99
+ "no-import-assign": "error",
100
+ "no-invalid-regexp": "error",
101
+ "no-irregular-whitespace": "error",
102
+ "no-iterator": "error",
103
+ "no-labels": ["error", { allowLoop: false, allowSwitch: false }],
104
+ "no-lone-blocks": "error",
105
+ "no-loss-of-precision": "error",
106
+ "no-misleading-character-class": "error",
107
+ "no-prototype-builtins": "error",
108
+ "no-useless-catch": "error",
109
+ "no-multi-str": "error",
110
+ "no-new": "error",
111
+ "no-new-func": "error",
112
+ "no-object-constructor": "error",
113
+ "no-new-native-nonconstructor": "error",
114
+ "no-new-wrappers": "error",
115
+ "no-obj-calls": "error",
116
+ "no-octal": "error",
117
+ "no-octal-escape": "error",
118
+ "no-proto": "error",
119
+ "no-redeclare": ["error", { builtinGlobals: false }],
120
+ "no-regex-spaces": "error",
121
+ "no-return-assign": ["error", "except-parens"],
122
+ "no-self-assign": ["error", { props: true }],
123
+ "no-self-compare": "error",
124
+ "no-sequences": "error",
125
+ "no-shadow-restricted-names": "error",
126
+ "no-sparse-arrays": "error",
127
+ "no-template-curly-in-string": "error",
128
+ "no-this-before-super": "error",
129
+ "no-throw-literal": "error",
130
+ "no-undef": "error",
131
+ "no-undef-init": "error",
132
+ "no-unexpected-multiline": "error",
133
+ "no-unmodified-loop-condition": "error",
134
+ "no-unneeded-ternary": ["error", { defaultAssignment: false }],
135
+ "no-unreachable": "error",
136
+ "no-unreachable-loop": "error",
137
+ "no-unsafe-finally": "error",
138
+ "no-unsafe-negation": "error",
139
+ "no-unused-expressions": [
140
+ "error",
141
+ {
142
+ allowShortCircuit: true,
143
+ allowTernary: true,
144
+ allowTaggedTemplates: true
145
+ }
146
+ ],
147
+ "no-unused-vars": [
148
+ "error",
149
+ {
150
+ args: "none",
151
+ caughtErrors: "none",
152
+ ignoreRestSiblings: true,
153
+ vars: "all"
154
+ }
155
+ ],
156
+ "no-use-before-define": ["error", { functions: false, classes: false, variables: false }],
157
+ "no-useless-call": "error",
158
+ "no-useless-computed-key": "error",
159
+ "no-useless-constructor": "error",
160
+ "no-useless-escape": "error",
161
+ "no-useless-rename": "error",
162
+ "no-useless-return": "error",
163
+ "no-void": "error",
164
+ "no-with": "error",
165
+ "one-var": ["error", { initialized: "never" }],
166
+ "prefer-const": ["error", { destructuring: "all" }],
167
+ "prefer-promise-reject-errors": "error",
168
+ "prefer-regex-literals": ["error", { disallowRedundantWrapping: true }],
169
+ "symbol-description": "error",
170
+ "unicode-bom": ["error", "never"],
171
+ "use-isnan": [
172
+ "error",
173
+ {
174
+ enforceForSwitchCase: true,
175
+ enforceForIndexOf: true
176
+ }
177
+ ],
178
+ "valid-typeof": ["error", { requireStringLiterals: true }],
179
+ yoda: ["error", "never"],
180
+ "n/handle-callback-err": ["error", "^(err|error)$"],
181
+ "n/no-callback-literal": "error",
182
+ "n/no-deprecated-api": "error",
183
+ "n/no-exports-assign": "error",
184
+ "n/no-new-require": "error",
185
+ "n/no-path-concat": "error",
186
+ "n/process-exit-as-throw": "error",
187
+ "promise/param-names": "error"
188
+ }
189
+ };
190
+ const modernization = {
191
+ name: "neostandard/modernization-since-standard-17",
192
+ rules: {
193
+ "dot-notation": "off",
194
+ "n/no-deprecated-api": "warn"
195
+ }
196
+ };
197
+ const promise = compat.fixupConfigRules(pluginPromise.configs["flat/recommended"]);
198
+ const promiseConfigs = Array.isArray(promise) ? promise : [promise];
199
+ const modernizationStyles = {
200
+ name: "neostandard/style/modernization-since-standard-17",
201
+ rules: {
202
+ "@stylistic/comma-dangle": [
203
+ "warn",
204
+ {
205
+ arrays: "ignore",
206
+ enums: "ignore",
207
+ exports: "ignore",
208
+ imports: "ignore",
209
+ objects: "ignore"
210
+ }
211
+ ],
212
+ "@stylistic/no-multi-spaces": ["error", { ignoreEOLComments: true }]
213
+ }
214
+ };
215
+ const style = {
216
+ name: "neostandard/style",
217
+ plugins: {
218
+ "@stylistic": plugins["@stylistic"]
219
+ },
220
+ rules: {
221
+ "@stylistic/array-bracket-spacing": ["error", "never"],
222
+ "@stylistic/arrow-spacing": ["error", { before: true, after: true }],
223
+ "@stylistic/block-spacing": ["error", "always"],
224
+ "@stylistic/brace-style": ["error", "1tbs", { allowSingleLine: true }],
225
+ "@stylistic/comma-dangle": [
226
+ "error",
227
+ {
228
+ arrays: "never",
229
+ objects: "never",
230
+ imports: "never",
231
+ exports: "never",
232
+ functions: "never"
233
+ }
234
+ ],
235
+ "@stylistic/comma-spacing": ["error", { before: false, after: true }],
236
+ "@stylistic/comma-style": ["error", "last"],
237
+ "@stylistic/computed-property-spacing": ["error", "never", { enforceForClassMembers: true }],
238
+ "@stylistic/dot-location": ["error", "property"],
239
+ "@stylistic/eol-last": "error",
240
+ "@stylistic/func-call-spacing": ["error", "never"],
241
+ "@stylistic/generator-star-spacing": ["error", { before: true, after: true }],
242
+ "@stylistic/indent": [
243
+ "error",
244
+ 2,
245
+ {
246
+ SwitchCase: 1,
247
+ VariableDeclarator: 1,
248
+ outerIIFEBody: 1,
249
+ MemberExpression: 1,
250
+ FunctionDeclaration: { parameters: 1, body: 1 },
251
+ FunctionExpression: { parameters: 1, body: 1 },
252
+ CallExpression: { arguments: 1 },
253
+ ArrayExpression: 1,
254
+ ObjectExpression: 1,
255
+ ImportDeclaration: 1,
256
+ flatTernaryExpressions: false,
257
+ ignoreComments: false,
258
+ ignoredNodes: [
259
+ "TemplateLiteral *",
260
+ "JSXElement",
261
+ "JSXElement > *",
262
+ "JSXAttribute",
263
+ "JSXIdentifier",
264
+ "JSXNamespacedName",
265
+ "JSXMemberExpression",
266
+ "JSXSpreadAttribute",
267
+ "JSXExpressionContainer",
268
+ "JSXOpeningElement",
269
+ "JSXClosingElement",
270
+ "JSXFragment",
271
+ "JSXOpeningFragment",
272
+ "JSXClosingFragment",
273
+ "JSXText",
274
+ "JSXEmptyExpression",
275
+ "JSXSpreadChild"
276
+ ],
277
+ offsetTernaryExpressions: true
278
+ }
279
+ ],
280
+ "@stylistic/key-spacing": ["error", { beforeColon: false, afterColon: true }],
281
+ "@stylistic/keyword-spacing": ["error", { before: true, after: true }],
282
+ "@stylistic/lines-between-class-members": ["error", "always", { exceptAfterSingleLine: true }],
283
+ "@stylistic/multiline-ternary": ["error", "always-multiline"],
284
+ "@stylistic/new-parens": "error",
285
+ "@stylistic/no-extra-parens": ["error", "functions"],
286
+ "@stylistic/no-floating-decimal": "error",
287
+ "@stylistic/no-mixed-operators": [
288
+ "error",
289
+ {
290
+ groups: [
291
+ ["==", "!=", "===", "!==", ">", ">=", "<", "<="],
292
+ ["&&", "||"],
293
+ ["in", "instanceof"]
294
+ ],
295
+ allowSamePrecedence: true
296
+ }
297
+ ],
298
+ "@stylistic/no-mixed-spaces-and-tabs": "error",
299
+ "@stylistic/no-multi-spaces": "error",
300
+ "@stylistic/no-multiple-empty-lines": ["error", { max: 1, maxBOF: 0, maxEOF: 0 }],
301
+ "@stylistic/no-tabs": "error",
302
+ "@stylistic/no-trailing-spaces": "error",
303
+ "@stylistic/no-whitespace-before-property": "error",
304
+ "@stylistic/object-curly-newline": ["error", { multiline: true, consistent: true }],
305
+ "@stylistic/object-curly-spacing": ["error", "always"],
306
+ "@stylistic/object-property-newline": ["error", { allowMultiplePropertiesPerLine: true }],
307
+ "@stylistic/operator-linebreak": ["error", "after", { overrides: { "?": "before", ":": "before", "|>": "before" } }],
308
+ "@stylistic/padded-blocks": ["error", { blocks: "never", switches: "never", classes: "never" }],
309
+ "@stylistic/quote-props": ["error", "as-needed"],
310
+ "@stylistic/quotes": ["error", "single", { avoidEscape: true, allowTemplateLiterals: false }],
311
+ "@stylistic/rest-spread-spacing": ["error", "never"],
312
+ "@stylistic/semi": ["error", "never"],
313
+ "@stylistic/semi-spacing": ["error", { before: false, after: true }],
314
+ "@stylistic/space-before-blocks": ["error", "always"],
315
+ "@stylistic/space-before-function-paren": ["error", "always"],
316
+ "@stylistic/space-in-parens": ["error", "never"],
317
+ "@stylistic/space-infix-ops": "error",
318
+ "@stylistic/space-unary-ops": ["error", { words: true, nonwords: false }],
319
+ "@stylistic/spaced-comment": [
320
+ "error",
321
+ "always",
322
+ {
323
+ line: { markers: ["*package", "!", "/", ",", "="] },
324
+ block: { balanced: true, markers: ["*package", "!", ",", ":", "::", "flow-include"], exceptions: ["*"] }
325
+ }
326
+ ],
327
+ "@stylistic/template-curly-spacing": ["error", "never"],
328
+ "@stylistic/template-tag-spacing": ["error", "never"],
329
+ "@stylistic/wrap-iife": ["error", "any", { functionPrototypeMethods: true }],
330
+ "@stylistic/yield-star-spacing": ["error", "both"]
331
+ }
332
+ };
333
+ const jsxIgnores = ["**/*.js", "**/*.mjs", "**/*.cjs", "**/*.ts"];
334
+ const jsx = {
335
+ name: "neostandard/jsx",
336
+ ignores: [...jsxIgnores],
337
+ languageOptions: {
338
+ parserOptions: {
339
+ ecmaFeatures: {
340
+ jsx: true
341
+ }
342
+ }
343
+ }
344
+ /*
345
+ * React support is temporarily disabled.
346
+ * plugins: {
347
+ * react: plugins.react,
348
+ * },
349
+ * settings: {
350
+ * react: {
351
+ * version: '17',
352
+ * },
353
+ * linkComponents: ['Link'],
354
+ * },
355
+ * rules: {
356
+ * 'react/jsx-boolean-value': 'error',
357
+ * 'react/jsx-fragments': ['error', 'syntax'],
358
+ * 'react/jsx-handler-names': 'error',
359
+ * 'react/jsx-key': [
360
+ * 'error',
361
+ * {
362
+ * checkFragmentShorthand: true,
363
+ * },
364
+ * ],
365
+ * 'react/jsx-no-comment-textnodes': 'error',
366
+ * 'react/jsx-no-duplicate-props': 'error',
367
+ * 'react/jsx-no-target-blank': ['error', { enforceDynamicLinks: 'always' }],
368
+ * 'react/jsx-no-undef': ['error', { allowGlobals: true }],
369
+ * 'react/jsx-uses-react': 'error',
370
+ * 'react/jsx-uses-vars': 'error',
371
+ * 'react/no-children-prop': 'error',
372
+ * 'react/no-danger-with-children': 'error',
373
+ * 'react/no-deprecated': 'error',
374
+ * 'react/no-direct-mutation-state': 'error',
375
+ * 'react/no-find-dom-node': 'error',
376
+ * 'react/no-is-mounted': 'error',
377
+ * 'react/no-string-refs': [
378
+ * 'error',
379
+ * {
380
+ * noTemplateLiterals: true,
381
+ * },
382
+ * ],
383
+ * 'react/no-unescaped-entities': [
384
+ * 'error',
385
+ * {
386
+ * forbid: ['>', '}'],
387
+ * },
388
+ * ],
389
+ * 'react/no-render-return-value': 'error',
390
+ * 'react/require-render-return': 'error',
391
+ * 'react/self-closing-comp': 'error',
392
+ * },
393
+ */
394
+ };
395
+ const jsxStyles = {
396
+ name: "neostandard/style/jsx",
397
+ ignores: [...jsxIgnores],
398
+ rules: {
399
+ "@stylistic/jsx-quotes": ["error", "prefer-single"],
400
+ "@stylistic/jsx-closing-bracket-location": ["error", "tag-aligned"],
401
+ "@stylistic/jsx-closing-tag-location": "error",
402
+ "@stylistic/jsx-curly-brace-presence": [
403
+ "error",
404
+ {
405
+ props: "never",
406
+ children: "never"
407
+ }
408
+ ],
409
+ "@stylistic/jsx-curly-newline": [
410
+ "error",
411
+ {
412
+ multiline: "consistent",
413
+ singleline: "consistent"
414
+ }
415
+ ],
416
+ "@stylistic/jsx-curly-spacing": [
417
+ "error",
418
+ {
419
+ attributes: { when: "never", allowMultiline: true },
420
+ children: { when: "never", allowMultiline: true }
421
+ }
422
+ ],
423
+ "@stylistic/jsx-equals-spacing": ["error", "never"],
424
+ "@stylistic/jsx-first-prop-new-line": ["error", "multiline-multiprop"],
425
+ "@stylistic/jsx-indent": [
426
+ "error",
427
+ 2,
428
+ {
429
+ checkAttributes: false,
430
+ indentLogicalExpressions: true
431
+ }
432
+ ],
433
+ "@stylistic/jsx-indent-props": ["error", 2],
434
+ "@stylistic/jsx-pascal-case": ["error", { allowAllCaps: false }],
435
+ "@stylistic/jsx-props-no-multi-spaces": "error",
436
+ "@stylistic/jsx-tag-spacing": [
437
+ "error",
438
+ {
439
+ closingSlash: "never",
440
+ beforeSelfClosing: "always",
441
+ afterOpening: "never",
442
+ beforeClosing: "never"
443
+ }
444
+ ],
445
+ "@stylistic/jsx-wrap-multilines": [
446
+ "error",
447
+ {
448
+ declaration: "parens-new-line",
449
+ assignment: "parens-new-line",
450
+ return: "parens-new-line",
451
+ arrow: "ignore",
452
+ condition: "ignore",
453
+ logical: "ignore",
454
+ prop: "ignore"
455
+ }
456
+ ]
457
+ }
458
+ };
459
+ const semiConfig = {
460
+ name: "neostandard/semi",
461
+ rules: {
462
+ "@stylistic/semi": ["error", "always"],
463
+ "@stylistic/no-extra-semi": "error"
464
+ }
465
+ };
466
+ const jsImportRules = {
467
+ name: "neostandard/import-x",
468
+ files: ["**/*.js", "**/*.mjs", "**/*.cjs", "**/*.jsx"],
469
+ plugins: {
470
+ "import-x": plugins["import-x"]
471
+ },
472
+ rules: {
473
+ "import-x/export": "error",
474
+ "import-x/first": "error",
475
+ "import-x/no-absolute-path": ["error", { esmodule: true, commonjs: true, amd: false }],
476
+ "import-x/no-duplicates": "error",
477
+ "import-x/no-named-default": "error",
478
+ "import-x/no-webpack-loader-syntax": "error",
479
+ // Custom rules
480
+ "import-x/no-mutable-exports": "error",
481
+ "import-x/newline-after-import": ["error", { count: 1 }],
482
+ "import-x/no-self-import": "error"
483
+ }
484
+ };
485
+ const isNonEmpty = (value) => Object.keys(value).length > 0;
486
+ const resolveIgnoresFromGitignore = () => {
487
+ const configFile = findFlatConfigFileSync();
488
+ if (!configFile) {
489
+ return [];
490
+ }
491
+ const result = [];
492
+ try {
493
+ const content = node_fs.readFileSync(node_path.join(node_path.dirname(configFile), ".gitignore"), "utf8");
494
+ for (let line of content.split("\n")) {
495
+ line = line.trim();
496
+ if (line && !line.startsWith("#")) {
497
+ result.push(gitignoreToMinimatch.gitignoreToMinimatch(line));
498
+ }
499
+ }
500
+ } catch {
501
+ }
502
+ return result;
503
+ };
504
+ function findFlatConfigFileSync() {
505
+ return findUp.findUpSync([
506
+ "eslint.config.js",
507
+ "eslint.config.mjs",
508
+ "eslint.config.cjs",
509
+ "eslint.config.ts",
510
+ "eslint.config.mts",
511
+ "eslint.config.cts"
512
+ ]);
513
+ }
514
+ function typescriptify(configs, options) {
515
+ const { files, ignores, name, project, tsconfigRootDir, typeChecking = false } = options;
516
+ const deactivatedRules = {};
517
+ const replacementRules = {};
518
+ const tsPlugin = tseslint.plugin;
519
+ for (const config of configs) {
520
+ for (const ruleId of Object.keys(tsRedundant)) {
521
+ if (config.rules?.[ruleId]) {
522
+ deactivatedRules[ruleId] = "off";
523
+ }
524
+ }
525
+ for (const [ruleId, ruleDefinition] of Object.entries(tsPlugin.rules)) {
526
+ const currentRule = config.rules?.[ruleId];
527
+ if (currentRule === void 0) {
528
+ continue;
529
+ }
530
+ if (!ruleDefinition.meta?.docs || typeof ruleDefinition.meta.docs !== "object") {
531
+ continue;
532
+ }
533
+ const docs = ruleDefinition.meta.docs;
534
+ if (!docs.extendsBaseRule) {
535
+ continue;
536
+ }
537
+ if (docs.requiresTypeChecking && !typeChecking) {
538
+ continue;
539
+ }
540
+ deactivatedRules[ruleId] = "off";
541
+ if (ruleId !== "dot-notation") {
542
+ replacementRules[`@typescript-eslint/${ruleId}`] = currentRule;
543
+ }
544
+ }
545
+ }
546
+ return {
547
+ ...name ? { name } : {},
548
+ ...files ? { files } : {},
549
+ ...ignores ? { ignores } : {},
550
+ languageOptions: {
551
+ parser: tseslint.parser,
552
+ parserOptions: {
553
+ project: project === void 0 ? typeChecking : project,
554
+ ...tsconfigRootDir ? { tsconfigRootDir } : {}
555
+ }
556
+ },
557
+ plugins: {
558
+ "@typescript-eslint": tseslint.plugin
559
+ },
560
+ rules: {
561
+ ...deactivatedRules,
562
+ ...replacementRules
563
+ }
564
+ };
565
+ }
566
+ const tsRedundant = {
567
+ "getter-return": "off",
568
+ "constructor-super": "off",
569
+ "no-const-assign": "off",
570
+ "no-dupe-args": "off",
571
+ "no-dupe-class-members": "off",
572
+ "no-dupe-keys": "off",
573
+ "no-func-assign": "off",
574
+ "no-import-assign": "off",
575
+ "no-new-native-nonconstructor": "off",
576
+ "no-obj-calls": "off",
577
+ "no-redeclare": "off",
578
+ "no-setter-return": "off",
579
+ "no-this-before-super": "off",
580
+ "no-undef": "off",
581
+ "no-unreachable": "off",
582
+ "no-unsafe-negation": "off"
583
+ };
584
+ const getJsConfigs = (opts) => {
585
+ const jsxConfigs = opts.noJsx ? [] : [jsx, ...opts.noStyle ? [] : [jsxStyles]];
586
+ const styleConfigs = opts.noStyle ? [] : [style, modernizationStyles, ...opts.semi ? [semiConfig] : []];
587
+ return [...promiseConfigs, base, modernization, ...jsxConfigs, ...styleConfigs, jsImportRules];
588
+ };
589
+ const neostandard = (options) => {
590
+ const {
591
+ env,
592
+ files: rawFiles,
593
+ filesTs,
594
+ globals: rawGlobals,
595
+ ignores,
596
+ noJsx = false,
597
+ noStyle = false,
598
+ ts = false,
599
+ semi = false
600
+ } = options || {};
601
+ if (filesTs && !ts) {
602
+ throw new Error('"filesTs" is only usable with the "ts" option');
603
+ }
604
+ const resolvedGlobals = Array.isArray(rawGlobals) ? Object.fromEntries(rawGlobals.map((global) => [global, true])) : { ...rawGlobals };
605
+ for (const key of env || []) {
606
+ if (!globals[key]) {
607
+ throw new Error(`Invalid env definition: ${env}`);
608
+ }
609
+ const envGlobals = globals[key];
610
+ for (const [name, value] of Object.entries(envGlobals)) {
611
+ resolvedGlobals[name] = resolvedGlobals[name] || value;
612
+ }
613
+ }
614
+ const files = [...rawFiles || [], ...noJsx ? [] : ["**/*.jsx"]];
615
+ const jsConfigs = getJsConfigs({ noJsx, noStyle, semi });
616
+ return [
617
+ ...ignores ? [{ ignores }] : [],
618
+ ...files.length ? [
619
+ {
620
+ name: "neostandard/additional-files",
621
+ files
622
+ }
623
+ ] : [],
624
+ ...isNonEmpty(resolvedGlobals) ? [
625
+ {
626
+ name: "neostandard/globals",
627
+ languageOptions: { globals: resolvedGlobals }
628
+ }
629
+ ] : [],
630
+ ...jsConfigs,
631
+ ...ts ? [
632
+ typescriptify(jsConfigs, {
633
+ files: ["**/*.ts", ...noJsx ? [] : ["**/*.tsx"], ...filesTs || []],
634
+ ignores,
635
+ name: "neostandard/ts"
636
+ })
637
+ ] : []
638
+ ];
639
+ };
640
+
11
641
  const rule = {
12
642
  meta: {
13
643
  type: "suggestion",
@@ -57,7 +687,7 @@ var customRules = {
57
687
  };
58
688
 
59
689
  const typescript = [
60
- ...neostandard.plugins["typescript-eslint"].configs.recommended,
690
+ ...plugins["typescript-eslint"].configs.recommended,
61
691
  {
62
692
  name: "kouts/typescript",
63
693
  rules: {
@@ -132,7 +762,7 @@ const vue = (options) => {
132
762
  const languageOptions = opts.ts ? {
133
763
  languageOptions: {
134
764
  parserOptions: {
135
- parser: neostandard.plugins["typescript-eslint"].parser
765
+ parser: plugins["typescript-eslint"].parser
136
766
  }
137
767
  }
138
768
  } : {};
@@ -216,7 +846,7 @@ const config = (options) => {
216
846
  "vendor/**",
217
847
  "dist/**",
218
848
  "public/**",
219
- ...neostandard.resolveIgnoresFromGitignore()
849
+ ...resolveIgnoresFromGitignore()
220
850
  ]
221
851
  },
222
852
  // JavaScript
@@ -244,15 +874,7 @@ const config = (options) => {
244
874
  "no-console": process.env.NODE_ENV === "production" ? "warn" : "off",
245
875
  "no-debugger": process.env.NODE_ENV === "production" ? "warn" : "off",
246
876
  // Enforce dot notation
247
- "dot-notation": ["error"],
248
- // Import rules
249
- ...opts.ts ? {
250
- "import-x/named": "off",
251
- "no-unused-vars": "off"
252
- } : {},
253
- "import-x/no-mutable-exports": "error",
254
- "import-x/newline-after-import": ["error", { count: 1 }],
255
- "import-x/no-self-import": "error"
877
+ "dot-notation": ["error"]
256
878
  }
257
879
  },
258
880
  // Sort imports
@@ -293,8 +915,5 @@ const config = (options) => {
293
915
  return linterConfig;
294
916
  };
295
917
 
296
- Object.defineProperty(exports, "plugins", {
297
- enumerable: true,
298
- get: function () { return neostandard.plugins; }
299
- });
300
918
  exports.config = config;
919
+ exports.plugins = plugins;