@storm-software/eslint 0.170.91 → 0.170.93

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/preset.cjs CHANGED
@@ -5867,7 +5867,9 @@ function excludeShebangs(comments) {
5867
5867
  function getLeadingComments(context, node2) {
5868
5868
  const firstBodyNode = Array.isArray(node2.body) && node2.body.length ? node2.body[0] : node2;
5869
5869
  const all = excludeShebangs(
5870
- context.getSourceCode().getAllComments(firstBodyNode)
5870
+ (context.sourceCode || context.getSourceCode()).getAllComments(
5871
+ firstBodyNode
5872
+ )
5871
5873
  );
5872
5874
  if (!all.length) {
5873
5875
  return [];
@@ -5882,7 +5884,7 @@ function getLeadingComments(context, node2) {
5882
5884
  if (!prev || !current) {
5883
5885
  break;
5884
5886
  }
5885
- const txt = context.getSourceCode().getText().slice(prev.range[1], current.range[0]);
5887
+ const txt = (context.sourceCode || context.getSourceCode()).getText().slice(prev.range[1], current.range[0]);
5886
5888
  if (!txt.match(/^(\r\n|\r|\n)$/)) {
5887
5889
  break;
5888
5890
  }
@@ -5903,7 +5905,7 @@ function genCommentsRange(context, comments, eol) {
5903
5905
  }
5904
5906
  const start = comments[0].range[0];
5905
5907
  let end = comments.slice(-1)[0]?.range[1] ?? start;
5906
- if (context.getSourceCode().text[end] === eol) {
5908
+ if ((context.sourceCode || context.getSourceCode()).text[end] === eol) {
5907
5909
  end += eol.length;
5908
5910
  }
5909
5911
  return [start, end];
@@ -6063,7 +6065,11 @@ var banner_default = createRule({
6063
6065
  return {
6064
6066
  Program(node2) {
6065
6067
  const normalizedNewlines = newlines ?? 1;
6066
- if (!hasBanner(normalizedCommentStyle, context.sourceCode.getText(), eol)) {
6068
+ if (!hasBanner(
6069
+ normalizedCommentStyle,
6070
+ (context.sourceCode || context.getSourceCode()).getText(),
6071
+ eol
6072
+ )) {
6067
6073
  context.report({
6068
6074
  loc: node2.loc,
6069
6075
  messageId: "missingBanner",
@@ -6164,7 +6170,7 @@ var banner_default = createRule({
6164
6170
  if (!lastLeadingComment) {
6165
6171
  return;
6166
6172
  }
6167
- const postLineBanner = context.sourceCode.text.substr(
6173
+ const postLineBanner = (context.sourceCode || context.getSourceCode()).text.substr(
6168
6174
  lastLeadingComment.range[1],
6169
6175
  normalizedNewlines * 2
6170
6176
  );
@@ -6217,7 +6223,7 @@ var banner_default = createRule({
6217
6223
  )
6218
6224
  });
6219
6225
  } else {
6220
- const postBlockBanner = context.sourceCode.text.substr(
6226
+ const postBlockBanner = (context.sourceCode || context.getSourceCode()).text.substr(
6221
6227
  firstLeadingComment2.range[1],
6222
6228
  normalizedNewlines * 2
6223
6229
  );
@@ -20796,7 +20802,7 @@ async function typescript(options = {}) {
20796
20802
  allowDefaultProject: [GLOB_SRC_FILE],
20797
20803
  defaultProject: tsconfigPath
20798
20804
  },
20799
- tsconfigRootDir: findWorkspaceRoot2()
20805
+ tsconfigRootDir: !tsconfigPath ? findWorkspaceRoot2() : path16.dirname(tsconfigPath)
20800
20806
  } : {},
20801
20807
  ...parserOptions
20802
20808
  }
@@ -21289,13 +21295,6 @@ function preset(options, ...userConfigs) {
21289
21295
  );
21290
21296
  }
21291
21297
  }
21292
- const typescriptOptions = resolveSubOptions(options, "typescript");
21293
- if (typescriptOptions.tsconfigPath !== false) {
21294
- typescriptOptions.tsconfigPath = getTsConfigPath(
21295
- typescriptOptions.tsconfigPath,
21296
- options.type
21297
- );
21298
- }
21299
21298
  configs6.push(
21300
21299
  ignores(options.ignores),
21301
21300
  javascript({
@@ -21310,6 +21309,27 @@ function preset(options, ...userConfigs) {
21310
21309
  perfectionist(),
21311
21310
  secrets({ json: options.jsonc !== false })
21312
21311
  );
21312
+ let typescriptOptions = {};
21313
+ if (enableTypeScript) {
21314
+ typescriptOptions = resolveSubOptions(options, "typescript");
21315
+ if (typescriptOptions.tsconfigPath !== false) {
21316
+ typescriptOptions.tsconfigPath = getTsConfigPath(
21317
+ typescriptOptions.tsconfigPath,
21318
+ options.type
21319
+ );
21320
+ }
21321
+ }
21322
+ if (enableTypeScript) {
21323
+ configs6.push(
21324
+ typescript({
21325
+ ...typescriptOptions,
21326
+ tsconfigPath: typescriptOptions.tsconfigPath === false ? void 0 : typescriptOptions.tsconfigPath,
21327
+ componentExts,
21328
+ overrides: getOverrides(options, "typescript"),
21329
+ type: options.type
21330
+ })
21331
+ );
21332
+ }
21313
21333
  if (enableBanner) {
21314
21334
  configs6.push(
21315
21335
  banner({
@@ -21347,17 +21367,6 @@ function preset(options, ...userConfigs) {
21347
21367
  if (enableJsx) {
21348
21368
  configs6.push(jsx());
21349
21369
  }
21350
- if (enableTypeScript) {
21351
- configs6.push(
21352
- typescript({
21353
- ...typescriptOptions,
21354
- tsconfigPath: typescriptOptions.tsconfigPath === false ? void 0 : typescriptOptions.tsconfigPath,
21355
- componentExts,
21356
- overrides: getOverrides(options, "typescript"),
21357
- type: options.type
21358
- })
21359
- );
21360
- }
21361
21370
  if (enableZod) {
21362
21371
  configs6.push(
21363
21372
  zod({
package/dist/preset.js CHANGED
@@ -14,7 +14,7 @@ import { loadConfig } from 'c12';
14
14
  import defu from 'defu';
15
15
  import chalk from 'chalk';
16
16
  import fs3, { existsSync, readFileSync } from 'node:fs';
17
- import path16, { join } from 'node:path';
17
+ import path16, { dirname as dirname$1, join } from 'node:path';
18
18
  import { readFile } from 'node:fs/promises';
19
19
  import { EOL } from 'node:os';
20
20
  import cspellConfig from '@cspell/eslint-plugin/recommended';
@@ -5726,7 +5726,9 @@ function excludeShebangs(comments) {
5726
5726
  function getLeadingComments(context, node2) {
5727
5727
  const firstBodyNode = Array.isArray(node2.body) && node2.body.length ? node2.body[0] : node2;
5728
5728
  const all = excludeShebangs(
5729
- context.getSourceCode().getAllComments(firstBodyNode)
5729
+ (context.sourceCode || context.getSourceCode()).getAllComments(
5730
+ firstBodyNode
5731
+ )
5730
5732
  );
5731
5733
  if (!all.length) {
5732
5734
  return [];
@@ -5741,7 +5743,7 @@ function getLeadingComments(context, node2) {
5741
5743
  if (!prev || !current) {
5742
5744
  break;
5743
5745
  }
5744
- const txt = context.getSourceCode().getText().slice(prev.range[1], current.range[0]);
5746
+ const txt = (context.sourceCode || context.getSourceCode()).getText().slice(prev.range[1], current.range[0]);
5745
5747
  if (!txt.match(/^(\r\n|\r|\n)$/)) {
5746
5748
  break;
5747
5749
  }
@@ -5762,7 +5764,7 @@ function genCommentsRange(context, comments, eol) {
5762
5764
  }
5763
5765
  const start = comments[0].range[0];
5764
5766
  let end = comments.slice(-1)[0]?.range[1] ?? start;
5765
- if (context.getSourceCode().text[end] === eol) {
5767
+ if ((context.sourceCode || context.getSourceCode()).text[end] === eol) {
5766
5768
  end += eol.length;
5767
5769
  }
5768
5770
  return [start, end];
@@ -5922,7 +5924,11 @@ var banner_default = createRule({
5922
5924
  return {
5923
5925
  Program(node2) {
5924
5926
  const normalizedNewlines = newlines ?? 1;
5925
- if (!hasBanner(normalizedCommentStyle, context.sourceCode.getText(), eol)) {
5927
+ if (!hasBanner(
5928
+ normalizedCommentStyle,
5929
+ (context.sourceCode || context.getSourceCode()).getText(),
5930
+ eol
5931
+ )) {
5926
5932
  context.report({
5927
5933
  loc: node2.loc,
5928
5934
  messageId: "missingBanner",
@@ -6023,7 +6029,7 @@ var banner_default = createRule({
6023
6029
  if (!lastLeadingComment) {
6024
6030
  return;
6025
6031
  }
6026
- const postLineBanner = context.sourceCode.text.substr(
6032
+ const postLineBanner = (context.sourceCode || context.getSourceCode()).text.substr(
6027
6033
  lastLeadingComment.range[1],
6028
6034
  normalizedNewlines * 2
6029
6035
  );
@@ -6076,7 +6082,7 @@ var banner_default = createRule({
6076
6082
  )
6077
6083
  });
6078
6084
  } else {
6079
- const postBlockBanner = context.sourceCode.text.substr(
6085
+ const postBlockBanner = (context.sourceCode || context.getSourceCode()).text.substr(
6080
6086
  firstLeadingComment2.range[1],
6081
6087
  normalizedNewlines * 2
6082
6088
  );
@@ -20397,7 +20403,7 @@ async function typescript(options = {}) {
20397
20403
  allowDefaultProject: [GLOB_SRC_FILE],
20398
20404
  defaultProject: tsconfigPath
20399
20405
  },
20400
- tsconfigRootDir: findWorkspaceRoot()
20406
+ tsconfigRootDir: !tsconfigPath ? findWorkspaceRoot() : dirname$1(tsconfigPath)
20401
20407
  } : {},
20402
20408
  ...parserOptions
20403
20409
  }
@@ -20853,13 +20859,6 @@ function preset(options, ...userConfigs) {
20853
20859
  );
20854
20860
  }
20855
20861
  }
20856
- const typescriptOptions = resolveSubOptions(options, "typescript");
20857
- if (typescriptOptions.tsconfigPath !== false) {
20858
- typescriptOptions.tsconfigPath = getTsConfigPath(
20859
- typescriptOptions.tsconfigPath,
20860
- options.type
20861
- );
20862
- }
20863
20862
  configs6.push(
20864
20863
  ignores(options.ignores),
20865
20864
  javascript({
@@ -20874,6 +20873,27 @@ function preset(options, ...userConfigs) {
20874
20873
  perfectionist(),
20875
20874
  secrets({ json: options.jsonc !== false })
20876
20875
  );
20876
+ let typescriptOptions = {};
20877
+ if (enableTypeScript) {
20878
+ typescriptOptions = resolveSubOptions(options, "typescript");
20879
+ if (typescriptOptions.tsconfigPath !== false) {
20880
+ typescriptOptions.tsconfigPath = getTsConfigPath(
20881
+ typescriptOptions.tsconfigPath,
20882
+ options.type
20883
+ );
20884
+ }
20885
+ }
20886
+ if (enableTypeScript) {
20887
+ configs6.push(
20888
+ typescript({
20889
+ ...typescriptOptions,
20890
+ tsconfigPath: typescriptOptions.tsconfigPath === false ? void 0 : typescriptOptions.tsconfigPath,
20891
+ componentExts,
20892
+ overrides: getOverrides(options, "typescript"),
20893
+ type: options.type
20894
+ })
20895
+ );
20896
+ }
20877
20897
  if (enableBanner) {
20878
20898
  configs6.push(
20879
20899
  banner({
@@ -20911,17 +20931,6 @@ function preset(options, ...userConfigs) {
20911
20931
  if (enableJsx) {
20912
20932
  configs6.push(jsx());
20913
20933
  }
20914
- if (enableTypeScript) {
20915
- configs6.push(
20916
- typescript({
20917
- ...typescriptOptions,
20918
- tsconfigPath: typescriptOptions.tsconfigPath === false ? void 0 : typescriptOptions.tsconfigPath,
20919
- componentExts,
20920
- overrides: getOverrides(options, "typescript"),
20921
- type: options.type
20922
- })
20923
- );
20924
- }
20925
20934
  if (enableZod) {
20926
20935
  configs6.push(
20927
20936
  zod({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storm-software/eslint",
3
- "version": "0.170.91",
3
+ "version": "0.170.93",
4
4
  "private": false,
5
5
  "description": "A package containing the base ESLint configuration used by Storm Software across many projects.",
6
6
  "keywords": [
@@ -196,7 +196,7 @@
196
196
  "@next/eslint-plugin-next": "^15.5.19",
197
197
  "@nx/eslint": "22.7.5",
198
198
  "@prettier/plugin-xml": "^3.4.2",
199
- "@storm-software/eslint-plugin-banner": "^0.0.25",
199
+ "@storm-software/eslint-plugin-banner": "0.0.26",
200
200
  "@storm-software/eslint-plugin-pnpm": "^0.0.24",
201
201
  "@storm-software/eslint-plugin-tsdoc": "^0.0.24",
202
202
  "@stylistic/eslint-plugin-migrate": "^4.4.1",
@@ -271,5 +271,5 @@
271
271
  "zod": { "optional": true }
272
272
  },
273
273
  "publishConfig": { "access": "public" },
274
- "gitHead": "68cf7b0a3e91562c05d5b4fb909326e65066c262"
274
+ "gitHead": "679dea48cf6192e6df471e5d9b810c7828a96b89"
275
275
  }