@plugjs/eslint-plugin 0.2.17 → 0.2.19

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.
@@ -30,7 +30,7 @@ var require_package = __commonJS({
30
30
  "node_modules/eslint-plugin-import-x/package.json"(exports2, module2) {
31
31
  module2.exports = {
32
32
  name: "eslint-plugin-import-x",
33
- version: "4.2.1",
33
+ version: "4.3.0",
34
34
  description: "Import with sanity.",
35
35
  repository: "git+https://github.com/un-ts/eslint-plugin-import-x",
36
36
  author: "JounQin <admin@1stg.me> (https://www.1stG.me)",
@@ -974,10 +974,12 @@ var require_resolve = __commonJS({
974
974
  const configResolvers = settings["import-x/resolver"] || {
975
975
  node: settings["import-x/resolve"]
976
976
  };
977
- const resolvers = resolverReducer(configResolvers, /* @__PURE__ */ new Map());
978
- for (const [name, config] of resolvers) {
979
- const resolver = requireResolver(name, sourceFile);
980
- const resolved = withResolver(resolver, config);
977
+ const resolvers = normalizeConfigResolvers(configResolvers, sourceFile);
978
+ for (const { enable, options, resolver } of resolvers) {
979
+ if (!enable) {
980
+ continue;
981
+ }
982
+ const resolved = withResolver(resolver, options);
981
983
  if (!resolved.found) {
982
984
  continue;
983
985
  }
@@ -989,25 +991,50 @@ var require_resolve = __commonJS({
989
991
  function relative(modulePath, sourceFile, settings) {
990
992
  return fullResolve(modulePath, sourceFile, settings).path;
991
993
  }
992
- function resolverReducer(resolvers, map) {
993
- if (Array.isArray(resolvers)) {
994
- for (const r of resolvers)
995
- resolverReducer(r, map);
996
- return map;
997
- }
998
- if (typeof resolvers === "string") {
999
- map.set(resolvers, null);
1000
- return map;
1001
- }
1002
- if (typeof resolvers === "object") {
1003
- for (const [key, value] of Object.entries(resolvers)) {
1004
- map.set(key, value);
994
+ function normalizeConfigResolvers(resolvers, sourceFile) {
995
+ const resolverArray = Array.isArray(resolvers) ? resolvers : [resolvers];
996
+ const map = /* @__PURE__ */ new Map();
997
+ for (const nameOrRecordOrObject of resolverArray) {
998
+ if (typeof nameOrRecordOrObject === "string") {
999
+ const name = nameOrRecordOrObject;
1000
+ map.set(name, {
1001
+ name,
1002
+ enable: true,
1003
+ options: void 0,
1004
+ resolver: requireResolver(name, sourceFile)
1005
+ });
1006
+ } else if (typeof nameOrRecordOrObject === "object") {
1007
+ if (nameOrRecordOrObject.name && nameOrRecordOrObject.resolver) {
1008
+ const object = nameOrRecordOrObject;
1009
+ const { name, enable = true, options, resolver } = object;
1010
+ map.set(name, { name, enable, options, resolver });
1011
+ } else {
1012
+ const record = nameOrRecordOrObject;
1013
+ for (const [name, enableOrOptions] of Object.entries(record)) {
1014
+ if (typeof enableOrOptions === "boolean") {
1015
+ map.set(name, {
1016
+ name,
1017
+ enable: enableOrOptions,
1018
+ options: void 0,
1019
+ resolver: requireResolver(name, sourceFile)
1020
+ });
1021
+ } else {
1022
+ map.set(name, {
1023
+ name,
1024
+ enable: true,
1025
+ options: enableOrOptions,
1026
+ resolver: requireResolver(name, sourceFile)
1027
+ });
1028
+ }
1029
+ }
1030
+ }
1031
+ } else {
1032
+ const err = new Error("invalid resolver config");
1033
+ err.name = ERROR_NAME;
1034
+ throw err;
1005
1035
  }
1006
- return map;
1007
1036
  }
1008
- const err = new Error("invalid resolver config");
1009
- err.name = ERROR_NAME;
1010
- throw err;
1037
+ return [...map.values()];
1011
1038
  }
1012
1039
  function getBaseDir(sourceFile) {
1013
1040
  return (0, pkg_dir_1.pkgDir)(sourceFile) || process.cwd();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plugjs/eslint-plugin",
3
- "version": "0.2.17",
3
+ "version": "0.2.19",
4
4
  "description": "Shared ESLint configurations and extras",
5
5
  "main": "./index.mjs",
6
6
  "type": "module",
@@ -10,7 +10,7 @@
10
10
  "build": "eslint"
11
11
  },
12
12
  "peerDependencies": {
13
- "eslint": "^9.10.0"
13
+ "eslint": "^9.11.1"
14
14
  },
15
15
  "files": [
16
16
  "*.md",
@@ -35,14 +35,14 @@
35
35
  },
36
36
  "homepage": "https://github.com/plugjs/eslint-plugin#readme",
37
37
  "dependencies": {
38
- "@eslint/js": "9.10.0",
38
+ "@eslint/js": "9.11.1",
39
39
  "@nolyfill/is-core-module": "1.0.39",
40
- "@typescript-eslint/utils": "8.5.0",
40
+ "@typescript-eslint/utils": "8.7.0",
41
41
  "debug": "4.3.7",
42
42
  "doctrine": "3.0.0",
43
43
  "enhanced-resolve": "5.17.1",
44
- "eslint": "9.10.0",
45
- "eslint-module-utils": "2.11.0",
44
+ "eslint": "9.11.1",
45
+ "eslint-module-utils": "2.12.0",
46
46
  "eslint-plugin-unicorn": "55.0.0",
47
47
  "eslint-visitor-keys": "4.0.0",
48
48
  "espree": "10.1.0",
@@ -60,6 +60,6 @@
60
60
  "stable-hash": "0.0.4",
61
61
  "tslib": "2.7.0",
62
62
  "typescript": "5.6.2",
63
- "typescript-eslint": "8.5.0"
63
+ "typescript-eslint": "8.7.0"
64
64
  }
65
65
  }