@plugjs/eslint-plugin 0.2.0 → 0.2.2

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.1",
183
+ version: "0.5.3",
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: {
@@ -556,6 +557,7 @@ var require_parse = __commonJS({
556
557
  parserOptions.range = true;
557
558
  parserOptions.filePath = path;
558
559
  delete parserOptions.EXPERIMENTAL_useProjectService;
560
+ delete parserOptions.projectService;
559
561
  delete parserOptions.project;
560
562
  delete parserOptions.projects;
561
563
  const parser = typeof parserOrPath === "string" ? (0, module_require_1.moduleRequire)(parserOrPath) : parserOrPath;
@@ -963,6 +965,7 @@ var require_export_map = __commonJS({
963
965
  var doctrine_1 = tslib_12.__importDefault(require("doctrine"));
964
966
  var eslint_1 = require("eslint");
965
967
  var get_tsconfig_1 = require("get-tsconfig");
968
+ var stable_hash_1 = tslib_12.__importDefault(require("stable-hash"));
966
969
  var get_value_1 = require_get_value();
967
970
  var hash_1 = require_hash();
968
971
  var ignore_1 = require_ignore();
@@ -1620,29 +1623,28 @@ var require_export_map = __commonJS({
1620
1623
  }
1621
1624
  }
1622
1625
  exports2.recursivePatternCapture = recursivePatternCapture;
1623
- var parserOptionsHash = "";
1624
- var prevParserOptions = "";
1625
- var settingsHash = "";
1626
- var prevSettings = "";
1627
1626
  function childContext(path, context) {
1628
- const { settings, parserOptions, parserPath } = context;
1629
- if (JSON.stringify(settings) !== prevSettings) {
1630
- settingsHash = (0, hash_1.hashObject)({ settings }).digest("hex");
1631
- prevSettings = JSON.stringify(settings);
1632
- }
1633
- if (JSON.stringify(parserOptions) !== prevParserOptions) {
1634
- parserOptionsHash = (0, hash_1.hashObject)({ parserOptions }).digest("hex");
1635
- prevParserOptions = JSON.stringify(parserOptions);
1636
- }
1627
+ const { settings, parserOptions, parserPath, languageOptions } = context;
1637
1628
  return {
1638
- cacheKey: String(parserPath) + parserOptionsHash + settingsHash + String(path),
1629
+ cacheKey: makeContextCacheKey(context) + String(path),
1639
1630
  settings,
1640
1631
  parserOptions,
1641
1632
  parserPath,
1633
+ languageOptions,
1642
1634
  path,
1643
1635
  filename: "physicalFilename" in context ? context.physicalFilename : context.filename
1644
1636
  };
1645
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
+ }
1646
1648
  function makeSourceCode(text, ast) {
1647
1649
  if (eslint_1.SourceCode.length > 1) {
1648
1650
  return new eslint_1.SourceCode(text, ast);
@@ -2294,6 +2296,7 @@ var require_dynamic_import_chunkname = __commonJS({
2294
2296
  category: "Style guide",
2295
2297
  description: "Enforce a leading comment with the webpackChunkName for dynamic imports."
2296
2298
  },
2299
+ hasSuggestions: true,
2297
2300
  schema: [
2298
2301
  {
2299
2302
  type: "object",
@@ -2319,16 +2322,21 @@ var require_dynamic_import_chunkname = __commonJS({
2319
2322
  blockComment: "dynamic imports require a /* foo */ style comment, not a // foo comment",
2320
2323
  paddedSpaces: "dynamic imports require a block comment padded with spaces - /* foo */",
2321
2324
  webpackComment: 'dynamic imports require a "webpack" comment with valid syntax',
2322
- 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"
2323
2329
  }
2324
2330
  },
2325
2331
  defaultOptions: [],
2326
2332
  create(context) {
2327
2333
  const { importFunctions = [], allowEmpty = false, webpackChunknameFormat = "([0-9a-zA-Z-_/.]|\\[(request|index)\\])+" } = context.options[0] || {};
2328
2334
  const paddedCommentRegex = /^ (\S[\S\s]+\S) $/;
2329
- const commentStyleRegex = /^( ((webpackChunkName: .+)|((webpackPrefetch|webpackPreload): (true|false|-?\d+))|(webpackIgnore: (true|false))|((webpackInclude|webpackExclude): \/.*\/)|(webpackMode: ["'](lazy|lazy-once|eager|weak)["'])|(webpackExports: (["']\w+["']|\[(["']\w+["'], *)+(["']\w+["']*)]))),?)+ $/;
2330
- 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}["'],?`;
2331
2337
  const chunkSubstrRegex = new RegExp(chunkSubstrFormat);
2338
+ const eagerModeFormat = `webpackMode: ["']eager["'],?`;
2339
+ const eagerModeRegex = new RegExp(eagerModeFormat);
2332
2340
  function run(node, arg) {
2333
2341
  const { sourceCode } = context;
2334
2342
  const leadingComments = sourceCode.getCommentsBefore(arg);
@@ -2340,6 +2348,7 @@ var require_dynamic_import_chunkname = __commonJS({
2340
2348
  return;
2341
2349
  }
2342
2350
  let isChunknamePresent = false;
2351
+ let isEagerModePresent = false;
2343
2352
  for (const comment of leadingComments) {
2344
2353
  if (comment.type !== "Block") {
2345
2354
  context.report({
@@ -2371,11 +2380,60 @@ var require_dynamic_import_chunkname = __commonJS({
2371
2380
  });
2372
2381
  return;
2373
2382
  }
2383
+ if (eagerModeRegex.test(comment.value)) {
2384
+ isEagerModePresent = true;
2385
+ }
2374
2386
  if (chunkSubstrRegex.test(comment.value)) {
2375
2387
  isChunknamePresent = true;
2376
2388
  }
2377
2389
  }
2378
- 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) {
2379
2437
  context.report({
2380
2438
  node,
2381
2439
  messageId: "chunknameFormat",
@@ -4862,8 +4920,11 @@ var require_no_extraneous_dependencies = __commonJS({
4862
4920
  }
4863
4921
  function getPackageDepFields(packageJsonPath, throwAtRead) {
4864
4922
  if (!depFieldCache.has(packageJsonPath)) {
4865
- const depFields = extractDepFields(readJSON(packageJsonPath, throwAtRead));
4866
- depFieldCache.set(packageJsonPath, depFields);
4923
+ const packageJson = readJSON(packageJsonPath, throwAtRead);
4924
+ if (packageJson) {
4925
+ const depFields = extractDepFields(packageJson);
4926
+ depFieldCache.set(packageJsonPath, depFields);
4927
+ }
4867
4928
  }
4868
4929
  return depFieldCache.get(packageJsonPath);
4869
4930
  }
@@ -4883,10 +4944,12 @@ var require_no_extraneous_dependencies = __commonJS({
4883
4944
  if (paths.length > 0) {
4884
4945
  for (const dir of paths) {
4885
4946
  const packageJsonPath = node_path_1.default.resolve(dir, "package.json");
4886
- const packageContent_ = getPackageDepFields(packageJsonPath, true);
4887
- for (const depsKey of Object.keys(packageContent)) {
4888
- const key = depsKey;
4889
- Object.assign(packageContent[key], packageContent_[key]);
4947
+ const packageContent_ = getPackageDepFields(packageJsonPath, paths.length === 1);
4948
+ if (packageContent_) {
4949
+ for (const depsKey of Object.keys(packageContent)) {
4950
+ const key = depsKey;
4951
+ Object.assign(packageContent[key], packageContent_[key]);
4952
+ }
4890
4953
  }
4891
4954
  }
4892
4955
  } else {
@@ -1256,6 +1256,9 @@ var require_array_element_newline = __commonJS({
1256
1256
  {
1257
1257
  type: "object",
1258
1258
  properties: {
1259
+ consistent: {
1260
+ type: "boolean"
1261
+ },
1259
1262
  multiline: {
1260
1263
  type: "boolean"
1261
1264
  },
@@ -1313,6 +1316,7 @@ var require_array_element_newline = __commonJS({
1313
1316
  consistent = true;
1314
1317
  minItems = Number.POSITIVE_INFINITY;
1315
1318
  } else {
1319
+ consistent = Boolean(option.consistent);
1316
1320
  multiline = Boolean(option.multiline);
1317
1321
  minItems = option.minItems || Number.POSITIVE_INFINITY;
1318
1322
  }
@@ -8637,16 +8641,22 @@ var require_object_curly_newline = __commonJS({
8637
8641
  ObjectExpression: normalizeOptionValue(options.ObjectExpression),
8638
8642
  ObjectPattern: normalizeOptionValue(options.ObjectPattern),
8639
8643
  ImportDeclaration: normalizeOptionValue(options.ImportDeclaration),
8640
- ExportNamedDeclaration: normalizeOptionValue(options.ExportDeclaration)
8644
+ ExportNamedDeclaration: normalizeOptionValue(options.ExportDeclaration),
8645
+ TSTypeLiteral: normalizeOptionValue(options.TSTypeLiteral),
8646
+ TSInterfaceBody: normalizeOptionValue(options.TSInterfaceBody)
8641
8647
  };
8642
8648
  }
8643
8649
  const value = normalizeOptionValue(options);
8644
- return { ObjectExpression: value, ObjectPattern: value, ImportDeclaration: value, ExportNamedDeclaration: value };
8650
+ return { ObjectExpression: value, ObjectPattern: value, ImportDeclaration: value, ExportNamedDeclaration: value, TSTypeLiteral: value, TSInterfaceBody: value };
8645
8651
  }
8646
8652
  function areLineBreaksRequired(node, options, first, last) {
8647
8653
  let objectProperties;
8648
8654
  if (node.type === "ObjectExpression" || node.type === "ObjectPattern") {
8649
8655
  objectProperties = node.properties;
8656
+ } else if (node.type === "TSTypeLiteral") {
8657
+ objectProperties = node.members;
8658
+ } else if (node.type === "TSInterfaceBody") {
8659
+ objectProperties = node.body;
8650
8660
  } else {
8651
8661
  objectProperties = node.specifiers.filter((s) => s.type === "ImportSpecifier" || s.type === "ExportSpecifier");
8652
8662
  }
@@ -8670,7 +8680,9 @@ var require_object_curly_newline = __commonJS({
8670
8680
  ObjectExpression: OPTION_VALUE,
8671
8681
  ObjectPattern: OPTION_VALUE,
8672
8682
  ImportDeclaration: OPTION_VALUE,
8673
- ExportDeclaration: OPTION_VALUE
8683
+ ExportDeclaration: OPTION_VALUE,
8684
+ TSTypeLiteral: OPTION_VALUE,
8685
+ TSInterfaceBody: OPTION_VALUE
8674
8686
  },
8675
8687
  additionalProperties: false,
8676
8688
  minProperties: 1
@@ -8771,7 +8783,9 @@ var require_object_curly_newline = __commonJS({
8771
8783
  ObjectExpression: check,
8772
8784
  ObjectPattern: check,
8773
8785
  ImportDeclaration: check,
8774
- ExportNamedDeclaration: check
8786
+ ExportNamedDeclaration: check,
8787
+ TSTypeLiteral: check,
8788
+ TSInterfaceBody: check
8775
8789
  };
8776
8790
  }
8777
8791
  });
@@ -14187,9 +14201,10 @@ var require_jsx_indent = __commonJS({
14187
14201
  meta: {
14188
14202
  type: "layout",
14189
14203
  docs: {
14190
- description: "Enforce JSX indentation",
14204
+ description: "Enforce JSX indentation. Deprecated, use `indent` rule instead.",
14191
14205
  url: utils.docsUrl("jsx-indent")
14192
14206
  },
14207
+ deprecated: true,
14193
14208
  fixable: "whitespace",
14194
14209
  messages,
14195
14210
  schema: [
@@ -16446,7 +16461,7 @@ var require_configs3 = __commonJS({
16446
16461
  };
16447
16462
  }
16448
16463
  }
16449
- var baseRule$f = utils.getESLintCoreRule("block-spacing");
16464
+ var baseRule$h = utils.getESLintCoreRule("block-spacing");
16450
16465
  var blockSpacing = utils.createRule({
16451
16466
  name: "block-spacing",
16452
16467
  meta: {
@@ -16456,14 +16471,14 @@ var require_configs3 = __commonJS({
16456
16471
  extendsBaseRule: true
16457
16472
  },
16458
16473
  fixable: "whitespace",
16459
- hasSuggestions: baseRule$f.meta.hasSuggestions,
16460
- schema: baseRule$f.meta.schema,
16461
- messages: baseRule$f.meta.messages
16474
+ hasSuggestions: baseRule$h.meta.hasSuggestions,
16475
+ schema: baseRule$h.meta.schema,
16476
+ messages: baseRule$h.meta.messages
16462
16477
  },
16463
16478
  defaultOptions: ["always"],
16464
16479
  create(context, [whenToApplyOption]) {
16465
16480
  const sourceCode = context.sourceCode;
16466
- const baseRules = baseRule$f.create(context);
16481
+ const baseRules = baseRule$h.create(context);
16467
16482
  const always = whenToApplyOption !== "never";
16468
16483
  const messageId = always ? "missing" : "extra";
16469
16484
  function getOpenBrace(node) {
@@ -16547,7 +16562,7 @@ var require_configs3 = __commonJS({
16547
16562
  };
16548
16563
  }
16549
16564
  });
16550
- var baseRule$e = utils.getESLintCoreRule("brace-style");
16565
+ var baseRule$g = utils.getESLintCoreRule("brace-style");
16551
16566
  var braceStyle = utils.createRule({
16552
16567
  name: "brace-style",
16553
16568
  meta: {
@@ -16556,17 +16571,17 @@ var require_configs3 = __commonJS({
16556
16571
  description: "Enforce consistent brace style for blocks",
16557
16572
  extendsBaseRule: true
16558
16573
  },
16559
- messages: baseRule$e.meta.messages,
16560
- fixable: baseRule$e.meta.fixable,
16561
- hasSuggestions: baseRule$e.meta.hasSuggestions,
16562
- schema: baseRule$e.meta.schema
16574
+ messages: baseRule$g.meta.messages,
16575
+ fixable: baseRule$g.meta.fixable,
16576
+ hasSuggestions: baseRule$g.meta.hasSuggestions,
16577
+ schema: baseRule$g.meta.schema
16563
16578
  },
16564
16579
  defaultOptions: ["1tbs"],
16565
16580
  create(context) {
16566
16581
  const [style, { allowSingleLine } = { allowSingleLine: false }] = context.options;
16567
16582
  const isAllmanStyle = style === "allman";
16568
16583
  const sourceCode = context.sourceCode;
16569
- const rules2 = baseRule$e.create(context);
16584
+ const rules2 = baseRule$g.create(context);
16570
16585
  function validateCurlyPair(openingCurlyToken, closingCurlyToken) {
16571
16586
  if (allowSingleLine && astUtils.isTokenOnSameLine(openingCurlyToken, closingCurlyToken)) {
16572
16587
  return;
@@ -16632,7 +16647,7 @@ var require_configs3 = __commonJS({
16632
16647
  };
16633
16648
  }
16634
16649
  });
16635
- var baseRule$d = utils.getESLintCoreRule("comma-dangle");
16650
+ var baseRule$f = utils.getESLintCoreRule("comma-dangle");
16636
16651
  var OPTION_VALUE_SCHEME = [
16637
16652
  "always-multiline",
16638
16653
  "always",
@@ -16700,12 +16715,12 @@ var require_configs3 = __commonJS({
16700
16715
  additionalItems: false
16701
16716
  },
16702
16717
  fixable: "code",
16703
- hasSuggestions: baseRule$d.meta.hasSuggestions,
16704
- messages: baseRule$d.meta.messages
16718
+ hasSuggestions: baseRule$f.meta.hasSuggestions,
16719
+ messages: baseRule$f.meta.messages
16705
16720
  },
16706
16721
  defaultOptions: ["never"],
16707
16722
  create(context, [options]) {
16708
- const rules2 = baseRule$d.create(context);
16723
+ const rules2 = baseRule$f.create(context);
16709
16724
  const sourceCode = context.sourceCode;
16710
16725
  const normalizedOptions = normalizeOptions(options);
16711
16726
  const isTSX = context.parserOptions?.ecmaFeatures?.jsx && context.filename?.endsWith(".tsx");
@@ -17039,7 +17054,7 @@ var require_configs3 = __commonJS({
17039
17054
  };
17040
17055
  }
17041
17056
  });
17042
- var baseRule$c = utils.getESLintCoreRule("indent");
17057
+ var baseRule$e = utils.getESLintCoreRule("indent");
17043
17058
  var KNOWN_NODES = /* @__PURE__ */ new Set([
17044
17059
  // Class properties aren't yet supported by eslint...
17045
17060
  utils$1.AST_NODE_TYPES.PropertyDefinition,
@@ -17116,9 +17131,9 @@ var require_configs3 = __commonJS({
17116
17131
  extendsBaseRule: true
17117
17132
  },
17118
17133
  fixable: "whitespace",
17119
- hasSuggestions: baseRule$c.meta.hasSuggestions,
17120
- schema: baseRule$c.meta.schema,
17121
- messages: baseRule$c.meta.messages
17134
+ hasSuggestions: baseRule$e.meta.hasSuggestions,
17135
+ schema: baseRule$e.meta.schema,
17136
+ messages: baseRule$e.meta.messages
17122
17137
  },
17123
17138
  defaultOptions: [
17124
17139
  // typescript docs and playground use 4 space indent
@@ -17139,7 +17154,7 @@ var require_configs3 = __commonJS({
17139
17154
  value: optionsWithDefaults
17140
17155
  }
17141
17156
  });
17142
- const rules2 = baseRule$c.create(contextWithDefaults);
17157
+ const rules2 = baseRule$e.create(contextWithDefaults);
17143
17158
  function TSPropertySignatureToProperty(node, type = utils$1.AST_NODE_TYPES.Property) {
17144
17159
  const base = {
17145
17160
  // indent doesn't actually use these
@@ -17470,8 +17485,8 @@ var require_configs3 = __commonJS({
17470
17485
  };
17471
17486
  }
17472
17487
  });
17473
- var baseRule$b = utils.getESLintCoreRule("key-spacing");
17474
- var baseSchema$1 = Array.isArray(baseRule$b.meta.schema) ? baseRule$b.meta.schema[0] : baseRule$b.meta.schema;
17488
+ var baseRule$d = utils.getESLintCoreRule("key-spacing");
17489
+ var baseSchema$1 = Array.isArray(baseRule$d.meta.schema) ? baseRule$d.meta.schema[0] : baseRule$d.meta.schema;
17475
17490
  function at(arr, position) {
17476
17491
  if (position < 0)
17477
17492
  return arr[arr.length + position];
@@ -17486,15 +17501,15 @@ var require_configs3 = __commonJS({
17486
17501
  extendsBaseRule: true
17487
17502
  },
17488
17503
  fixable: "whitespace",
17489
- hasSuggestions: baseRule$b.meta.hasSuggestions,
17504
+ hasSuggestions: baseRule$d.meta.hasSuggestions,
17490
17505
  schema: [baseSchema$1],
17491
- messages: baseRule$b.meta.messages
17506
+ messages: baseRule$d.meta.messages
17492
17507
  },
17493
17508
  defaultOptions: [{}],
17494
17509
  create(context, [_options]) {
17495
17510
  const options = _options || {};
17496
17511
  const sourceCode = context.sourceCode;
17497
- const baseRules = baseRule$b.create(context);
17512
+ const baseRules = baseRule$d.create(context);
17498
17513
  function adjustedColumn(position) {
17499
17514
  const line = position.line - 1;
17500
17515
  return utils.getStringLength(
@@ -17707,8 +17722,8 @@ var require_configs3 = __commonJS({
17707
17722
  };
17708
17723
  }
17709
17724
  });
17710
- var baseRule$a = utils.getESLintCoreRule("keyword-spacing");
17711
- var baseSchema = Array.isArray(baseRule$a.meta.schema) ? baseRule$a.meta.schema[0] : baseRule$a.meta.schema;
17725
+ var baseRule$c = utils.getESLintCoreRule("keyword-spacing");
17726
+ var baseSchema = Array.isArray(baseRule$c.meta.schema) ? baseRule$c.meta.schema[0] : baseRule$c.meta.schema;
17712
17727
  var schema$1 = utils.deepMerge(
17713
17728
  baseSchema,
17714
17729
  {
@@ -17730,15 +17745,15 @@ var require_configs3 = __commonJS({
17730
17745
  extendsBaseRule: true
17731
17746
  },
17732
17747
  fixable: "whitespace",
17733
- hasSuggestions: baseRule$a.meta.hasSuggestions,
17748
+ hasSuggestions: baseRule$c.meta.hasSuggestions,
17734
17749
  schema: [schema$1],
17735
- messages: baseRule$a.meta.messages
17750
+ messages: baseRule$c.meta.messages
17736
17751
  },
17737
17752
  defaultOptions: [{}],
17738
17753
  create(context, [options]) {
17739
17754
  const { after, overrides } = options ?? {};
17740
17755
  const sourceCode = context.sourceCode;
17741
- const baseRules = baseRule$a.create(context);
17756
+ const baseRules = baseRule$c.create(context);
17742
17757
  return {
17743
17758
  ...baseRules,
17744
17759
  TSAsExpression(node) {
@@ -17788,7 +17803,7 @@ var require_configs3 = __commonJS({
17788
17803
  };
17789
17804
  }
17790
17805
  });
17791
- var baseRule$9 = utils.getESLintCoreRule("lines-around-comment");
17806
+ var baseRule$b = utils.getESLintCoreRule("lines-around-comment");
17792
17807
  var COMMENTS_IGNORE_PATTERN = /^\s*(?:eslint|jshint\s+|jslint\s+|istanbul\s+|globals?\s+|exported\s+|jscs)/u;
17793
17808
  function getEmptyLineNums(lines) {
17794
17809
  const emptyLines = lines.map((line, i) => ({
@@ -17897,9 +17912,9 @@ var require_configs3 = __commonJS({
17897
17912
  additionalProperties: false
17898
17913
  }
17899
17914
  ],
17900
- fixable: baseRule$9.meta.fixable,
17901
- hasSuggestions: baseRule$9.meta.hasSuggestions,
17902
- messages: baseRule$9.meta.messages
17915
+ fixable: baseRule$b.meta.fixable,
17916
+ hasSuggestions: baseRule$b.meta.hasSuggestions,
17917
+ messages: baseRule$b.meta.messages
17903
17918
  },
17904
17919
  defaultOptions: [
17905
17920
  {
@@ -18050,7 +18065,7 @@ var require_configs3 = __commonJS({
18050
18065
  }
18051
18066
  }
18052
18067
  );
18053
- const rules2 = baseRule$9.create(proxiedContext);
18068
+ const rules2 = baseRule$b.create(proxiedContext);
18054
18069
  return {
18055
18070
  Program(node) {
18056
18071
  rules2.Program(node);
@@ -18075,10 +18090,10 @@ var require_configs3 = __commonJS({
18075
18090
  };
18076
18091
  }
18077
18092
  });
18078
- var baseRule$8 = utils.getESLintCoreRule("lines-between-class-members");
18093
+ var baseRule$a = utils.getESLintCoreRule("lines-between-class-members");
18079
18094
  var schema = Object.values(
18080
18095
  utils.deepMerge(
18081
- { ...baseRule$8.meta.schema },
18096
+ { ...baseRule$a.meta.schema },
18082
18097
  {
18083
18098
  1: {
18084
18099
  properties: {
@@ -18100,9 +18115,9 @@ var require_configs3 = __commonJS({
18100
18115
  extendsBaseRule: true
18101
18116
  },
18102
18117
  fixable: "whitespace",
18103
- hasSuggestions: baseRule$8.meta.hasSuggestions,
18118
+ hasSuggestions: baseRule$a.meta.hasSuggestions,
18104
18119
  schema,
18105
- messages: baseRule$8.meta.messages
18120
+ messages: baseRule$a.meta.messages
18106
18121
  },
18107
18122
  defaultOptions: [
18108
18123
  "always",
@@ -18112,7 +18127,7 @@ var require_configs3 = __commonJS({
18112
18127
  }
18113
18128
  ],
18114
18129
  create(context, [firstOption, secondOption]) {
18115
- const rules2 = baseRule$8.create(context);
18130
+ const rules2 = baseRule$a.create(context);
18116
18131
  const exceptAfterOverload = secondOption?.exceptAfterOverload && firstOption === "always";
18117
18132
  function isOverload(node) {
18118
18133
  return (node.type === utils$1.AST_NODE_TYPES.TSAbstractMethodDefinition || node.type === utils$1.AST_NODE_TYPES.MethodDefinition) && node.value.type === utils$1.AST_NODE_TYPES.TSEmptyBodyFunctionExpression;
@@ -18349,7 +18364,7 @@ var require_configs3 = __commonJS({
18349
18364
  };
18350
18365
  }
18351
18366
  });
18352
- var baseRule$7 = utils.getESLintCoreRule("no-extra-parens");
18367
+ var baseRule$9 = utils.getESLintCoreRule("no-extra-parens");
18353
18368
  var noExtraParens = utils.createRule({
18354
18369
  name: "no-extra-parens",
18355
18370
  meta: {
@@ -18359,14 +18374,14 @@ var require_configs3 = __commonJS({
18359
18374
  extendsBaseRule: true
18360
18375
  },
18361
18376
  fixable: "code",
18362
- hasSuggestions: baseRule$7.meta.hasSuggestions,
18363
- schema: baseRule$7.meta.schema,
18364
- messages: baseRule$7.meta.messages
18377
+ hasSuggestions: baseRule$9.meta.hasSuggestions,
18378
+ schema: baseRule$9.meta.schema,
18379
+ messages: baseRule$9.meta.messages
18365
18380
  },
18366
18381
  defaultOptions: ["all"],
18367
18382
  create(context) {
18368
18383
  const sourceCode = context.sourceCode;
18369
- const rules2 = baseRule$7.create(context);
18384
+ const rules2 = baseRule$9.create(context);
18370
18385
  function binaryExp(node) {
18371
18386
  const rule = rules2.BinaryExpression;
18372
18387
  const isLeftTypeAssertion = astUtils.isTypeAssertion(node.left);
@@ -18639,7 +18654,7 @@ var require_configs3 = __commonJS({
18639
18654
  return Object.assign({}, rules2, overrides);
18640
18655
  }
18641
18656
  });
18642
- var baseRule$6 = utils.getESLintCoreRule("no-extra-semi");
18657
+ var baseRule$8 = utils.getESLintCoreRule("no-extra-semi");
18643
18658
  var noExtraSemi = utils.createRule({
18644
18659
  name: "no-extra-semi",
18645
18660
  meta: {
@@ -18649,13 +18664,13 @@ var require_configs3 = __commonJS({
18649
18664
  extendsBaseRule: true
18650
18665
  },
18651
18666
  fixable: "code",
18652
- hasSuggestions: baseRule$6.meta.hasSuggestions,
18653
- schema: baseRule$6.meta.schema,
18654
- messages: baseRule$6.meta.messages
18667
+ hasSuggestions: baseRule$8.meta.hasSuggestions,
18668
+ schema: baseRule$8.meta.schema,
18669
+ messages: baseRule$8.meta.messages
18655
18670
  },
18656
18671
  defaultOptions: [],
18657
18672
  create(context) {
18658
- const rules2 = baseRule$6.create(context);
18673
+ const rules2 = baseRule$8.create(context);
18659
18674
  return {
18660
18675
  ...rules2,
18661
18676
  "TSAbstractMethodDefinition, TSAbstractPropertyDefinition": function(node) {
@@ -18664,12 +18679,38 @@ var require_configs3 = __commonJS({
18664
18679
  };
18665
18680
  }
18666
18681
  });
18667
- var baseRule$5 = utils.getESLintCoreRule("object-curly-spacing");
18682
+ var baseRule$7 = utils.getESLintCoreRule("object-curly-newline");
18683
+ var defaultOptionValue = { multiline: false, minProperties: Number.POSITIVE_INFINITY, consistent: true };
18684
+ var objectCurlyNewline = utils.createRule({
18685
+ name: "object-curly-newline",
18686
+ meta: {
18687
+ ...baseRule$7.meta,
18688
+ docs: {
18689
+ description: "Enforce consistent line breaks after opening and before closing braces",
18690
+ extendsBaseRule: true
18691
+ }
18692
+ },
18693
+ defaultOptions: [
18694
+ {
18695
+ ObjectExpression: defaultOptionValue,
18696
+ ObjectPattern: defaultOptionValue,
18697
+ ImportDeclaration: defaultOptionValue,
18698
+ ExportDeclaration: defaultOptionValue,
18699
+ TSTypeLiteral: defaultOptionValue,
18700
+ TSInterfaceBody: defaultOptionValue
18701
+ }
18702
+ ],
18703
+ create(context) {
18704
+ const rules2 = baseRule$7.create(context);
18705
+ return rules2;
18706
+ }
18707
+ });
18708
+ var baseRule$6 = utils.getESLintCoreRule("object-curly-spacing");
18668
18709
  var objectCurlySpacing = utils.createRule({
18669
18710
  name: "object-curly-spacing",
18670
18711
  //
18671
18712
  meta: {
18672
- ...baseRule$5.meta,
18713
+ ...baseRule$6.meta,
18673
18714
  docs: {
18674
18715
  description: "Enforce consistent spacing inside braces",
18675
18716
  extendsBaseRule: true
@@ -18776,7 +18817,7 @@ var require_configs3 = __commonJS({
18776
18817
  const lastProperty = node.members[node.members.length - 1];
18777
18818
  return sourceCode.getTokenAfter(lastProperty, astUtils.isClosingBraceToken);
18778
18819
  }
18779
- const rules2 = baseRule$5.create(context);
18820
+ const rules2 = baseRule$6.create(context);
18780
18821
  return {
18781
18822
  ...rules2,
18782
18823
  TSMappedType(node) {
@@ -18806,6 +18847,43 @@ var require_configs3 = __commonJS({
18806
18847
  };
18807
18848
  }
18808
18849
  });
18850
+ var baseRule$5 = utils.getESLintCoreRule("object-property-newline");
18851
+ var objectPropertyNewline = utils.createRule({
18852
+ name: "object-property-newline",
18853
+ meta: {
18854
+ ...baseRule$5.meta,
18855
+ docs: {
18856
+ description: "Enforce placing object properties on separate lines",
18857
+ extendsBaseRule: true
18858
+ }
18859
+ },
18860
+ defaultOptions: [
18861
+ {
18862
+ allowAllPropertiesOnSameLine: false,
18863
+ allowMultiplePropertiesPerLine: false
18864
+ }
18865
+ ],
18866
+ create(context) {
18867
+ const rules2 = baseRule$5.create(context);
18868
+ return {
18869
+ ...rules2,
18870
+ TSTypeLiteral(node) {
18871
+ return rules2.ObjectExpression({
18872
+ ...node,
18873
+ // @ts-expect-error only used to get token and loc
18874
+ properties: node.members
18875
+ });
18876
+ },
18877
+ TSInterfaceBody(node) {
18878
+ return rules2.ObjectExpression({
18879
+ ...node,
18880
+ // @ts-expect-error only used to get token and loc
18881
+ properties: node.body
18882
+ });
18883
+ }
18884
+ };
18885
+ }
18886
+ });
18809
18887
  var CJS_EXPORT = /^(?:module\s*\.\s*)?exports(?:\s*\.|\s*\[|$)/u;
18810
18888
  var CJS_IMPORT = /^require\(/u;
18811
18889
  var LT = `[${Array.from(
@@ -19893,7 +19971,9 @@ var require_configs3 = __commonJS({
19893
19971
  "member-delimiter-style": memberDelimiterStyle,
19894
19972
  "no-extra-parens": noExtraParens,
19895
19973
  "no-extra-semi": noExtraSemi,
19974
+ "object-curly-newline": objectCurlyNewline,
19896
19975
  "object-curly-spacing": objectCurlySpacing,
19976
+ "object-property-newline": objectPropertyNewline,
19897
19977
  "padding-line-between-statements": paddingLineBetweenStatements,
19898
19978
  "quote-props": quoteProps,
19899
19979
  "quotes": quotes,
@@ -19921,7 +20001,9 @@ var require_configs3 = __commonJS({
19921
20001
  "@typescript-eslint/member-delimiter-style": 0,
19922
20002
  "@typescript-eslint/no-extra-parens": 0,
19923
20003
  "@typescript-eslint/no-extra-semi": 0,
20004
+ "@typescript-eslint/object-curly-newline": 0,
19924
20005
  "@typescript-eslint/object-curly-spacing": 0,
20006
+ "@typescript-eslint/object-property-newline": 0,
19925
20007
  "@typescript-eslint/padding-line-between-statements": 0,
19926
20008
  "@typescript-eslint/quote-props": 0,
19927
20009
  "@typescript-eslint/quotes": 0,
@@ -19951,7 +20033,9 @@ var require_configs3 = __commonJS({
19951
20033
  exports2.memberDelimiterStyle = memberDelimiterStyle;
19952
20034
  exports2.noExtraParens = noExtraParens;
19953
20035
  exports2.noExtraSemi = noExtraSemi;
20036
+ exports2.objectCurlyNewline = objectCurlyNewline;
19954
20037
  exports2.objectCurlySpacing = objectCurlySpacing;
20038
+ exports2.objectPropertyNewline = objectPropertyNewline;
19955
20039
  exports2.paddingLineBetweenStatements = paddingLineBetweenStatements;
19956
20040
  exports2.plugin = plugin;
19957
20041
  exports2.quoteProps = quoteProps;
@@ -20494,22 +20578,6 @@ var require_configs4 = __commonJS({
20494
20578
  ignoreComments: false,
20495
20579
  ignoredNodes: [
20496
20580
  "TemplateLiteral *",
20497
- "JSXElement",
20498
- "JSXElement > *",
20499
- "JSXAttribute",
20500
- "JSXIdentifier",
20501
- "JSXNamespacedName",
20502
- "JSXMemberExpression",
20503
- "JSXSpreadAttribute",
20504
- "JSXExpressionContainer",
20505
- "JSXOpeningElement",
20506
- "JSXClosingElement",
20507
- "JSXFragment",
20508
- "JSXOpeningFragment",
20509
- "JSXClosingFragment",
20510
- "JSXText",
20511
- "JSXEmptyExpression",
20512
- "JSXSpreadChild",
20513
20581
  "TSUnionType",
20514
20582
  "TSIntersectionType",
20515
20583
  "TSTypeParameterInstantiation",
@@ -20605,7 +20673,6 @@ var require_configs4 = __commonJS({
20605
20673
  "@stylistic/jsx-equals-spacing": "error",
20606
20674
  "@stylistic/jsx-first-prop-new-line": "error",
20607
20675
  "@stylistic/jsx-function-call-newline": ["error", "multiline"],
20608
- "@stylistic/jsx-indent": ["error", indent, { checkAttributes: true, indentLogicalExpressions: true }],
20609
20676
  "@stylistic/jsx-indent-props": ["error", indent],
20610
20677
  "@stylistic/jsx-max-props-per-line": ["error", { maximum: 1, when: "multiline" }],
20611
20678
  "@stylistic/jsx-one-expression-per-line": ["error", { allow: "single-child" }],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plugjs/eslint-plugin",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
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.30",
22
+ "@eslint/js": "9.6.0",
23
+ "@typescript-eslint/utils": "8.0.0-alpha.40",
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.30"
44
+ "typescript": "5.5.3",
45
+ "typescript-eslint": "8.0.0-alpha.39"
45
46
  }
46
47
  }