@lntvow/eslint-config 9.3.6 → 9.3.8

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
@@ -84,6 +84,47 @@ var import_local_pkg2 = require("local-pkg");
84
84
 
85
85
  // src/configs/custom.ts
86
86
  var import_eslint_plugin = __toESM(require("@lntvow/eslint-plugin"), 1);
87
+ async function custom() {
88
+ return [
89
+ {
90
+ name: "lntvow/custom",
91
+ plugins: {
92
+ lntvow: import_eslint_plugin.default
93
+ }
94
+ }
95
+ ];
96
+ }
97
+
98
+ // src/configs/gitignore.ts
99
+ var import_fs = __toESM(require("fs"), 1);
100
+ var import_find_up = require("find-up");
101
+ var import_utils = require("@lntvow/utils");
102
+ var import_parse_gitignore = __toESM(require("parse-gitignore"), 1);
103
+ async function gitignore(options) {
104
+ const { name = ".gitignore", root = false, files: _files = root ? name : (0, import_find_up.findUpSync)(name) || [] } = options;
105
+ const files = (0, import_utils.castArray)(_files);
106
+ const ignores2 = [];
107
+ for (const file of files) {
108
+ try {
109
+ const content = import_fs.default.readFileSync(file, "utf8");
110
+ const globs = (0, import_parse_gitignore.default)(content).globs();
111
+ for (const glob of globs) {
112
+ if (glob.type === "ignore") {
113
+ ignores2.push(...glob.patterns);
114
+ } else if (glob.type === "unignore") {
115
+ ignores2.push(...glob.patterns.map((pattern) => `!${pattern}`));
116
+ }
117
+ }
118
+ } catch (error) {
119
+ throw new Error(`Failed to read file: ${file}`);
120
+ }
121
+ }
122
+ return [
123
+ {
124
+ ignores: ignores2
125
+ }
126
+ ];
127
+ }
87
128
 
88
129
  // src/globs.ts
89
130
  var GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
@@ -162,56 +203,6 @@ var GLOB_EXCLUDE = [
162
203
  "**/components.d.ts"
163
204
  ];
164
205
 
165
- // src/configs/custom.ts
166
- async function custom() {
167
- return [
168
- {
169
- name: "lntvow/custom",
170
- plugins: {
171
- lntvow: import_eslint_plugin.default
172
- }
173
- },
174
- {
175
- name: "lntvow/custom/test/rules",
176
- files: [GLOB_TESTS],
177
- rules: {
178
- "lntvow/newline-before": "error"
179
- }
180
- }
181
- ];
182
- }
183
-
184
- // src/configs/gitignore.ts
185
- var import_fs = __toESM(require("fs"), 1);
186
- var import_find_up = require("find-up");
187
- var import_utils = require("@lntvow/utils");
188
- var import_parse_gitignore = __toESM(require("parse-gitignore"), 1);
189
- async function gitignore(options) {
190
- const { name = ".gitignore", root = false, files: _files = root ? name : (0, import_find_up.findUpSync)(name) || [] } = options;
191
- const files = (0, import_utils.castArray)(_files);
192
- const ignores2 = [];
193
- for (const file of files) {
194
- try {
195
- const content = import_fs.default.readFileSync(file, "utf8");
196
- const globs = (0, import_parse_gitignore.default)(content).globs();
197
- for (const glob of globs) {
198
- if (glob.type === "ignore") {
199
- ignores2.push(...glob.patterns);
200
- } else if (glob.type === "unignore") {
201
- ignores2.push(...glob.patterns.map((pattern) => `!${pattern}`));
202
- }
203
- }
204
- } catch (error) {
205
- throw new Error(`Failed to read file: ${file}`);
206
- }
207
- }
208
- return [
209
- {
210
- ignores: ignores2
211
- }
212
- ];
213
- }
214
-
215
206
  // src/configs/ignores.ts
216
207
  async function ignores() {
217
208
  return [
@@ -432,7 +423,6 @@ async function prettier() {
432
423
 
433
424
  // src/configs/regexp.ts
434
425
  var import_eslint_plugin_regexp = require("eslint-plugin-regexp");
435
- var import_eslint_plugin2 = __toESM(require("@lntvow/eslint-plugin"), 1);
436
426
  async function regexp(options = {}) {
437
427
  const { overrides } = options;
438
428
  const pluginRegexp = import_eslint_plugin_regexp.configs["flat/recommended"].plugins.regexp;
@@ -441,13 +431,11 @@ async function regexp(options = {}) {
441
431
  {
442
432
  name: "lntvow/regexp/rules",
443
433
  plugins: {
444
- regexp: pluginRegexp,
445
- lntvow: import_eslint_plugin2.default
434
+ regexp: pluginRegexp
446
435
  },
447
436
  rules: {
448
437
  // Update to eslint-plugin-regexp v2.6.0
449
438
  ...rules,
450
- // 'lntvow/newline-before': 'error',
451
439
  // Overrides
452
440
  ...overrides
453
441
  }
@@ -456,7 +444,7 @@ async function regexp(options = {}) {
456
444
  }
457
445
 
458
446
  // src/configs/stylistic.ts
459
- var import_eslint_plugin3 = __toESM(require("@stylistic/eslint-plugin"), 1);
447
+ var import_eslint_plugin2 = __toESM(require("@stylistic/eslint-plugin"), 1);
460
448
  var StylisticConfigDefaults = {
461
449
  indent: 2,
462
450
  jsx: true,
@@ -474,7 +462,7 @@ async function stylistic(options = {}) {
474
462
  ...StylisticConfigDefaults,
475
463
  ...options
476
464
  };
477
- const config = import_eslint_plugin3.default.configs.customize({
465
+ const config = import_eslint_plugin2.default.configs.customize({
478
466
  flat: true,
479
467
  indent,
480
468
  jsx,
@@ -486,7 +474,7 @@ async function stylistic(options = {}) {
486
474
  {
487
475
  name: "lntvow/stylistic/rules",
488
476
  plugins: {
489
- style: import_eslint_plugin3.default
477
+ style: import_eslint_plugin2.default
490
478
  },
491
479
  rules: {
492
480
  // ...config.rules,
@@ -515,10 +503,9 @@ async function test(options = {}) {
515
503
  plugins: {
516
504
  test: import_eslint_plugin_vitest.default
517
505
  },
518
- files: [GLOB_TESTS],
506
+ files: [...GLOB_TESTS],
519
507
  rules: {
520
- // Update to eslint-plugin-regexp v2.6.0
521
- // ...rules,
508
+ "lntvow/newline-before-describe-test": "error",
522
509
  // Overrides
523
510
  ...overrides
524
511
  }
@@ -527,7 +514,7 @@ async function test(options = {}) {
527
514
  }
528
515
 
529
516
  // src/configs/typescript.ts
530
- var import_eslint_plugin4 = __toESM(require("@typescript-eslint/eslint-plugin"), 1);
517
+ var import_eslint_plugin3 = __toESM(require("@typescript-eslint/eslint-plugin"), 1);
531
518
  var import_parser = __toESM(require("@typescript-eslint/parser"), 1);
532
519
 
533
520
  // src/utils/index.ts
@@ -551,7 +538,7 @@ async function typescript(options = {}) {
551
538
  {
552
539
  name: "lntvow/typescript/rules",
553
540
  plugins: {
554
- ts: import_eslint_plugin4.default
541
+ ts: import_eslint_plugin3.default
555
542
  },
556
543
  languageOptions: {
557
544
  parser: import_parser.default,
@@ -561,10 +548,10 @@ async function typescript(options = {}) {
561
548
  },
562
549
  files,
563
550
  rules: {
564
- ...renameRules(import_eslint_plugin4.default.configs["eslint-recommended"].overrides[0].rules, {
551
+ ...renameRules(import_eslint_plugin3.default.configs["eslint-recommended"].overrides[0].rules, {
565
552
  "@typescript-eslint": "ts"
566
553
  }),
567
- ...renameRules(import_eslint_plugin4.default.configs.strict.rules, { "@typescript-eslint": "ts" }),
554
+ ...renameRules(import_eslint_plugin3.default.configs.strict.rules, { "@typescript-eslint": "ts" }),
568
555
  // Override default configuration
569
556
  // 禁止使用!断言
570
557
  "ts/no-non-null-assertion": "off",
@@ -911,6 +898,7 @@ function lntvow(options = {}, ...userConfigs) {
911
898
  const configs2 = [];
912
899
  configs2.push(
913
900
  ignores(),
901
+ custom(),
914
902
  javascript({
915
903
  ...resolveSubOptions(options, "javascript")
916
904
  }),
@@ -955,7 +943,7 @@ function lntvow(options = {}, ...userConfigs) {
955
943
  if (Object.keys(fusedConfig).length) {
956
944
  configs2.push([fusedConfig]);
957
945
  }
958
- configs2.push(custom(), prettier());
946
+ configs2.push(prettier());
959
947
  let composer = new import_eslint_flat_config_utils.FlatConfigComposer();
960
948
  composer = composer.append(...configs2, ...userConfigs);
961
949
  if (autoRenamePlugins) {
package/dist/index.js CHANGED
@@ -5,6 +5,47 @@ import { isPackageExists } from "local-pkg";
5
5
 
6
6
  // src/configs/custom.ts
7
7
  import lntvowPlugin from "@lntvow/eslint-plugin";
8
+ async function custom() {
9
+ return [
10
+ {
11
+ name: "lntvow/custom",
12
+ plugins: {
13
+ lntvow: lntvowPlugin
14
+ }
15
+ }
16
+ ];
17
+ }
18
+
19
+ // src/configs/gitignore.ts
20
+ import fs from "fs";
21
+ import { findUpSync } from "find-up";
22
+ import { castArray } from "@lntvow/utils";
23
+ import parse from "parse-gitignore";
24
+ async function gitignore(options) {
25
+ const { name = ".gitignore", root = false, files: _files = root ? name : findUpSync(name) || [] } = options;
26
+ const files = castArray(_files);
27
+ const ignores2 = [];
28
+ for (const file of files) {
29
+ try {
30
+ const content = fs.readFileSync(file, "utf8");
31
+ const globs = parse(content).globs();
32
+ for (const glob of globs) {
33
+ if (glob.type === "ignore") {
34
+ ignores2.push(...glob.patterns);
35
+ } else if (glob.type === "unignore") {
36
+ ignores2.push(...glob.patterns.map((pattern) => `!${pattern}`));
37
+ }
38
+ }
39
+ } catch (error) {
40
+ throw new Error(`Failed to read file: ${file}`);
41
+ }
42
+ }
43
+ return [
44
+ {
45
+ ignores: ignores2
46
+ }
47
+ ];
48
+ }
8
49
 
9
50
  // src/globs.ts
10
51
  var GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
@@ -83,56 +124,6 @@ var GLOB_EXCLUDE = [
83
124
  "**/components.d.ts"
84
125
  ];
85
126
 
86
- // src/configs/custom.ts
87
- async function custom() {
88
- return [
89
- {
90
- name: "lntvow/custom",
91
- plugins: {
92
- lntvow: lntvowPlugin
93
- }
94
- },
95
- {
96
- name: "lntvow/custom/test/rules",
97
- files: [GLOB_TESTS],
98
- rules: {
99
- "lntvow/newline-before": "error"
100
- }
101
- }
102
- ];
103
- }
104
-
105
- // src/configs/gitignore.ts
106
- import fs from "fs";
107
- import { findUpSync } from "find-up";
108
- import { castArray } from "@lntvow/utils";
109
- import parse from "parse-gitignore";
110
- async function gitignore(options) {
111
- const { name = ".gitignore", root = false, files: _files = root ? name : findUpSync(name) || [] } = options;
112
- const files = castArray(_files);
113
- const ignores2 = [];
114
- for (const file of files) {
115
- try {
116
- const content = fs.readFileSync(file, "utf8");
117
- const globs = parse(content).globs();
118
- for (const glob of globs) {
119
- if (glob.type === "ignore") {
120
- ignores2.push(...glob.patterns);
121
- } else if (glob.type === "unignore") {
122
- ignores2.push(...glob.patterns.map((pattern) => `!${pattern}`));
123
- }
124
- }
125
- } catch (error) {
126
- throw new Error(`Failed to read file: ${file}`);
127
- }
128
- }
129
- return [
130
- {
131
- ignores: ignores2
132
- }
133
- ];
134
- }
135
-
136
127
  // src/configs/ignores.ts
137
128
  async function ignores() {
138
129
  return [
@@ -353,7 +344,6 @@ async function prettier() {
353
344
 
354
345
  // src/configs/regexp.ts
355
346
  import { configs } from "eslint-plugin-regexp";
356
- import lntvowPlugin2 from "@lntvow/eslint-plugin";
357
347
  async function regexp(options = {}) {
358
348
  const { overrides } = options;
359
349
  const pluginRegexp = configs["flat/recommended"].plugins.regexp;
@@ -362,13 +352,11 @@ async function regexp(options = {}) {
362
352
  {
363
353
  name: "lntvow/regexp/rules",
364
354
  plugins: {
365
- regexp: pluginRegexp,
366
- lntvow: lntvowPlugin2
355
+ regexp: pluginRegexp
367
356
  },
368
357
  rules: {
369
358
  // Update to eslint-plugin-regexp v2.6.0
370
359
  ...rules,
371
- // 'lntvow/newline-before': 'error',
372
360
  // Overrides
373
361
  ...overrides
374
362
  }
@@ -436,10 +424,9 @@ async function test(options = {}) {
436
424
  plugins: {
437
425
  test: pluginVitest
438
426
  },
439
- files: [GLOB_TESTS],
427
+ files: [...GLOB_TESTS],
440
428
  rules: {
441
- // Update to eslint-plugin-regexp v2.6.0
442
- // ...rules,
429
+ "lntvow/newline-before-describe-test": "error",
443
430
  // Overrides
444
431
  ...overrides
445
432
  }
@@ -832,6 +819,7 @@ function lntvow(options = {}, ...userConfigs) {
832
819
  const configs2 = [];
833
820
  configs2.push(
834
821
  ignores(),
822
+ custom(),
835
823
  javascript({
836
824
  ...resolveSubOptions(options, "javascript")
837
825
  }),
@@ -876,7 +864,7 @@ function lntvow(options = {}, ...userConfigs) {
876
864
  if (Object.keys(fusedConfig).length) {
877
865
  configs2.push([fusedConfig]);
878
866
  }
879
- configs2.push(custom(), prettier());
867
+ configs2.push(prettier());
880
868
  let composer = new FlatConfigComposer();
881
869
  composer = composer.append(...configs2, ...userConfigs);
882
870
  if (autoRenamePlugins) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lntvow/eslint-config",
3
- "version": "9.3.6",
3
+ "version": "9.3.8",
4
4
  "author": "lntvow",
5
5
  "description": "eslint-config",
6
6
  "type": "module",
@@ -54,7 +54,7 @@
54
54
  "tslib": "^2.6.2",
55
55
  "typescript": "^5.4.5",
56
56
  "vue-eslint-parser": "^9.4.2",
57
- "@lntvow/eslint-plugin": "^9.3.6"
57
+ "@lntvow/eslint-plugin": "^9.3.8"
58
58
  },
59
59
  "scripts": {
60
60
  "dev": "pnpm build --format esm --watch",