@rotki/eslint-config 2.5.0 → 2.6.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.cjs +53 -3
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +53 -3
- package/package.json +16 -16
package/dist/index.cjs
CHANGED
|
@@ -99,7 +99,7 @@ var import_local_pkg2 = require("local-pkg");
|
|
|
99
99
|
// src/plugins.ts
|
|
100
100
|
var import_eslint_plugin_antfu = __toESM(require("eslint-plugin-antfu"), 1);
|
|
101
101
|
var import_eslint_plugin_eslint_comments = __toESM(require("eslint-plugin-eslint-comments"), 1);
|
|
102
|
-
var pluginImport = __toESM(require("eslint-plugin-
|
|
102
|
+
var pluginImport = __toESM(require("eslint-plugin-import-x"), 1);
|
|
103
103
|
var import_eslint_plugin_n = __toESM(require("eslint-plugin-n"), 1);
|
|
104
104
|
var import_eslint_plugin_unicorn = __toESM(require("eslint-plugin-unicorn"), 1);
|
|
105
105
|
var import_eslint_plugin_unused_imports = __toESM(require("eslint-plugin-unused-imports"), 1);
|
|
@@ -180,6 +180,34 @@ async function ensurePackages(packages) {
|
|
|
180
180
|
if (result)
|
|
181
181
|
await import("@antfu/install-pkg").then((i) => i.installPackage(nonExistingPackages, { dev: true }));
|
|
182
182
|
}
|
|
183
|
+
function renameRules(rules, map) {
|
|
184
|
+
return Object.fromEntries(
|
|
185
|
+
Object.entries(rules).map(([key, value]) => {
|
|
186
|
+
for (const [from, to] of Object.entries(map)) {
|
|
187
|
+
if (key.startsWith(`${from}/`))
|
|
188
|
+
return [to + key.slice(from.length), value];
|
|
189
|
+
}
|
|
190
|
+
return [key, value];
|
|
191
|
+
})
|
|
192
|
+
);
|
|
193
|
+
}
|
|
194
|
+
function renamePluginInConfigs(configs, map) {
|
|
195
|
+
return configs.map((i) => {
|
|
196
|
+
const clone = { ...i };
|
|
197
|
+
if (clone.rules)
|
|
198
|
+
clone.rules = renameRules(clone.rules, map);
|
|
199
|
+
if (clone.plugins) {
|
|
200
|
+
clone.plugins = Object.fromEntries(
|
|
201
|
+
Object.entries(clone.plugins).map(([key, value]) => {
|
|
202
|
+
if (key in map)
|
|
203
|
+
return [map[key], value];
|
|
204
|
+
return [key, value];
|
|
205
|
+
})
|
|
206
|
+
);
|
|
207
|
+
}
|
|
208
|
+
return clone;
|
|
209
|
+
});
|
|
210
|
+
}
|
|
183
211
|
|
|
184
212
|
// src/globs.ts
|
|
185
213
|
var GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
|
|
@@ -1159,6 +1187,22 @@ function sortPackageJson() {
|
|
|
1159
1187
|
{
|
|
1160
1188
|
order: ["types", "require", "import", "default"],
|
|
1161
1189
|
pathPattern: "^exports.*$"
|
|
1190
|
+
},
|
|
1191
|
+
{
|
|
1192
|
+
order: [
|
|
1193
|
+
// client hooks only
|
|
1194
|
+
"pre-commit",
|
|
1195
|
+
"prepare-commit-msg",
|
|
1196
|
+
"commit-msg",
|
|
1197
|
+
"post-commit",
|
|
1198
|
+
"pre-rebase",
|
|
1199
|
+
"post-rewrite",
|
|
1200
|
+
"post-checkout",
|
|
1201
|
+
"post-merge",
|
|
1202
|
+
"pre-push",
|
|
1203
|
+
"pre-auto-gc"
|
|
1204
|
+
],
|
|
1205
|
+
pathPattern: "^(?:gitHooks|husky|simple-git-hooks)$"
|
|
1162
1206
|
}
|
|
1163
1207
|
]
|
|
1164
1208
|
}
|
|
@@ -2115,6 +2159,12 @@ var VuePackages = [
|
|
|
2115
2159
|
"vitepress",
|
|
2116
2160
|
"@slidev/cli"
|
|
2117
2161
|
];
|
|
2162
|
+
var defaultPluginRenaming = {
|
|
2163
|
+
"import-x": "import",
|
|
2164
|
+
"n": "node",
|
|
2165
|
+
"vitest": "test",
|
|
2166
|
+
"yml": "yaml"
|
|
2167
|
+
};
|
|
2118
2168
|
async function rotki(options = {}, ...userConfigs) {
|
|
2119
2169
|
const {
|
|
2120
2170
|
componentExts = [],
|
|
@@ -2254,11 +2304,11 @@ async function rotki(options = {}, ...userConfigs) {
|
|
|
2254
2304
|
}, {});
|
|
2255
2305
|
if (Object.keys(fusedConfig).length > 0)
|
|
2256
2306
|
configs.push([fusedConfig]);
|
|
2257
|
-
const merged = combine(
|
|
2307
|
+
const merged = await combine(
|
|
2258
2308
|
...configs,
|
|
2259
2309
|
...userConfigs
|
|
2260
2310
|
);
|
|
2261
|
-
return merged;
|
|
2311
|
+
return renamePluginInConfigs(merged, defaultPluginRenaming);
|
|
2262
2312
|
}
|
|
2263
2313
|
function resolveSubOptions(options, key) {
|
|
2264
2314
|
return typeof options[key] === "boolean" ? {} : options[key] || {};
|
package/dist/index.d.cts
CHANGED
|
@@ -9,8 +9,8 @@ import { Rules as Rules$1 } from 'eslint-plugin-antfu';
|
|
|
9
9
|
export { default as pluginAntfu } from 'eslint-plugin-antfu';
|
|
10
10
|
import { StylisticCustomizeOptions, UnprefixedRuleOptions } from '@stylistic/eslint-plugin';
|
|
11
11
|
export { default as pluginComments } from 'eslint-plugin-eslint-comments';
|
|
12
|
-
import * as
|
|
13
|
-
export {
|
|
12
|
+
import * as eslintPluginImportX from 'eslint-plugin-import-x';
|
|
13
|
+
export { eslintPluginImportX as pluginImport };
|
|
14
14
|
export { default as pluginNode } from 'eslint-plugin-n';
|
|
15
15
|
export { default as pluginUnicorn } from 'eslint-plugin-unicorn';
|
|
16
16
|
export { default as pluginUnusedImports } from 'eslint-plugin-unused-imports';
|
package/dist/index.d.ts
CHANGED
|
@@ -9,8 +9,8 @@ import { Rules as Rules$1 } from 'eslint-plugin-antfu';
|
|
|
9
9
|
export { default as pluginAntfu } from 'eslint-plugin-antfu';
|
|
10
10
|
import { StylisticCustomizeOptions, UnprefixedRuleOptions } from '@stylistic/eslint-plugin';
|
|
11
11
|
export { default as pluginComments } from 'eslint-plugin-eslint-comments';
|
|
12
|
-
import * as
|
|
13
|
-
export {
|
|
12
|
+
import * as eslintPluginImportX from 'eslint-plugin-import-x';
|
|
13
|
+
export { eslintPluginImportX as pluginImport };
|
|
14
14
|
export { default as pluginNode } from 'eslint-plugin-n';
|
|
15
15
|
export { default as pluginUnicorn } from 'eslint-plugin-unicorn';
|
|
16
16
|
export { default as pluginUnusedImports } from 'eslint-plugin-unused-imports';
|
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import { isPackageExists as isPackageExists2 } from "local-pkg";
|
|
|
6
6
|
// src/plugins.ts
|
|
7
7
|
import { default as default2 } from "eslint-plugin-antfu";
|
|
8
8
|
import { default as default3 } from "eslint-plugin-eslint-comments";
|
|
9
|
-
import * as pluginImport from "eslint-plugin-
|
|
9
|
+
import * as pluginImport from "eslint-plugin-import-x";
|
|
10
10
|
import { default as default4 } from "eslint-plugin-n";
|
|
11
11
|
import { default as default5 } from "eslint-plugin-unicorn";
|
|
12
12
|
import { default as default6 } from "eslint-plugin-unused-imports";
|
|
@@ -87,6 +87,34 @@ async function ensurePackages(packages) {
|
|
|
87
87
|
if (result)
|
|
88
88
|
await import("@antfu/install-pkg").then((i) => i.installPackage(nonExistingPackages, { dev: true }));
|
|
89
89
|
}
|
|
90
|
+
function renameRules(rules, map) {
|
|
91
|
+
return Object.fromEntries(
|
|
92
|
+
Object.entries(rules).map(([key, value]) => {
|
|
93
|
+
for (const [from, to] of Object.entries(map)) {
|
|
94
|
+
if (key.startsWith(`${from}/`))
|
|
95
|
+
return [to + key.slice(from.length), value];
|
|
96
|
+
}
|
|
97
|
+
return [key, value];
|
|
98
|
+
})
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
function renamePluginInConfigs(configs, map) {
|
|
102
|
+
return configs.map((i) => {
|
|
103
|
+
const clone = { ...i };
|
|
104
|
+
if (clone.rules)
|
|
105
|
+
clone.rules = renameRules(clone.rules, map);
|
|
106
|
+
if (clone.plugins) {
|
|
107
|
+
clone.plugins = Object.fromEntries(
|
|
108
|
+
Object.entries(clone.plugins).map(([key, value]) => {
|
|
109
|
+
if (key in map)
|
|
110
|
+
return [map[key], value];
|
|
111
|
+
return [key, value];
|
|
112
|
+
})
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
return clone;
|
|
116
|
+
});
|
|
117
|
+
}
|
|
90
118
|
|
|
91
119
|
// src/globs.ts
|
|
92
120
|
var GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
|
|
@@ -1066,6 +1094,22 @@ function sortPackageJson() {
|
|
|
1066
1094
|
{
|
|
1067
1095
|
order: ["types", "require", "import", "default"],
|
|
1068
1096
|
pathPattern: "^exports.*$"
|
|
1097
|
+
},
|
|
1098
|
+
{
|
|
1099
|
+
order: [
|
|
1100
|
+
// client hooks only
|
|
1101
|
+
"pre-commit",
|
|
1102
|
+
"prepare-commit-msg",
|
|
1103
|
+
"commit-msg",
|
|
1104
|
+
"post-commit",
|
|
1105
|
+
"pre-rebase",
|
|
1106
|
+
"post-rewrite",
|
|
1107
|
+
"post-checkout",
|
|
1108
|
+
"post-merge",
|
|
1109
|
+
"pre-push",
|
|
1110
|
+
"pre-auto-gc"
|
|
1111
|
+
],
|
|
1112
|
+
pathPattern: "^(?:gitHooks|husky|simple-git-hooks)$"
|
|
1069
1113
|
}
|
|
1070
1114
|
]
|
|
1071
1115
|
}
|
|
@@ -2022,6 +2066,12 @@ var VuePackages = [
|
|
|
2022
2066
|
"vitepress",
|
|
2023
2067
|
"@slidev/cli"
|
|
2024
2068
|
];
|
|
2069
|
+
var defaultPluginRenaming = {
|
|
2070
|
+
"import-x": "import",
|
|
2071
|
+
"n": "node",
|
|
2072
|
+
"vitest": "test",
|
|
2073
|
+
"yml": "yaml"
|
|
2074
|
+
};
|
|
2025
2075
|
async function rotki(options = {}, ...userConfigs) {
|
|
2026
2076
|
const {
|
|
2027
2077
|
componentExts = [],
|
|
@@ -2161,11 +2211,11 @@ async function rotki(options = {}, ...userConfigs) {
|
|
|
2161
2211
|
}, {});
|
|
2162
2212
|
if (Object.keys(fusedConfig).length > 0)
|
|
2163
2213
|
configs.push([fusedConfig]);
|
|
2164
|
-
const merged = combine(
|
|
2214
|
+
const merged = await combine(
|
|
2165
2215
|
...configs,
|
|
2166
2216
|
...userConfigs
|
|
2167
2217
|
);
|
|
2168
|
-
return merged;
|
|
2218
|
+
return renamePluginInConfigs(merged, defaultPluginRenaming);
|
|
2169
2219
|
}
|
|
2170
2220
|
function resolveSubOptions(options, key) {
|
|
2171
2221
|
return typeof options[key] === "boolean" ? {} : options[key] || {};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rotki/eslint-config",
|
|
3
|
-
"version": "2.
|
|
4
|
-
"packageManager": "pnpm@8.
|
|
3
|
+
"version": "2.6.0",
|
|
4
|
+
"packageManager": "pnpm@8.15.5",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "AGPL-3.0",
|
|
7
7
|
"bugs": {
|
|
@@ -51,11 +51,11 @@
|
|
|
51
51
|
"dependencies": {
|
|
52
52
|
"@antfu/eslint-define-config": "1.23.0-2",
|
|
53
53
|
"@antfu/install-pkg": "0.3.1",
|
|
54
|
-
"@eslint-types/typescript-eslint": "7.0
|
|
54
|
+
"@eslint-types/typescript-eslint": "7.2.0",
|
|
55
55
|
"@eslint-types/unicorn": "51.0.1",
|
|
56
|
-
"@stylistic/eslint-plugin": "1.
|
|
57
|
-
"@typescript-eslint/eslint-plugin": "7.
|
|
58
|
-
"@typescript-eslint/parser": "7.
|
|
56
|
+
"@stylistic/eslint-plugin": "1.7.0",
|
|
57
|
+
"@typescript-eslint/eslint-plugin": "7.3.1",
|
|
58
|
+
"@typescript-eslint/parser": "7.3.1",
|
|
59
59
|
"eslint-config-flat-gitignore": "0.1.3",
|
|
60
60
|
"eslint-config-prettier": "9.1.0",
|
|
61
61
|
"eslint-merge-processors": "0.1.0",
|
|
@@ -63,18 +63,18 @@
|
|
|
63
63
|
"eslint-plugin-eslint-comments": "3.2.0",
|
|
64
64
|
"eslint-plugin-format": "0.1.0",
|
|
65
65
|
"eslint-plugin-html": "8.0.0",
|
|
66
|
-
"eslint-plugin-
|
|
67
|
-
"eslint-plugin-jsonc": "2.
|
|
66
|
+
"eslint-plugin-import-x": "0.4.1",
|
|
67
|
+
"eslint-plugin-jsonc": "2.14.1",
|
|
68
68
|
"eslint-plugin-markdown": "4.0.1",
|
|
69
69
|
"eslint-plugin-n": "16.6.2",
|
|
70
70
|
"eslint-plugin-no-only-tests": "3.1.0",
|
|
71
|
-
"eslint-plugin-perfectionist": "2.
|
|
71
|
+
"eslint-plugin-perfectionist": "2.7.0",
|
|
72
72
|
"eslint-plugin-prettier": "5.1.3",
|
|
73
73
|
"eslint-plugin-unicorn": "51.0.1",
|
|
74
74
|
"eslint-plugin-unused-imports": "3.1.0",
|
|
75
75
|
"eslint-plugin-vitest": "0.3.26",
|
|
76
76
|
"eslint-plugin-vue": "9.23.0",
|
|
77
|
-
"eslint-plugin-yml": "1.
|
|
77
|
+
"eslint-plugin-yml": "1.13.2",
|
|
78
78
|
"eslint-processor-vue-blocks": "0.1.1",
|
|
79
79
|
"globals": "14.0.0",
|
|
80
80
|
"jsonc-eslint-parser": "2.4.0",
|
|
@@ -85,23 +85,23 @@
|
|
|
85
85
|
"yaml-eslint-parser": "1.2.2"
|
|
86
86
|
},
|
|
87
87
|
"devDependencies": {
|
|
88
|
-
"@commitlint/cli": "19.1
|
|
88
|
+
"@commitlint/cli": "19.2.1",
|
|
89
89
|
"@commitlint/config-conventional": "19.1.0",
|
|
90
90
|
"@rotki/eslint-config": "*",
|
|
91
|
-
"@types/eslint": "8.56.
|
|
92
|
-
"@types/node": "20.11.
|
|
91
|
+
"@types/eslint": "8.56.6",
|
|
92
|
+
"@types/node": "20.11.30",
|
|
93
93
|
"@types/prompts": "2.4.9",
|
|
94
94
|
"bumpp": "9.4.0",
|
|
95
95
|
"eslint": "8.57.0",
|
|
96
|
-
"eslint-flat-config-viewer": "0.1.
|
|
96
|
+
"eslint-flat-config-viewer": "0.1.14",
|
|
97
97
|
"husky": "9.0.11",
|
|
98
98
|
"lint-staged": "15.2.2",
|
|
99
99
|
"rimraf": "5.0.5",
|
|
100
100
|
"tsup": "8.0.2",
|
|
101
|
-
"typescript": "5.4.
|
|
101
|
+
"typescript": "5.4.3"
|
|
102
102
|
},
|
|
103
103
|
"engines": {
|
|
104
|
-
"node": ">=
|
|
104
|
+
"node": ">=20 <21",
|
|
105
105
|
"pnpm": ">=8 <9"
|
|
106
106
|
},
|
|
107
107
|
"lint-staged": {
|