@ota-meshi/eslint-plugin 0.17.5 → 0.18.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/lib/config-builder/+eslint-plugin.js +2 -1
- package/lib/config-builder/+svelte.js +3 -2
- package/lib/config-builder/flatten.d.ts +1 -0
- package/lib/config-builder/flatten.js +9 -0
- package/lib/config-helpers/+eslint-plugin.js +1 -1
- package/lib/configs/+eslint-plugin.d.ts +1 -1
- package/lib/configs/+eslint-plugin.js +25 -14
- package/lib/configs/+json.d.ts +1 -1
- package/lib/configs/+md.d.ts +1 -1
- package/lib/configs/+node.d.ts +1 -1
- package/lib/configs/+package-json.d.ts +1 -1
- package/lib/configs/+prettier.d.ts +1 -1
- package/lib/configs/+prettier.js +1 -1
- package/lib/configs/+svelte-with-ts.d.ts +1 -1
- package/lib/configs/+svelte-with-ts.js +17 -7
- package/lib/configs/+svelte.d.ts +1 -1
- package/lib/configs/+toml.d.ts +1 -1
- package/lib/configs/+typescript.d.ts +1 -1
- package/lib/configs/+typescript.js +17 -7
- package/lib/configs/+vue2-with-ts.d.ts +1 -1
- package/lib/configs/+vue2-with-ts.js +17 -7
- package/lib/configs/+vue2.d.ts +1 -1
- package/lib/configs/+vue3-with-ts.d.ts +1 -1
- package/lib/configs/+vue3-with-ts.js +17 -7
- package/lib/configs/+vue3.d.ts +1 -1
- package/lib/configs/+yaml.d.ts +1 -1
- package/lib/configs/base-plugins/eslint-comments.d.ts +1 -1
- package/lib/configs/base-plugins/jsdoc.d.ts +1 -1
- package/lib/configs/base-plugins/regexp.d.ts +1 -1
- package/lib/configs/fallback.d.ts +1 -1
- package/lib/configs/json-schema/config.d.ts +1 -1
- package/lib/configs/recommended.d.ts +3 -3
- package/lib/configs/ts/base-config.d.ts +1 -1
- package/lib/utils/module.d.ts +2 -1
- package/lib/utils/module.js +42 -4
- package/package.json +12 -12
|
@@ -10,7 +10,8 @@ function buildESLintPlugin() {
|
|
|
10
10
|
const eslintPlugin = (0, module_js_1.requireFromCwd)("eslint-plugin-eslint-plugin");
|
|
11
11
|
return [
|
|
12
12
|
{
|
|
13
|
-
...eslintPlugin.configs["flat/recommended"]
|
|
13
|
+
...(eslintPlugin.configs["flat/recommended"] ||
|
|
14
|
+
eslintPlugin.configs.recommended),
|
|
14
15
|
files: _eslint_plugin_js_1.eslintPluginFiles,
|
|
15
16
|
},
|
|
16
17
|
...(0, _node_js_1.buildNode)(),
|
|
@@ -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
|
|
11
|
+
const svelteRecommended = (0, module_js_1.importFromCwd)("eslint-plugin-svelte").then((eslintPluginSvelte) => eslintPluginSvelte.configs["flat/recommended"]);
|
|
11
12
|
return [
|
|
12
|
-
...
|
|
13
|
+
...(0, flatten_js_1.flattenConfig)(svelteRecommended),
|
|
13
14
|
{
|
|
14
15
|
files: _svelte_js_1.svelteFiles,
|
|
15
16
|
rules: {
|
|
@@ -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,22 +1,33 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
const module_js_1 = require("../utils/module.js");
|
|
3
6
|
const _eslint_plugin_js_1 = require("../config-helpers/+eslint-plugin.js");
|
|
4
7
|
const fallback_js_1 = require("./fallback.js");
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
8
|
+
const semver_1 = __importDefault(require("semver"));
|
|
9
|
+
module.exports = (0, module_js_1.requireOf)(["eslint-plugin-eslint-plugin"], () => {
|
|
10
|
+
const version = (0, module_js_1.requireFromCwd)("eslint-plugin-eslint-plugin/package.json").version;
|
|
11
|
+
if (semver_1.default.satisfies(version, ">=7.0.0")) {
|
|
12
|
+
// eslint-plugin-eslint-plugin v7+ does not support legacy config
|
|
13
|
+
return {};
|
|
14
|
+
}
|
|
15
|
+
return {
|
|
16
|
+
plugins: ["eslint-plugin"],
|
|
17
|
+
overrides: [
|
|
18
|
+
{
|
|
19
|
+
files: _eslint_plugin_js_1.eslintPluginFiles,
|
|
20
|
+
extends: [
|
|
21
|
+
require.resolve("./+node"),
|
|
22
|
+
"plugin:eslint-plugin/recommended",
|
|
23
|
+
],
|
|
24
|
+
rules: {
|
|
25
|
+
..._eslint_plugin_js_1.eslintPluginExtendRules,
|
|
26
|
+
},
|
|
16
27
|
},
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
28
|
+
],
|
|
29
|
+
};
|
|
30
|
+
}, (missingList) => {
|
|
20
31
|
return {
|
|
21
32
|
overrides: [
|
|
22
33
|
{
|
package/lib/configs/+json.d.ts
CHANGED
package/lib/configs/+md.d.ts
CHANGED
package/lib/configs/+node.d.ts
CHANGED
package/lib/configs/+prettier.js
CHANGED
|
@@ -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 (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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");
|
package/lib/configs/+svelte.d.ts
CHANGED
package/lib/configs/+toml.d.ts
CHANGED
|
@@ -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 (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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"));
|
|
@@ -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 (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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");
|
package/lib/configs/+vue2.d.ts
CHANGED
|
@@ -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 (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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");
|
package/lib/configs/+vue3.d.ts
CHANGED
package/lib/configs/+yaml.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ declare const _default: {
|
|
|
5
5
|
ecmaVersion: number;
|
|
6
6
|
};
|
|
7
7
|
rules: {
|
|
8
|
-
[
|
|
8
|
+
[rule: string]: import("eslint").Linter.RuleEntry<any[]>;
|
|
9
9
|
};
|
|
10
10
|
overrides: ({
|
|
11
11
|
files: string[];
|
|
@@ -15,10 +15,10 @@ declare const _default: {
|
|
|
15
15
|
} | {
|
|
16
16
|
files: string[];
|
|
17
17
|
globals: {
|
|
18
|
-
[
|
|
18
|
+
[name: string]: import("eslint").Linter.GlobalConf;
|
|
19
19
|
};
|
|
20
20
|
rules: {
|
|
21
|
-
[
|
|
21
|
+
[rule: string]: import("eslint").Linter.RuleEntry<any[]>;
|
|
22
22
|
};
|
|
23
23
|
extends?: undefined;
|
|
24
24
|
})[];
|
package/lib/utils/module.d.ts
CHANGED
|
@@ -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.
|
|
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;
|
package/lib/utils/module.js
CHANGED
|
@@ -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;
|
|
@@ -19,7 +20,39 @@ function requireFromCwd(modulePath) {
|
|
|
19
20
|
if (!requireFunction) {
|
|
20
21
|
requireFunction = (0, module_1.createRequire)(path_1.default.join(process.cwd(), "__placeholder__.js"));
|
|
21
22
|
}
|
|
22
|
-
|
|
23
|
+
const module = requireFunction(modulePath);
|
|
24
|
+
return module.default ?? module;
|
|
25
|
+
}
|
|
26
|
+
function importFromCwd(modulePath) {
|
|
27
|
+
try {
|
|
28
|
+
return import(modulePath);
|
|
29
|
+
}
|
|
30
|
+
catch {
|
|
31
|
+
// ignore
|
|
32
|
+
}
|
|
33
|
+
const pkg = requireFromCwd(`${modulePath}/package.json`);
|
|
34
|
+
const mainPath = findMainPath(pkg);
|
|
35
|
+
if (!mainPath) {
|
|
36
|
+
throw new Error(`Cannot find main path of ${modulePath}`);
|
|
37
|
+
}
|
|
38
|
+
const moduleRootPath = path_1.default.dirname(resolveFromCwd(`${modulePath}/package.json`));
|
|
39
|
+
return import(path_1.default.join(moduleRootPath, mainPath));
|
|
40
|
+
}
|
|
41
|
+
function findMainPath(pkg) {
|
|
42
|
+
const exports = pkg.exports;
|
|
43
|
+
if (!exports) {
|
|
44
|
+
return pkg.module ?? pkg.main;
|
|
45
|
+
}
|
|
46
|
+
return findMainPathFromExports(exports);
|
|
47
|
+
}
|
|
48
|
+
function findMainPathFromExports(exports) {
|
|
49
|
+
if (typeof exports === "string") {
|
|
50
|
+
return exports;
|
|
51
|
+
}
|
|
52
|
+
if (exports?.["."]) {
|
|
53
|
+
return findMainPathFromExports(exports["."]);
|
|
54
|
+
}
|
|
55
|
+
return exports?.import ?? exports?.require ?? exports?.default;
|
|
23
56
|
}
|
|
24
57
|
function resolveFromCwd(modulePath) {
|
|
25
58
|
if (!requireFunction) {
|
|
@@ -46,8 +79,13 @@ function has(name) {
|
|
|
46
79
|
try {
|
|
47
80
|
modulePath = resolveFromCwd(moduleName);
|
|
48
81
|
}
|
|
49
|
-
catch
|
|
50
|
-
|
|
82
|
+
catch {
|
|
83
|
+
try {
|
|
84
|
+
modulePath = path_1.default.dirname(resolveFromCwd(`${moduleName}/package.json`));
|
|
85
|
+
}
|
|
86
|
+
catch {
|
|
87
|
+
return false;
|
|
88
|
+
}
|
|
51
89
|
}
|
|
52
90
|
if (version) {
|
|
53
91
|
const moduleRootPath = (0, find_root_dir_js_1.findRootDir)(modulePath);
|
|
@@ -55,7 +93,7 @@ function has(name) {
|
|
|
55
93
|
const pkg = requireFromCwd(`${moduleRootPath}/package.json`);
|
|
56
94
|
return semver_1.default.lte(version, pkg.version);
|
|
57
95
|
}
|
|
58
|
-
catch
|
|
96
|
+
catch {
|
|
59
97
|
return false;
|
|
60
98
|
}
|
|
61
99
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ota-meshi/eslint-plugin",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.18.0",
|
|
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",
|
|
@@ -35,17 +35,17 @@
|
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@eslint-community/eslint-plugin-eslint-comments": "^4.3.0",
|
|
38
|
-
"@types/eslint": "^
|
|
38
|
+
"@types/eslint": "^9.0.0",
|
|
39
39
|
"@types/eslint__js": "^8.42.3",
|
|
40
|
-
"@types/node": "^
|
|
40
|
+
"@types/node": "^22.0.0",
|
|
41
41
|
"@types/semver": "^7.5.8",
|
|
42
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
43
|
-
"@typescript-eslint/parser": "^
|
|
42
|
+
"@typescript-eslint/eslint-plugin": "^8.16.0",
|
|
43
|
+
"@typescript-eslint/parser": "^8.16.0",
|
|
44
44
|
"eslint": "^9.5.0",
|
|
45
|
-
"eslint-config-prettier": "^
|
|
45
|
+
"eslint-config-prettier": "^10.0.0",
|
|
46
46
|
"eslint-plugin-astro": "^1.0.0",
|
|
47
|
-
"eslint-plugin-eslint-plugin": "^
|
|
48
|
-
"eslint-plugin-jsdoc": "^
|
|
47
|
+
"eslint-plugin-eslint-plugin": "^7.0.0",
|
|
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
51
|
"eslint-plugin-markdown": "^5.0.0",
|
|
@@ -54,16 +54,16 @@
|
|
|
54
54
|
"eslint-plugin-prettier": "^5.0.0",
|
|
55
55
|
"eslint-plugin-regexp": "^2.5.0",
|
|
56
56
|
"eslint-plugin-svelte": "^2.36.0",
|
|
57
|
-
"eslint-plugin-toml": "^0.
|
|
57
|
+
"eslint-plugin-toml": "^0.12.0",
|
|
58
58
|
"eslint-plugin-vue": "^9.0.0",
|
|
59
59
|
"eslint-plugin-yml": "^1.0.0",
|
|
60
|
-
"mocha": "^
|
|
60
|
+
"mocha": "^11.0.0",
|
|
61
61
|
"prettier": "^3.0.0",
|
|
62
62
|
"prettier-plugin-pkg": "^0.18.0",
|
|
63
63
|
"prettier-plugin-svelte": "^3.0.0",
|
|
64
|
-
"svelte": "^
|
|
64
|
+
"svelte": "^5.0.0",
|
|
65
65
|
"typescript": "^5.0.0",
|
|
66
|
-
"typescript-eslint": "^
|
|
66
|
+
"typescript-eslint": "^8.16.0"
|
|
67
67
|
},
|
|
68
68
|
"publishConfig": {
|
|
69
69
|
"access": "public"
|