@plugjs/eslint-plugin 0.2.1 → 0.2.3

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.
@@ -180,7 +180,7 @@ var require_package = __commonJS({
180
180
  "node_modules/eslint-plugin-import-x/package.json"(exports2, module2) {
181
181
  module2.exports = {
182
182
  name: "eslint-plugin-import-x",
183
- version: "0.5.2",
183
+ version: "3.0.0",
184
184
  description: "Import with sanity.",
185
185
  repository: "git+https://github.com/un-ts/eslint-plugin-import-x",
186
186
  author: "JounQin <admin@1stg.me> (https://www.1stG.me)",
@@ -236,6 +236,7 @@ var require_package = __commonJS({
236
236
  "is-glob": "^4.0.3",
237
237
  minimatch: "^9.0.3",
238
238
  semver: "^7.6.0",
239
+ "stable-hash": "^0.0.4",
239
240
  tslib: "^2.6.2"
240
241
  },
241
242
  devDependencies: {
@@ -964,6 +965,7 @@ var require_export_map = __commonJS({
964
965
  var doctrine_1 = tslib_12.__importDefault(require("doctrine"));
965
966
  var eslint_1 = require("eslint");
966
967
  var get_tsconfig_1 = require("get-tsconfig");
968
+ var stable_hash_1 = tslib_12.__importDefault(require("stable-hash"));
967
969
  var get_value_1 = require_get_value();
968
970
  var hash_1 = require_hash();
969
971
  var ignore_1 = require_ignore();
@@ -1621,29 +1623,28 @@ var require_export_map = __commonJS({
1621
1623
  }
1622
1624
  }
1623
1625
  exports2.recursivePatternCapture = recursivePatternCapture;
1624
- var parserOptionsHash = "";
1625
- var prevParserOptions = "";
1626
- var settingsHash = "";
1627
- var prevSettings = "";
1628
1626
  function childContext(path, context) {
1629
- const { settings, parserOptions, parserPath } = context;
1630
- if (JSON.stringify(settings) !== prevSettings) {
1631
- settingsHash = (0, hash_1.hashObject)({ settings }).digest("hex");
1632
- prevSettings = JSON.stringify(settings);
1633
- }
1634
- if (JSON.stringify(parserOptions) !== prevParserOptions) {
1635
- parserOptionsHash = (0, hash_1.hashObject)({ parserOptions }).digest("hex");
1636
- prevParserOptions = JSON.stringify(parserOptions);
1637
- }
1627
+ const { settings, parserOptions, parserPath, languageOptions } = context;
1638
1628
  return {
1639
- cacheKey: String(parserPath) + parserOptionsHash + settingsHash + String(path),
1629
+ cacheKey: makeContextCacheKey(context) + String(path),
1640
1630
  settings,
1641
1631
  parserOptions,
1642
1632
  parserPath,
1633
+ languageOptions,
1643
1634
  path,
1644
1635
  filename: "physicalFilename" in context ? context.physicalFilename : context.filename
1645
1636
  };
1646
1637
  }
1638
+ function makeContextCacheKey(context) {
1639
+ var _a, _b, _c;
1640
+ const { settings, parserPath, parserOptions, languageOptions } = context;
1641
+ let hash = (0, stable_hash_1.default)(settings) + (0, stable_hash_1.default)((_a = languageOptions === null || languageOptions === void 0 ? void 0 : languageOptions.parserOptions) !== null && _a !== void 0 ? _a : parserOptions);
1642
+ if (languageOptions) {
1643
+ hash += String(languageOptions.ecmaVersion) + String(languageOptions.sourceType);
1644
+ }
1645
+ hash += (0, stable_hash_1.default)((_c = parserPath !== null && parserPath !== void 0 ? parserPath : (_b = languageOptions === null || languageOptions === void 0 ? void 0 : languageOptions.parser) === null || _b === void 0 ? void 0 : _b.meta) !== null && _c !== void 0 ? _c : languageOptions === null || languageOptions === void 0 ? void 0 : languageOptions.parser);
1646
+ return hash;
1647
+ }
1647
1648
  function makeSourceCode(text, ast) {
1648
1649
  if (eslint_1.SourceCode.length > 1) {
1649
1650
  return new eslint_1.SourceCode(text, ast);
@@ -2295,6 +2296,7 @@ var require_dynamic_import_chunkname = __commonJS({
2295
2296
  category: "Style guide",
2296
2297
  description: "Enforce a leading comment with the webpackChunkName for dynamic imports."
2297
2298
  },
2299
+ hasSuggestions: true,
2298
2300
  schema: [
2299
2301
  {
2300
2302
  type: "object",
@@ -2320,16 +2322,21 @@ var require_dynamic_import_chunkname = __commonJS({
2320
2322
  blockComment: "dynamic imports require a /* foo */ style comment, not a // foo comment",
2321
2323
  paddedSpaces: "dynamic imports require a block comment padded with spaces - /* foo */",
2322
2324
  webpackComment: 'dynamic imports require a "webpack" comment with valid syntax',
2323
- chunknameFormat: "dynamic imports require a leading comment in the form /*{{format}}*/"
2325
+ chunknameFormat: "dynamic imports require a leading comment in the form /* {{format}} */",
2326
+ webpackEagerModeNoChunkName: "dynamic imports using eager mode do not need a webpackChunkName",
2327
+ webpackRemoveEagerMode: "Remove webpackMode",
2328
+ webpackRemoveChunkName: "Remove webpackChunkName"
2324
2329
  }
2325
2330
  },
2326
2331
  defaultOptions: [],
2327
2332
  create(context) {
2328
2333
  const { importFunctions = [], allowEmpty = false, webpackChunknameFormat = "([0-9a-zA-Z-_/.]|\\[(request|index)\\])+" } = context.options[0] || {};
2329
2334
  const paddedCommentRegex = /^ (\S[\S\s]+\S) $/;
2330
- const commentStyleRegex = /^( ((webpackChunkName: .+)|((webpackPrefetch|webpackPreload): (true|false|-?\d+))|(webpackIgnore: (true|false))|((webpackInclude|webpackExclude): \/.*\/)|(webpackMode: ["'](lazy|lazy-once|eager|weak)["'])|(webpackExports: (["']\w+["']|\[(["']\w+["'], *)+(["']\w+["']*)]))),?)+ $/;
2331
- const chunkSubstrFormat = ` webpackChunkName: ["']${webpackChunknameFormat}["'],? `;
2335
+ const commentStyleRegex = /^( (((webpackChunkName|webpackFetchPriority): .+)|((webpackPrefetch|webpackPreload): (true|false|-?\d+))|(webpackIgnore: (true|false))|((webpackInclude|webpackExclude): \/.+\/)|(webpackMode: ["'](lazy|lazy-once|eager|weak)["'])|(webpackExports: (["']\w+["']|\[(["']\w+["'], *)+(["']\w+["']*)]))),?)+ $/;
2336
+ const chunkSubstrFormat = `webpackChunkName: ["']${webpackChunknameFormat}["'],?`;
2332
2337
  const chunkSubstrRegex = new RegExp(chunkSubstrFormat);
2338
+ const eagerModeFormat = `webpackMode: ["']eager["'],?`;
2339
+ const eagerModeRegex = new RegExp(eagerModeFormat);
2333
2340
  function run(node, arg) {
2334
2341
  const { sourceCode } = context;
2335
2342
  const leadingComments = sourceCode.getCommentsBefore(arg);
@@ -2341,6 +2348,7 @@ var require_dynamic_import_chunkname = __commonJS({
2341
2348
  return;
2342
2349
  }
2343
2350
  let isChunknamePresent = false;
2351
+ let isEagerModePresent = false;
2344
2352
  for (const comment of leadingComments) {
2345
2353
  if (comment.type !== "Block") {
2346
2354
  context.report({
@@ -2372,11 +2380,60 @@ var require_dynamic_import_chunkname = __commonJS({
2372
2380
  });
2373
2381
  return;
2374
2382
  }
2383
+ if (eagerModeRegex.test(comment.value)) {
2384
+ isEagerModePresent = true;
2385
+ }
2375
2386
  if (chunkSubstrRegex.test(comment.value)) {
2376
2387
  isChunknamePresent = true;
2377
2388
  }
2378
2389
  }
2379
- if (!isChunknamePresent && !allowEmpty) {
2390
+ const removeCommentsAndLeadingSpaces = (fixer, comment) => {
2391
+ const leftToken = sourceCode.getTokenBefore(comment);
2392
+ const leftComments = sourceCode.getCommentsBefore(comment);
2393
+ if (leftToken) {
2394
+ if (leftComments.length > 0) {
2395
+ return fixer.removeRange([
2396
+ Math.max(leftToken.range[1], leftComments[leftComments.length - 1].range[1]),
2397
+ comment.range[1]
2398
+ ]);
2399
+ }
2400
+ return fixer.removeRange([leftToken.range[1], comment.range[1]]);
2401
+ }
2402
+ return fixer.remove(comment);
2403
+ };
2404
+ if (isChunknamePresent && isEagerModePresent) {
2405
+ context.report({
2406
+ node,
2407
+ messageId: "webpackEagerModeNoChunkName",
2408
+ suggest: [
2409
+ {
2410
+ messageId: "webpackRemoveChunkName",
2411
+ fix(fixer) {
2412
+ for (const comment of leadingComments) {
2413
+ if (chunkSubstrRegex.test(comment.value)) {
2414
+ const replacement = comment.value.replace(chunkSubstrRegex, "").trim().replace(/,$/, "");
2415
+ return replacement === "" ? removeCommentsAndLeadingSpaces(fixer, comment) : fixer.replaceText(comment, `/* ${replacement} */`);
2416
+ }
2417
+ }
2418
+ return null;
2419
+ }
2420
+ },
2421
+ {
2422
+ messageId: "webpackRemoveEagerMode",
2423
+ fix(fixer) {
2424
+ for (const comment of leadingComments) {
2425
+ if (eagerModeRegex.test(comment.value)) {
2426
+ const replacement = comment.value.replace(eagerModeRegex, "").trim().replace(/,$/, "");
2427
+ return replacement === "" ? removeCommentsAndLeadingSpaces(fixer, comment) : fixer.replaceText(comment, `/* ${replacement} */`);
2428
+ }
2429
+ }
2430
+ return null;
2431
+ }
2432
+ }
2433
+ ]
2434
+ });
2435
+ }
2436
+ if (!isChunknamePresent && !allowEmpty && !isEagerModePresent) {
2380
2437
  context.report({
2381
2438
  node,
2382
2439
  messageId: "chunknameFormat",
@@ -4387,6 +4444,27 @@ var require_no_deprecated = __commonJS({
4387
4444
  }
4388
4445
  });
4389
4446
 
4447
+ // node_modules/eslint-plugin-import-x/lib/utils/lazy-value.js
4448
+ var require_lazy_value = __commonJS({
4449
+ "node_modules/eslint-plugin-import-x/lib/utils/lazy-value.js"(exports2) {
4450
+ "use strict";
4451
+ Object.defineProperty(exports2, "__esModule", { value: true });
4452
+ exports2.lazy = void 0;
4453
+ var lazy = (cb) => {
4454
+ let isCalled = false;
4455
+ let result;
4456
+ return () => {
4457
+ if (!isCalled) {
4458
+ isCalled = true;
4459
+ result = cb();
4460
+ }
4461
+ return result;
4462
+ };
4463
+ };
4464
+ exports2.lazy = lazy;
4465
+ }
4466
+ });
4467
+
4390
4468
  // node_modules/eslint-plugin-import-x/lib/rules/no-duplicates.js
4391
4469
  var require_no_duplicates = __commonJS({
4392
4470
  "node_modules/eslint-plugin-import-x/lib/rules/no-duplicates.js"(exports2, module2) {
@@ -4394,69 +4472,67 @@ var require_no_duplicates = __commonJS({
4394
4472
  var tslib_12 = require("tslib");
4395
4473
  var semver_1 = tslib_12.__importDefault(require("semver"));
4396
4474
  var utils_1 = require_utils();
4397
- var typescriptPkg;
4398
- try {
4399
- typescriptPkg = require("typescript/package.json");
4400
- } catch (_a) {
4401
- }
4475
+ var lazy_value_1 = require_lazy_value();
4476
+ var isTypeScriptVersionSupportPreferInline = (0, lazy_value_1.lazy)(() => {
4477
+ let typescriptPkg;
4478
+ try {
4479
+ typescriptPkg = require("typescript/package.json");
4480
+ } catch (_a) {
4481
+ }
4482
+ return !typescriptPkg || !semver_1.default.satisfies(typescriptPkg.version, ">= 4.5");
4483
+ });
4402
4484
  function checkImports(imported, context) {
4403
- for (const [module3, nodes] of imported.entries()) {
4404
- if (nodes.length > 1) {
4405
- const [first, ...rest] = nodes;
4406
- const { sourceCode } = context;
4407
- const fix = getFix(first, rest, sourceCode, context);
4485
+ imported.forEach((nodes, module3) => {
4486
+ if (nodes.length <= 1) {
4487
+ return;
4488
+ }
4489
+ for (let i = 0, len = nodes.length; i < len; i++) {
4490
+ const node = nodes[i];
4408
4491
  context.report({
4409
- node: first.source,
4492
+ node: node.source,
4410
4493
  messageId: "duplicate",
4411
4494
  data: {
4412
4495
  module: module3
4413
4496
  },
4414
- fix
4497
+ fix: i === 0 ? getFix(nodes, context.sourceCode, context) : null
4415
4498
  });
4416
- for (const node of rest) {
4417
- context.report({
4418
- node: node.source,
4419
- messageId: "duplicate",
4420
- data: {
4421
- module: module3
4422
- }
4423
- });
4424
- }
4425
4499
  }
4426
- }
4500
+ });
4427
4501
  }
4428
- function getFix(first, rest, sourceCode, context) {
4429
- if (typeof sourceCode.getCommentsBefore !== "function") {
4430
- return;
4431
- }
4502
+ function getFix(nodes, sourceCode, context) {
4503
+ const first = nodes[0];
4432
4504
  if (hasProblematicComments(first, sourceCode) || hasNamespace(first)) {
4433
- return;
4505
+ return null;
4434
4506
  }
4435
- const defaultImportNames = new Set([first, ...rest].flatMap((x) => getDefaultImportName(x) || []));
4507
+ const defaultImportNames = new Set(nodes.flatMap((x) => getDefaultImportName(x) || []));
4436
4508
  if (defaultImportNames.size > 1) {
4437
- return;
4509
+ return null;
4438
4510
  }
4439
- const restWithoutComments = rest.filter((node) => !hasProblematicComments(node, sourceCode) && !hasNamespace(node));
4440
- const specifiers = restWithoutComments.map((node) => {
4511
+ const rest = nodes.slice(1);
4512
+ const restWithoutCommentsAndNamespaces = rest.filter((node) => !hasProblematicComments(node, sourceCode) && !hasNamespace(node));
4513
+ const restWithoutCommentsAndNamespacesHasSpecifiers = restWithoutCommentsAndNamespaces.map(hasSpecifiers);
4514
+ const specifiers = restWithoutCommentsAndNamespaces.reduce((acc, node, nodeIndex) => {
4441
4515
  const tokens = sourceCode.getTokens(node);
4442
4516
  const openBrace = tokens.find((token) => isPunctuator(token, "{"));
4443
4517
  const closeBrace = tokens.find((token) => isPunctuator(token, "}"));
4444
4518
  if (openBrace == null || closeBrace == null) {
4445
- return;
4519
+ return acc;
4446
4520
  }
4447
- return {
4521
+ acc.push({
4448
4522
  importNode: node,
4449
4523
  identifiers: sourceCode.text.slice(openBrace.range[1], closeBrace.range[0]).split(","),
4450
- isEmpty: !hasSpecifiers(node)
4451
- };
4452
- }).filter(Boolean);
4453
- const unnecessaryImports = restWithoutComments.filter((node) => !hasSpecifiers(node) && !hasNamespace(node) && !specifiers.some((specifier) => "importNode" in specifier && specifier.importNode === node));
4454
- const shouldAddDefault = getDefaultImportName(first) == null && defaultImportNames.size === 1;
4524
+ isEmpty: !restWithoutCommentsAndNamespacesHasSpecifiers[nodeIndex]
4525
+ });
4526
+ return acc;
4527
+ }, []);
4528
+ const unnecessaryImports = restWithoutCommentsAndNamespaces.filter((node, nodeIndex) => !restWithoutCommentsAndNamespacesHasSpecifiers[nodeIndex] && !specifiers.some((specifier) => specifier.importNode === node));
4455
4529
  const shouldAddSpecifiers = specifiers.length > 0;
4456
4530
  const shouldRemoveUnnecessary = unnecessaryImports.length > 0;
4457
- if (!(shouldAddDefault || shouldAddSpecifiers || shouldRemoveUnnecessary)) {
4458
- return;
4531
+ const shouldAddDefault = (0, lazy_value_1.lazy)(() => getDefaultImportName(first) == null && defaultImportNames.size === 1);
4532
+ if (!shouldAddSpecifiers && !shouldRemoveUnnecessary && !shouldAddDefault()) {
4533
+ return null;
4459
4534
  }
4535
+ const preferInline = context.options[0] && context.options[0]["prefer-inline"];
4460
4536
  return (fixer) => {
4461
4537
  const tokens = sourceCode.getTokens(first);
4462
4538
  const openBrace = tokens.find((token) => isPunctuator(token, "{"));
@@ -4468,8 +4544,7 @@ var require_no_duplicates = __commonJS({
4468
4544
  const firstExistingIdentifiers = firstIsEmpty ? /* @__PURE__ */ new Set() : new Set(sourceCode.text.slice(openBrace.range[1], closeBrace.range[0]).split(",").map((x) => x.trim()));
4469
4545
  const [specifiersText] = specifiers.reduce(([result, needsComma, existingIdentifiers], specifier) => {
4470
4546
  const isTypeSpecifier = "importNode" in specifier && specifier.importNode.importKind === "type";
4471
- const preferInline = context.options[0] && context.options[0]["prefer-inline"];
4472
- if (preferInline && (!typescriptPkg || !semver_1.default.satisfies(typescriptPkg.version, ">= 4.5"))) {
4547
+ if (preferInline && isTypeScriptVersionSupportPreferInline()) {
4473
4548
  throw new Error("Your version of TypeScript does not support inline type imports.");
4474
4549
  }
4475
4550
  const [specifierText, updatedExistingIdentifiers] = specifier.identifiers.reduce(([text, set], cur) => {
@@ -4490,22 +4565,22 @@ var require_no_duplicates = __commonJS({
4490
4565
  ];
4491
4566
  }, ["", !firstHasTrailingComma && !firstIsEmpty, firstExistingIdentifiers]);
4492
4567
  const fixes = [];
4493
- if (shouldAddDefault && openBrace == null && shouldAddSpecifiers) {
4568
+ if (openBrace == null && shouldAddSpecifiers && shouldAddDefault()) {
4494
4569
  fixes.push(fixer.insertTextAfter(firstToken, ` ${defaultImportName}, {${specifiersText}} from`));
4495
- } else if (shouldAddDefault && openBrace == null && !shouldAddSpecifiers) {
4570
+ } else if (openBrace == null && !shouldAddSpecifiers && shouldAddDefault()) {
4496
4571
  fixes.push(fixer.insertTextAfter(firstToken, ` ${defaultImportName} from`));
4497
- } else if (shouldAddDefault && openBrace != null && closeBrace != null) {
4572
+ } else if (openBrace != null && closeBrace != null && shouldAddDefault()) {
4498
4573
  fixes.push(fixer.insertTextAfter(firstToken, ` ${defaultImportName},`));
4499
4574
  if (shouldAddSpecifiers) {
4500
4575
  fixes.push(fixer.insertTextBefore(closeBrace, specifiersText));
4501
4576
  }
4502
- } else if (!shouldAddDefault && openBrace == null && shouldAddSpecifiers) {
4577
+ } else if (openBrace == null && shouldAddSpecifiers && !shouldAddDefault()) {
4503
4578
  if (first.specifiers.length === 0) {
4504
4579
  fixes.push(fixer.insertTextAfter(firstToken, ` {${specifiersText}} from`));
4505
4580
  } else {
4506
4581
  fixes.push(fixer.insertTextAfter(first.specifiers[0], `, {${specifiersText}}`));
4507
4582
  }
4508
- } else if (!shouldAddDefault && openBrace != null && closeBrace != null) {
4583
+ } else if (openBrace != null && closeBrace != null && !shouldAddDefault()) {
4509
4584
  fixes.push(fixer.insertTextBefore(closeBrace, specifiersText));
4510
4585
  }
4511
4586
  for (const specifier of specifiers) {
@@ -4536,15 +4611,13 @@ var require_no_duplicates = __commonJS({
4536
4611
  }
4537
4612
  function getDefaultImportName(node) {
4538
4613
  const defaultSpecifier = node.specifiers.find((specifier) => specifier.type === "ImportDefaultSpecifier");
4539
- return defaultSpecifier == null ? void 0 : defaultSpecifier.local.name;
4614
+ return defaultSpecifier === null || defaultSpecifier === void 0 ? void 0 : defaultSpecifier.local.name;
4540
4615
  }
4541
4616
  function hasNamespace(node) {
4542
- const specifiers = node.specifiers.filter((specifier) => specifier.type === "ImportNamespaceSpecifier");
4543
- return specifiers.length > 0;
4617
+ return node.specifiers.some((specifier) => specifier.type === "ImportNamespaceSpecifier");
4544
4618
  }
4545
4619
  function hasSpecifiers(node) {
4546
- const specifiers = node.specifiers.filter((specifier) => specifier.type === "ImportSpecifier");
4547
- return specifiers.length > 0;
4620
+ return node.specifiers.some((specifier) => specifier.type === "ImportSpecifier");
4548
4621
  }
4549
4622
  function hasProblematicComments(node, sourceCode) {
4550
4623
  return hasCommentBefore(node, sourceCode) || hasCommentAfter(node, sourceCode) || hasCommentInsideNonSpecifiers(node, sourceCode);
@@ -4594,8 +4667,9 @@ var require_no_duplicates = __commonJS({
4594
4667
  },
4595
4668
  defaultOptions: [],
4596
4669
  create(context) {
4597
- var _a;
4598
- const considerQueryStringOption = (_a = context.options[0]) === null || _a === void 0 ? void 0 : _a.considerQueryString;
4670
+ var _a, _b;
4671
+ const preferInline = (_a = context.options[0]) === null || _a === void 0 ? void 0 : _a["prefer-inline"];
4672
+ const considerQueryStringOption = (_b = context.options[0]) === null || _b === void 0 ? void 0 : _b.considerQueryString;
4599
4673
  const defaultResolver = (sourcePath) => (0, utils_1.resolve)(sourcePath, context) || sourcePath;
4600
4674
  const resolver = considerQueryStringOption ? (sourcePath) => {
4601
4675
  const parts = sourcePath.match(/^([^?]*)\?(.*)$/);
@@ -4606,18 +4680,19 @@ var require_no_duplicates = __commonJS({
4606
4680
  } : defaultResolver;
4607
4681
  const moduleMaps = /* @__PURE__ */ new Map();
4608
4682
  function getImportMap(n) {
4609
- var _a2;
4610
4683
  const parent = n.parent;
4611
- if (!moduleMaps.has(parent)) {
4612
- moduleMaps.set(parent, {
4684
+ let map;
4685
+ if (moduleMaps.has(parent)) {
4686
+ map = moduleMaps.get(parent);
4687
+ } else {
4688
+ map = {
4613
4689
  imported: /* @__PURE__ */ new Map(),
4614
4690
  nsImported: /* @__PURE__ */ new Map(),
4615
4691
  defaultTypesImported: /* @__PURE__ */ new Map(),
4616
4692
  namedTypesImported: /* @__PURE__ */ new Map()
4617
- });
4693
+ };
4694
+ moduleMaps.set(parent, map);
4618
4695
  }
4619
- const map = moduleMaps.get(parent);
4620
- const preferInline = (_a2 = context.options[0]) === null || _a2 === void 0 ? void 0 : _a2["prefer-inline"];
4621
4696
  if (!preferInline && n.importKind === "type") {
4622
4697
  return n.specifiers.length > 0 && n.specifiers[0].type === "ImportDefaultSpecifier" ? map.defaultTypesImported : map.namedTypesImported;
4623
4698
  }
@@ -4863,8 +4938,11 @@ var require_no_extraneous_dependencies = __commonJS({
4863
4938
  }
4864
4939
  function getPackageDepFields(packageJsonPath, throwAtRead) {
4865
4940
  if (!depFieldCache.has(packageJsonPath)) {
4866
- const depFields = extractDepFields(readJSON(packageJsonPath, throwAtRead));
4867
- depFieldCache.set(packageJsonPath, depFields);
4941
+ const packageJson = readJSON(packageJsonPath, throwAtRead);
4942
+ if (packageJson) {
4943
+ const depFields = extractDepFields(packageJson);
4944
+ depFieldCache.set(packageJsonPath, depFields);
4945
+ }
4868
4946
  }
4869
4947
  return depFieldCache.get(packageJsonPath);
4870
4948
  }
@@ -4884,10 +4962,12 @@ var require_no_extraneous_dependencies = __commonJS({
4884
4962
  if (paths.length > 0) {
4885
4963
  for (const dir of paths) {
4886
4964
  const packageJsonPath = node_path_1.default.resolve(dir, "package.json");
4887
- const packageContent_ = getPackageDepFields(packageJsonPath, true);
4888
- for (const depsKey of Object.keys(packageContent)) {
4889
- const key = depsKey;
4890
- Object.assign(packageContent[key], packageContent_[key]);
4965
+ const packageContent_ = getPackageDepFields(packageJsonPath, paths.length === 1);
4966
+ if (packageContent_) {
4967
+ for (const depsKey of Object.keys(packageContent)) {
4968
+ const key = depsKey;
4969
+ Object.assign(packageContent[key], packageContent_[key]);
4970
+ }
4891
4971
  }
4892
4972
  }
4893
4973
  } else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plugjs/eslint-plugin",
3
- "version": "0.2.1",
3
+ "version": "0.2.3",
4
4
  "description": "Shared ESLint configurations and extras",
5
5
  "main": "./eslint.config.mjs",
6
6
  "type": "module",
@@ -10,7 +10,7 @@
10
10
  "build": "eslint build.mjs eslint.config.mjs configs"
11
11
  },
12
12
  "peerDependencies": {
13
- "eslint": "^9.5.0"
13
+ "eslint": "^9.6.0"
14
14
  },
15
15
  "files": [
16
16
  "*.md",
@@ -19,12 +19,12 @@
19
19
  "configs/"
20
20
  ],
21
21
  "dependencies": {
22
- "@eslint/js": "9.5.0",
23
- "@typescript-eslint/utils": "8.0.0-alpha.33",
22
+ "@eslint/js": "9.6.0",
23
+ "@typescript-eslint/utils": "8.0.0-alpha.41",
24
24
  "debug": "4.3.5",
25
25
  "doctrine": "2.1.0",
26
26
  "enhanced-resolve": "5.17.0",
27
- "eslint": "9.5.0",
27
+ "eslint": "9.6.0",
28
28
  "eslint-module-utils": "2.8.1",
29
29
  "eslint-plugin-unicorn": "54.0.0",
30
30
  "eslint-visitor-keys": "4.0.0",
@@ -32,15 +32,16 @@
32
32
  "estraverse": "5.3.0",
33
33
  "fast-glob": "3.3.2",
34
34
  "get-tsconfig": "4.7.5",
35
- "globals": "15.6.0",
35
+ "globals": "15.8.0",
36
36
  "is-core-module": "2.14.0",
37
37
  "is-glob": "4.0.3",
38
- "minimatch": "9.0.4",
38
+ "minimatch": "9.0.5",
39
39
  "picomatch": "4.0.2",
40
40
  "resolve": "1.22.8",
41
41
  "semver": "7.6.2",
42
+ "stable-hash": "0.0.4",
42
43
  "tslib": "2.6.3",
43
- "typescript": "5.5.2",
44
- "typescript-eslint": "8.0.0-alpha.33"
44
+ "typescript": "5.5.3",
45
+ "typescript-eslint": "8.0.0-alpha.41"
45
46
  }
46
47
  }