@ota-meshi/eslint-plugin 0.17.4 → 0.17.6

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.
Files changed (56) hide show
  1. package/lib/config-builder/+astro-with-ts.d.ts +1 -1
  2. package/lib/config-builder/+astro.d.ts +1 -1
  3. package/lib/config-builder/+eslint-plugin.d.ts +1 -1
  4. package/lib/config-builder/+json.d.ts +1 -1
  5. package/lib/config-builder/+md.d.ts +1 -1
  6. package/lib/config-builder/+node.d.ts +1 -1
  7. package/lib/config-builder/+package-json.d.ts +1 -1
  8. package/lib/config-builder/+prettier.d.ts +1 -1
  9. package/lib/config-builder/+svelte-with-ts.d.ts +1 -1
  10. package/lib/config-builder/+svelte.d.ts +1 -1
  11. package/lib/config-builder/+svelte.js +3 -2
  12. package/lib/config-builder/+toml.d.ts +1 -1
  13. package/lib/config-builder/+vue2-with-ts.d.ts +1 -1
  14. package/lib/config-builder/+vue2.d.ts +1 -1
  15. package/lib/config-builder/+vue3-with-ts.d.ts +1 -1
  16. package/lib/config-builder/+vue3.d.ts +1 -1
  17. package/lib/config-builder/+yaml.d.ts +1 -1
  18. package/lib/config-builder/base-plugins/eslint-comments.d.ts +1 -1
  19. package/lib/config-builder/base-plugins/jsdoc.d.ts +1 -1
  20. package/lib/config-builder/base-plugins/regexp.d.ts +1 -1
  21. package/lib/config-builder/flatten.d.ts +1 -0
  22. package/lib/config-builder/flatten.js +9 -0
  23. package/lib/config-builder/plugins/json-schema.d.ts +1 -1
  24. package/lib/config-builder/plugins/json-schema.js +11 -1
  25. package/lib/config-builder/plugins/ts/base-config.d.ts +1 -1
  26. package/lib/config-helpers/+eslint-plugin.js +1 -1
  27. package/lib/configs/+eslint-plugin.d.ts +1 -1
  28. package/lib/configs/+json.d.ts +1 -1
  29. package/lib/configs/+md.d.ts +1 -1
  30. package/lib/configs/+node.d.ts +1 -1
  31. package/lib/configs/+package-json.d.ts +1 -1
  32. package/lib/configs/+prettier.d.ts +1 -1
  33. package/lib/configs/+prettier.js +1 -1
  34. package/lib/configs/+svelte-with-ts.d.ts +1 -1
  35. package/lib/configs/+svelte-with-ts.js +17 -7
  36. package/lib/configs/+svelte.d.ts +1 -1
  37. package/lib/configs/+toml.d.ts +1 -1
  38. package/lib/configs/+typescript.d.ts +1 -1
  39. package/lib/configs/+typescript.js +17 -7
  40. package/lib/configs/+vue2-with-ts.d.ts +1 -1
  41. package/lib/configs/+vue2-with-ts.js +17 -7
  42. package/lib/configs/+vue2.d.ts +1 -1
  43. package/lib/configs/+vue3-with-ts.d.ts +1 -1
  44. package/lib/configs/+vue3-with-ts.js +17 -7
  45. package/lib/configs/+vue3.d.ts +1 -1
  46. package/lib/configs/+yaml.d.ts +1 -1
  47. package/lib/configs/base-plugins/eslint-comments.d.ts +1 -1
  48. package/lib/configs/base-plugins/jsdoc.d.ts +1 -1
  49. package/lib/configs/base-plugins/regexp.d.ts +1 -1
  50. package/lib/configs/fallback.d.ts +1 -1
  51. package/lib/configs/json-schema/config.d.ts +1 -1
  52. package/lib/configs/recommended.d.ts +1 -1
  53. package/lib/index.d.ts +1 -1
  54. package/lib/utils/module.d.ts +2 -1
  55. package/lib/utils/module.js +40 -3
  56. package/package.json +10 -10
@@ -1,2 +1,2 @@
1
1
  import type { Linter } from "eslint";
2
- export declare function buildAstroTs(): Linter.FlatConfig<Linter.RulesRecord>[];
2
+ export declare function buildAstroTs(): Linter.FlatConfig[];
@@ -1,2 +1,2 @@
1
1
  import type { Linter } from "eslint";
2
- export declare function buildAstro(): Linter.FlatConfig<Linter.RulesRecord>[];
2
+ export declare function buildAstro(): Linter.FlatConfig[];
@@ -1,2 +1,2 @@
1
1
  import type { Linter } from "eslint";
2
- export declare function buildESLintPlugin(): Linter.FlatConfig<Linter.RulesRecord>[];
2
+ export declare function buildESLintPlugin(): Linter.FlatConfig[];
@@ -1,2 +1,2 @@
1
1
  import type { Linter } from "eslint";
2
- export declare function buildJson(): Linter.FlatConfig<Linter.RulesRecord>[];
2
+ export declare function buildJson(): Linter.FlatConfig[];
@@ -1,2 +1,2 @@
1
1
  import type { Linter } from "eslint";
2
- export declare function buildMd(): Linter.FlatConfig<Linter.RulesRecord>[];
2
+ export declare function buildMd(): Linter.FlatConfig[];
@@ -1,2 +1,2 @@
1
1
  import type { Linter } from "eslint";
2
- export declare function buildNode(): Linter.FlatConfig<Linter.RulesRecord>[];
2
+ export declare function buildNode(): Linter.FlatConfig[];
@@ -1,2 +1,2 @@
1
1
  import type { Linter } from "eslint";
2
- export declare function buildPackageJson(): Linter.FlatConfig<Linter.RulesRecord>[];
2
+ export declare function buildPackageJson(): Linter.FlatConfig[];
@@ -1,2 +1,2 @@
1
1
  import type { Linter } from "eslint";
2
- export declare function buildPrettier(): Linter.FlatConfig<Linter.RulesRecord>[];
2
+ export declare function buildPrettier(): Linter.FlatConfig[];
@@ -1,2 +1,2 @@
1
1
  import type { Linter } from "eslint";
2
- export declare function buildSvelteTs(): Linter.FlatConfig<Linter.RulesRecord>[];
2
+ export declare function buildSvelteTs(): Linter.FlatConfig[];
@@ -1,2 +1,2 @@
1
1
  import type { Linter } from "eslint";
2
- export declare function buildSvelte(): Linter.FlatConfig<Linter.RulesRecord>[];
2
+ export declare function buildSvelte(): Linter.FlatConfig[];
@@ -5,11 +5,12 @@ const _svelte_js_1 = require("../config-helpers/+svelte.js");
5
5
  const module_js_1 = require("../utils/module.js");
6
6
  const fallback_js_1 = require("./fallback.js");
7
7
  const any_parser_js_1 = require("../parsers/any-parser.js");
8
+ const flatten_js_1 = require("./flatten.js");
8
9
  function buildSvelte() {
9
10
  return (0, module_js_1.requireOf)(["eslint-plugin-svelte@2.9.0"], () => {
10
- const eslintPluginSvelte = (0, module_js_1.requireFromCwd)("eslint-plugin-svelte");
11
+ const svelteRecommended = (0, module_js_1.importFromCwd)("eslint-plugin-svelte").then((eslintPluginSvelte) => eslintPluginSvelte.configs["flat/recommended"]);
11
12
  return [
12
- ...eslintPluginSvelte.configs["flat/recommended"],
13
+ ...(0, flatten_js_1.flattenConfig)(svelteRecommended),
13
14
  {
14
15
  files: _svelte_js_1.svelteFiles,
15
16
  rules: {
@@ -1,2 +1,2 @@
1
1
  import type { Linter } from "eslint";
2
- export declare function buildToml(): Linter.FlatConfig<Linter.RulesRecord>[];
2
+ export declare function buildToml(): Linter.FlatConfig[];
@@ -1,2 +1,2 @@
1
1
  import type { Linter } from "eslint";
2
- export declare function buildVue2Ts(): Linter.FlatConfig<Linter.RulesRecord>[];
2
+ export declare function buildVue2Ts(): Linter.FlatConfig[];
@@ -1,2 +1,2 @@
1
1
  import type { Linter } from "eslint";
2
- export declare function buildVue2(): Linter.FlatConfig<Linter.RulesRecord>[];
2
+ export declare function buildVue2(): Linter.FlatConfig[];
@@ -1,2 +1,2 @@
1
1
  import type { Linter } from "eslint";
2
- export declare function buildVue3Ts(): Linter.FlatConfig<Linter.RulesRecord>[];
2
+ export declare function buildVue3Ts(): Linter.FlatConfig[];
@@ -1,2 +1,2 @@
1
1
  import type { Linter } from "eslint";
2
- export declare function buildVue3(): Linter.FlatConfig<Linter.RulesRecord>[];
2
+ export declare function buildVue3(): Linter.FlatConfig[];
@@ -1,2 +1,2 @@
1
1
  import type { Linter } from "eslint";
2
- export declare function buildYaml(): Linter.FlatConfig<Linter.RulesRecord>[];
2
+ export declare function buildYaml(): Linter.FlatConfig[];
@@ -1,2 +1,2 @@
1
1
  import type { Linter } from "eslint";
2
- export declare function buildESLintComments(): Linter.FlatConfig<Linter.RulesRecord>[];
2
+ export declare function buildESLintComments(): Linter.FlatConfig[];
@@ -1,2 +1,2 @@
1
1
  import type { Linter } from "eslint";
2
- export declare function buildJsdoc(): Linter.FlatConfig<Linter.RulesRecord>[];
2
+ export declare function buildJsdoc(): Linter.FlatConfig[];
@@ -1,2 +1,2 @@
1
1
  import type { Linter } from "eslint";
2
- export declare function buildRegexp(): Linter.FlatConfig<Linter.RulesRecord>[];
2
+ export declare function buildRegexp(): Linter.FlatConfig[];
@@ -0,0 +1 @@
1
+ export declare function flattenConfig(config: Promise<any>): any;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.flattenConfig = flattenConfig;
4
+ function* flattenConfig(config) {
5
+ for (let index = 0; index < 15; index++) {
6
+ const i = index;
7
+ yield config.then((configs) => configs[i] || {});
8
+ }
9
+ }
@@ -1,2 +1,2 @@
1
1
  import type { Linter } from "eslint";
2
- export declare function buildJsonSchema(files: string[]): Linter.FlatConfig<Linter.RulesRecord>[];
2
+ export declare function buildJsonSchema(files: string[]): Linter.FlatConfig[];
@@ -9,7 +9,17 @@ function buildJsonSchema(files) {
9
9
  return (0, module_js_1.requireOf)(["eslint-plugin-json-schema-validator@5.0.0"], () => {
10
10
  const eslintPluginJsonSchemaValidator = (0, module_js_1.requireFromCwd)("eslint-plugin-json-schema-validator");
11
11
  return [
12
- ...eslintPluginJsonSchemaValidator.configs["flat/recommended"].map((config) => ({ files, ...config })),
12
+ ...eslintPluginJsonSchemaValidator.configs["flat/recommended"].map((config) => {
13
+ if (config.files == null) {
14
+ return { ...config, files };
15
+ }
16
+ if (config.files
17
+ .flat()
18
+ .some((file) => files.some((suffix) => file.endsWith(suffix)))) {
19
+ return config;
20
+ }
21
+ return { files };
22
+ }),
13
23
  {
14
24
  files,
15
25
  rules: {
@@ -1,2 +1,2 @@
1
1
  import type { Linter } from "eslint";
2
- export declare function buildTS(files: string[]): Linter.FlatConfig<Linter.RulesRecord>[];
2
+ export declare function buildTS(files: string[]): Linter.FlatConfig[];
@@ -72,7 +72,7 @@ function rulesDocumentUrl() {
72
72
  return `${baseUrl}/blob/v${version}/docs/rules/{{name}}.md`;
73
73
  }
74
74
  }
75
- catch (_error) {
75
+ catch {
76
76
  // ignore
77
77
  }
78
78
  return undefined;
@@ -1,3 +1,3 @@
1
1
  import type { Linter } from "eslint";
2
- declare const _default: Linter.Config<Linter.RulesRecord, Linter.RulesRecord>;
2
+ declare const _default: Linter.LegacyConfig<Linter.RulesRecord, Linter.RulesRecord>;
3
3
  export = _default;
@@ -1,3 +1,3 @@
1
1
  import type { Linter } from "eslint";
2
- declare const _default: Linter.Config<Linter.RulesRecord, Linter.RulesRecord>;
2
+ declare const _default: Linter.LegacyConfig<Linter.RulesRecord, Linter.RulesRecord>;
3
3
  export = _default;
@@ -1,3 +1,3 @@
1
1
  import type { Linter } from "eslint";
2
- declare const _default: Linter.Config<Linter.RulesRecord, Linter.RulesRecord>;
2
+ declare const _default: Linter.LegacyConfig<Linter.RulesRecord, Linter.RulesRecord>;
3
3
  export = _default;
@@ -1,3 +1,3 @@
1
1
  import type { Linter } from "eslint";
2
- declare const _default: Linter.Config<Linter.RulesRecord, Linter.RulesRecord>;
2
+ declare const _default: Linter.LegacyConfig<Linter.RulesRecord, Linter.RulesRecord>;
3
3
  export = _default;
@@ -1,3 +1,3 @@
1
1
  import type { Linter } from "eslint";
2
- declare const _default: Linter.Config<Linter.RulesRecord, Linter.RulesRecord>;
2
+ declare const _default: Linter.LegacyConfig<Linter.RulesRecord, Linter.RulesRecord>;
3
3
  export = _default;
@@ -1,3 +1,3 @@
1
1
  import type { Linter } from "eslint";
2
- declare const _default: Linter.Config<Linter.RulesRecord, Linter.RulesRecord>;
2
+ declare const _default: Linter.LegacyConfig<Linter.RulesRecord, Linter.RulesRecord>;
3
3
  export = _default;
@@ -7,7 +7,7 @@ function getConfigArrayIfHasConfig(config) {
7
7
  const configPath = (0, module_js_1.resolveFromCwd)(`eslint-config-${config}`);
8
8
  (0, module_js_1.requireFromCwd)(configPath);
9
9
  }
10
- catch (_e) {
10
+ catch {
11
11
  return [];
12
12
  }
13
13
  return [config];
@@ -1,3 +1,3 @@
1
1
  import type { Linter } from "eslint";
2
- declare const _default: Linter.Config<Linter.RulesRecord, Linter.RulesRecord>;
2
+ declare const _default: Linter.LegacyConfig<Linter.RulesRecord, Linter.RulesRecord>;
3
3
  export = _default;
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  const module_js_1 = require("../utils/module.js");
26
36
  const base = __importStar(require("./ts/base-config.js"));
27
37
  const _svelte_js_1 = require("../config-helpers/+svelte.js");
@@ -1,3 +1,3 @@
1
1
  import type { Linter } from "eslint";
2
- declare const _default: Linter.Config<Linter.RulesRecord, Linter.RulesRecord>;
2
+ declare const _default: Linter.LegacyConfig<Linter.RulesRecord, Linter.RulesRecord>;
3
3
  export = _default;
@@ -1,3 +1,3 @@
1
1
  import type { Linter } from "eslint";
2
- declare const _default: Linter.Config<Linter.RulesRecord, Linter.RulesRecord>;
2
+ declare const _default: Linter.LegacyConfig<Linter.RulesRecord, Linter.RulesRecord>;
3
3
  export = _default;
@@ -1,3 +1,3 @@
1
1
  import type { Linter } from "eslint";
2
- declare const _default: Linter.Config<Linter.RulesRecord, Linter.RulesRecord>;
2
+ declare const _default: Linter.LegacyConfig<Linter.RulesRecord, Linter.RulesRecord>;
3
3
  export = _default;
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  const _typescript_js_1 = require("../config-helpers/+typescript.js");
26
36
  const module_js_1 = require("../utils/module.js");
27
37
  const base = __importStar(require("./ts/base-config.js"));
@@ -1,3 +1,3 @@
1
1
  import type { Linter } from "eslint";
2
- declare const _default: Linter.Config<Linter.RulesRecord, Linter.RulesRecord>;
2
+ declare const _default: Linter.LegacyConfig<Linter.RulesRecord, Linter.RulesRecord>;
3
3
  export = _default;
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  const _vue_js_1 = require("../config-helpers/+vue.js");
26
36
  const module_js_1 = require("../utils/module.js");
27
37
  const fallback_js_1 = require("./fallback.js");
@@ -1,3 +1,3 @@
1
1
  import type { Linter } from "eslint";
2
- declare const _default: Linter.Config<Linter.RulesRecord, Linter.RulesRecord>;
2
+ declare const _default: Linter.LegacyConfig<Linter.RulesRecord, Linter.RulesRecord>;
3
3
  export = _default;
@@ -1,3 +1,3 @@
1
1
  import type { Linter } from "eslint";
2
- declare const _default: Linter.Config<Linter.RulesRecord, Linter.RulesRecord>;
2
+ declare const _default: Linter.LegacyConfig<Linter.RulesRecord, Linter.RulesRecord>;
3
3
  export = _default;
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  const _vue_js_1 = require("../config-helpers/+vue.js");
26
36
  const module_js_1 = require("../utils/module.js");
27
37
  const fallback_js_1 = require("./fallback.js");
@@ -1,3 +1,3 @@
1
1
  import type { Linter } from "eslint";
2
- declare const _default: Linter.Config<Linter.RulesRecord, Linter.RulesRecord>;
2
+ declare const _default: Linter.LegacyConfig<Linter.RulesRecord, Linter.RulesRecord>;
3
3
  export = _default;
@@ -1,3 +1,3 @@
1
1
  import type { Linter } from "eslint";
2
- declare const _default: Linter.Config<Linter.RulesRecord, Linter.RulesRecord>;
2
+ declare const _default: Linter.LegacyConfig<Linter.RulesRecord, Linter.RulesRecord>;
3
3
  export = _default;
@@ -1,3 +1,3 @@
1
1
  import type { Linter } from "eslint";
2
- declare const _default: Linter.Config<Linter.RulesRecord, Linter.RulesRecord>;
2
+ declare const _default: Linter.LegacyConfig<Linter.RulesRecord, Linter.RulesRecord>;
3
3
  export = _default;
@@ -1,3 +1,3 @@
1
1
  import type { Linter } from "eslint";
2
- declare const _default: Linter.Config<Linter.RulesRecord, Linter.RulesRecord>;
2
+ declare const _default: Linter.LegacyConfig<Linter.RulesRecord, Linter.RulesRecord>;
3
3
  export = _default;
@@ -1,3 +1,3 @@
1
1
  import type { Linter } from "eslint";
2
- declare const _default: Linter.Config<Linter.RulesRecord, Linter.RulesRecord>;
2
+ declare const _default: Linter.LegacyConfig<Linter.RulesRecord, Linter.RulesRecord>;
3
3
  export = _default;
@@ -2,4 +2,4 @@ import type { Linter } from "eslint";
2
2
  /**
3
3
  * Fallback Legacy config builder
4
4
  */
5
- export declare function buildFallbackForLegacy(missingList: string[]): Linter.Config;
5
+ export declare function buildFallbackForLegacy(missingList: string[]): Linter.LegacyConfig;
@@ -1,3 +1,3 @@
1
1
  import type { Linter } from "eslint";
2
- declare const _default: Linter.Config<Linter.RulesRecord, Linter.RulesRecord>;
2
+ declare const _default: Linter.LegacyConfig<Linter.RulesRecord, Linter.RulesRecord>;
3
3
  export = _default;
@@ -15,7 +15,7 @@ declare const _default: {
15
15
  } | {
16
16
  files: string[];
17
17
  globals: {
18
- [x: string]: boolean | "off" | "writable" | "readonly";
18
+ [x: string]: import("eslint").Linter.GlobalConf;
19
19
  };
20
20
  rules: {
21
21
  [x: string]: import("eslint").Linter.RuleEntry<any[]>;
package/lib/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { BuildConfigOptions } from "./config-builder/index.js";
2
- export declare function config(options?: BuildConfigOptions): import("eslint").Linter.FlatConfig<import("eslint").Linter.RulesRecord>[];
2
+ export declare function config(options?: BuildConfigOptions): import("eslint").Linter.FlatConfig[];
3
3
  export declare const configs: {
4
4
  recommended: any;
5
5
  "+eslint-plugin": any;
@@ -1,5 +1,6 @@
1
1
  import type { Linter } from "eslint";
2
2
  export declare function requireFromCwd(modulePath: string): any;
3
+ export declare function importFromCwd(modulePath: string): Promise<any>;
3
4
  export declare function resolveFromCwd(modulePath: string): string;
4
5
  export declare function parseModule(name: string): {
5
6
  moduleName: string;
@@ -15,5 +16,5 @@ export declare function has(name: string): boolean;
15
16
  /**
16
17
  * Checks exists module and return config
17
18
  */
18
- export declare function requireOf<C extends Linter.FlatConfig[] | Linter.Config>(names: string[], getConfig: () => C, fallback: (missingList: string[]) => C): C;
19
+ export declare function requireOf<C extends Linter.Config[] | Linter.LegacyConfig>(names: string[], getConfig: () => C, fallback: (missingList: string[]) => C): C;
19
20
  export declare function tryInstall(moduleName: string, targetFile?: string): string | null;
@@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.requireFromCwd = requireFromCwd;
7
+ exports.importFromCwd = importFromCwd;
7
8
  exports.resolveFromCwd = resolveFromCwd;
8
9
  exports.parseModule = parseModule;
9
10
  exports.has = has;
@@ -21,6 +22,37 @@ function requireFromCwd(modulePath) {
21
22
  }
22
23
  return requireFunction(modulePath);
23
24
  }
25
+ function importFromCwd(modulePath) {
26
+ try {
27
+ return import(modulePath);
28
+ }
29
+ catch {
30
+ // ignore
31
+ }
32
+ const pkg = requireFromCwd(`${modulePath}/package.json`);
33
+ const mainPath = findMainPath(pkg);
34
+ if (!mainPath) {
35
+ throw new Error(`Cannot find main path of ${modulePath}`);
36
+ }
37
+ const moduleRootPath = path_1.default.dirname(resolveFromCwd(`${modulePath}/package.json`));
38
+ return import(path_1.default.join(moduleRootPath, mainPath));
39
+ }
40
+ function findMainPath(pkg) {
41
+ const exports = pkg.exports;
42
+ if (!exports) {
43
+ return pkg.module ?? pkg.main;
44
+ }
45
+ return findMainPathFromExports(exports);
46
+ }
47
+ function findMainPathFromExports(exports) {
48
+ if (typeof exports === "string") {
49
+ return exports;
50
+ }
51
+ if (exports?.["."]) {
52
+ return findMainPathFromExports(exports["."]);
53
+ }
54
+ return exports?.import ?? exports?.require ?? exports?.default;
55
+ }
24
56
  function resolveFromCwd(modulePath) {
25
57
  if (!requireFunction) {
26
58
  requireFunction = (0, module_1.createRequire)(path_1.default.join(process.cwd(), "__placeholder__.js"));
@@ -46,8 +78,13 @@ function has(name) {
46
78
  try {
47
79
  modulePath = resolveFromCwd(moduleName);
48
80
  }
49
- catch (_e) {
50
- return false;
81
+ catch {
82
+ try {
83
+ modulePath = path_1.default.dirname(resolveFromCwd(`${moduleName}/package.json`));
84
+ }
85
+ catch {
86
+ return false;
87
+ }
51
88
  }
52
89
  if (version) {
53
90
  const moduleRootPath = (0, find_root_dir_js_1.findRootDir)(modulePath);
@@ -55,7 +92,7 @@ function has(name) {
55
92
  const pkg = requireFromCwd(`${moduleRootPath}/package.json`);
56
93
  return semver_1.default.lte(version, pkg.version);
57
94
  }
58
- catch (_e) {
95
+ catch {
59
96
  return false;
60
97
  }
61
98
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ota-meshi/eslint-plugin",
3
- "version": "0.17.4",
3
+ "version": "0.17.6",
4
4
  "description": "ESLint configuration plugin for me.",
5
5
  "repository": "git+https://github.com/ota-meshi/eslint-plugin.git",
6
6
  "homepage": "https://github.com/ota-meshi/eslint-plugin#readme",
@@ -22,7 +22,7 @@
22
22
  "lint": "eslint .",
23
23
  "lint:fix": "eslint . --fix",
24
24
  "pretest": "yarn build",
25
- "test": "mocha \"tests/lib/**/*.js\" --reporter dot --timeout 60000"
25
+ "test": "mocha \"tests/lib/**/*.{js,mjs}\" --reporter dot --timeout 60000"
26
26
  },
27
27
  "peerDependencies": {
28
28
  "@eslint-community/eslint-plugin-eslint-comments": "^4.3.0",
@@ -30,7 +30,7 @@
30
30
  "eslint-plugin-regexp": "^2.5.0"
31
31
  },
32
32
  "dependencies": {
33
- "@eslint/js": "^9.0.0",
33
+ "@eslint/js": "^9.5.0",
34
34
  "semver": "^7.3.4"
35
35
  },
36
36
  "devDependencies": {
@@ -39,16 +39,16 @@
39
39
  "@types/eslint__js": "^8.42.3",
40
40
  "@types/node": "^20.12.7",
41
41
  "@types/semver": "^7.5.8",
42
- "@typescript-eslint/eslint-plugin": "^7.0.0",
43
- "@typescript-eslint/parser": "^7.0.0",
44
- "eslint": "^8.0.0",
42
+ "@typescript-eslint/eslint-plugin": "^8.16.0",
43
+ "@typescript-eslint/parser": "^8.16.0",
44
+ "eslint": "^9.5.0",
45
45
  "eslint-config-prettier": "^9.0.0",
46
- "eslint-plugin-astro": "^0.34.0",
46
+ "eslint-plugin-astro": "^1.0.0",
47
47
  "eslint-plugin-eslint-plugin": "^6.0.0",
48
- "eslint-plugin-jsdoc": "^48.2.3",
48
+ "eslint-plugin-jsdoc": "^50.0.0",
49
49
  "eslint-plugin-json-schema-validator": "^5.0.0",
50
50
  "eslint-plugin-jsonc": "^2.0.0",
51
- "eslint-plugin-markdown": "^4.0.0",
51
+ "eslint-plugin-markdown": "^5.0.0",
52
52
  "eslint-plugin-n": "^17.0.0",
53
53
  "eslint-plugin-node-dependencies": "^0.12.0",
54
54
  "eslint-plugin-prettier": "^5.0.0",
@@ -63,7 +63,7 @@
63
63
  "prettier-plugin-svelte": "^3.0.0",
64
64
  "svelte": "^4.0.0",
65
65
  "typescript": "^5.0.0",
66
- "typescript-eslint": "^7.6.0"
66
+ "typescript-eslint": "^8.16.0"
67
67
  },
68
68
  "publishConfig": {
69
69
  "access": "public"