@storm-software/eslint 0.170.92 → 0.170.94

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
@@ -5707,7 +5707,7 @@ init_cjs_shims();
5707
5707
 
5708
5708
  // ../eslint-plugin-banner/package.json
5709
5709
  var package_default = {
5710
- version: "0.0.25"};
5710
+ version: "0.0.26"};
5711
5711
 
5712
5712
  // ../eslint-plugin-banner/src/rules/banner.ts
5713
5713
  init_cjs_shims();
@@ -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
  );
@@ -6484,6 +6490,13 @@ var relative = function(from, to) {
6484
6490
  }
6485
6491
  return [..._from.map(() => ".."), ..._to].join("/");
6486
6492
  };
6493
+ var dirname = function(p) {
6494
+ const segments = normalizeWindowsPath2(p).replace(/\/$/, "").split("/").slice(0, -1);
6495
+ if (segments.length === 1 && _DRIVE_LETTER_RE2.test(segments[0])) {
6496
+ segments[0] += "/";
6497
+ }
6498
+ return segments.join("/") || (isAbsolute2(p) ? "/" : ".");
6499
+ };
6487
6500
 
6488
6501
  // src/utils/find-workspace-root.ts
6489
6502
  init_cjs_shims();
@@ -20089,6 +20102,7 @@ async function react(options = {}) {
20089
20102
  ignoresTypeAware = [`${GLOB_MARKDOWN}/**`, GLOB_ASTRO_TS],
20090
20103
  strict = false,
20091
20104
  overrides = {},
20105
+ componentExts = [],
20092
20106
  tsconfigPath
20093
20107
  } = options;
20094
20108
  await ensurePackages([
@@ -20130,8 +20144,11 @@ async function react(options = {}) {
20130
20144
  (i) => localPkg.isPackageExists(i)
20131
20145
  );
20132
20146
  const isUsingReactRouter = ReactRouterPackages.some((i) => localPkg.isPackageExists(i));
20147
+ const [pluginTs, parserTs] = await Promise.all([
20148
+ interopDefault(import('@typescript-eslint/eslint-plugin')),
20149
+ interopDefault(import('@typescript-eslint/parser'))
20150
+ ]);
20133
20151
  return [
20134
- pluginReactHooks.configs.flat["recommended-latest"],
20135
20152
  {
20136
20153
  name: "storm/react/setup",
20137
20154
  plugins: {
@@ -20146,6 +20163,7 @@ async function react(options = {}) {
20146
20163
  "react-web-api": pluginReactWebApi
20147
20164
  }
20148
20165
  },
20166
+ pluginReactHooks.configs.flat["recommended-latest"],
20149
20167
  {
20150
20168
  files,
20151
20169
  languageOptions: {
@@ -20159,7 +20177,7 @@ async function react(options = {}) {
20159
20177
  name: "storm/react/rules",
20160
20178
  rules: {
20161
20179
  ...renameRules2(
20162
- !!tsconfigPath ? strict ? pluginReact.configs["strict-type-checked"] : pluginReact.configs["recommended-type-checked"] : strict ? pluginReact.configs["strict"] : pluginReact.configs["recommended"]
20180
+ strict ? pluginReact.configs["strict"] : pluginReact.configs["recommended"]
20163
20181
  ),
20164
20182
  "react-hooks/exhaustive-deps": strict ? "error" : "warn",
20165
20183
  "react-hooks/rules-of-hooks": "error",
@@ -20232,9 +20250,6 @@ async function react(options = {}) {
20232
20250
  "react/no-unstable-default-props": "warn",
20233
20251
  "react/no-unused-class-component-members": "warn",
20234
20252
  "react/no-unused-state": "warn",
20235
- // "react/prefer-destructuring-assignment": "warn",
20236
- // "react/prefer-shorthand-boolean": "warn",
20237
- // "react/prefer-shorthand-fragment": "warn",
20238
20253
  ...overrides
20239
20254
  }
20240
20255
  },
@@ -20242,8 +20257,25 @@ async function react(options = {}) {
20242
20257
  {
20243
20258
  files: filesTypeAware,
20244
20259
  ignores: ignoresTypeAware,
20260
+ languageOptions: {
20261
+ parser: parserTs,
20262
+ parserOptions: {
20263
+ extraFileExtensions: componentExts.map((ext2) => `.${ext2}`),
20264
+ ecmaFeatures: { jsx: true },
20265
+ ecmaVersion: 2022,
20266
+ sourceType: "module",
20267
+ projectService: {
20268
+ allowDefaultProject: [GLOB_SRC_FILE],
20269
+ defaultProject: tsconfigPath
20270
+ },
20271
+ tsconfigRootDir: !tsconfigPath ? findWorkspaceRoot2() : dirname(tsconfigPath)
20272
+ }
20273
+ },
20245
20274
  name: "storm/react/type-aware-rules",
20246
20275
  rules: {
20276
+ ...renameRules2(
20277
+ strict ? pluginReact.configs["strict-type-checked"] : pluginReact.configs["recommended-type-checked"]
20278
+ ),
20247
20279
  "react/no-leaked-conditional-rendering": "warn",
20248
20280
  "react/no-implicit-key": "warn",
20249
20281
  "react/no-unused-props": strict ? "error" : "warn"
package/dist/preset.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { isInEditorEnv, interopDefault, ensurePackages, renameRules, parserPlain, isPackageInScope } from './chunk-ZTS57MZL.js';
2
2
  import { getTsConfigPath } from './chunk-BI2UMAQU.js';
3
3
  import { findWorkspaceRoot } from './chunk-DC6IKVKL.js';
4
- import { joinPaths } from './chunk-6BPUJHCC.js';
4
+ import { joinPaths, dirname as dirname$1 } from './chunk-6BPUJHCC.js';
5
5
  import { __commonJS, init_esm_shims, __toESM, __require, __filename as __filename$1 } from './chunk-67G5I72Q.js';
6
6
  import * as __import_util from 'util';
7
7
  import * as __import__microsoft_tsdocConfig from '@microsoft/tsdoc-config';
@@ -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, { dirname as dirname$1, join } from 'node:path';
17
+ import path16, { dirname as dirname$2, 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';
@@ -5566,7 +5566,7 @@ init_esm_shims();
5566
5566
 
5567
5567
  // ../eslint-plugin-banner/package.json
5568
5568
  var package_default = {
5569
- version: "0.0.25"};
5569
+ version: "0.0.26"};
5570
5570
 
5571
5571
  // ../eslint-plugin-banner/src/rules/banner.ts
5572
5572
  init_esm_shims();
@@ -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
  );
@@ -19690,6 +19696,7 @@ async function react(options = {}) {
19690
19696
  ignoresTypeAware = [`${GLOB_MARKDOWN}/**`, GLOB_ASTRO_TS],
19691
19697
  strict = false,
19692
19698
  overrides = {},
19699
+ componentExts = [],
19693
19700
  tsconfigPath
19694
19701
  } = options;
19695
19702
  await ensurePackages([
@@ -19731,8 +19738,11 @@ async function react(options = {}) {
19731
19738
  (i) => isPackageExists(i)
19732
19739
  );
19733
19740
  const isUsingReactRouter = ReactRouterPackages.some((i) => isPackageExists(i));
19741
+ const [pluginTs, parserTs] = await Promise.all([
19742
+ interopDefault(import('@typescript-eslint/eslint-plugin')),
19743
+ interopDefault(import('@typescript-eslint/parser'))
19744
+ ]);
19734
19745
  return [
19735
- pluginReactHooks.configs.flat["recommended-latest"],
19736
19746
  {
19737
19747
  name: "storm/react/setup",
19738
19748
  plugins: {
@@ -19747,6 +19757,7 @@ async function react(options = {}) {
19747
19757
  "react-web-api": pluginReactWebApi
19748
19758
  }
19749
19759
  },
19760
+ pluginReactHooks.configs.flat["recommended-latest"],
19750
19761
  {
19751
19762
  files,
19752
19763
  languageOptions: {
@@ -19760,7 +19771,7 @@ async function react(options = {}) {
19760
19771
  name: "storm/react/rules",
19761
19772
  rules: {
19762
19773
  ...renameRules2(
19763
- !!tsconfigPath ? strict ? pluginReact.configs["strict-type-checked"] : pluginReact.configs["recommended-type-checked"] : strict ? pluginReact.configs["strict"] : pluginReact.configs["recommended"]
19774
+ strict ? pluginReact.configs["strict"] : pluginReact.configs["recommended"]
19764
19775
  ),
19765
19776
  "react-hooks/exhaustive-deps": strict ? "error" : "warn",
19766
19777
  "react-hooks/rules-of-hooks": "error",
@@ -19833,9 +19844,6 @@ async function react(options = {}) {
19833
19844
  "react/no-unstable-default-props": "warn",
19834
19845
  "react/no-unused-class-component-members": "warn",
19835
19846
  "react/no-unused-state": "warn",
19836
- // "react/prefer-destructuring-assignment": "warn",
19837
- // "react/prefer-shorthand-boolean": "warn",
19838
- // "react/prefer-shorthand-fragment": "warn",
19839
19847
  ...overrides
19840
19848
  }
19841
19849
  },
@@ -19843,8 +19851,25 @@ async function react(options = {}) {
19843
19851
  {
19844
19852
  files: filesTypeAware,
19845
19853
  ignores: ignoresTypeAware,
19854
+ languageOptions: {
19855
+ parser: parserTs,
19856
+ parserOptions: {
19857
+ extraFileExtensions: componentExts.map((ext2) => `.${ext2}`),
19858
+ ecmaFeatures: { jsx: true },
19859
+ ecmaVersion: 2022,
19860
+ sourceType: "module",
19861
+ projectService: {
19862
+ allowDefaultProject: [GLOB_SRC_FILE],
19863
+ defaultProject: tsconfigPath
19864
+ },
19865
+ tsconfigRootDir: !tsconfigPath ? findWorkspaceRoot() : dirname$1(tsconfigPath)
19866
+ }
19867
+ },
19846
19868
  name: "storm/react/type-aware-rules",
19847
19869
  rules: {
19870
+ ...renameRules2(
19871
+ strict ? pluginReact.configs["strict-type-checked"] : pluginReact.configs["recommended-type-checked"]
19872
+ ),
19848
19873
  "react/no-leaked-conditional-rendering": "warn",
19849
19874
  "react/no-implicit-key": "warn",
19850
19875
  "react/no-unused-props": strict ? "error" : "warn"
@@ -20397,7 +20422,7 @@ async function typescript(options = {}) {
20397
20422
  allowDefaultProject: [GLOB_SRC_FILE],
20398
20423
  defaultProject: tsconfigPath
20399
20424
  },
20400
- tsconfigRootDir: !tsconfigPath ? findWorkspaceRoot() : dirname$1(tsconfigPath)
20425
+ tsconfigRootDir: !tsconfigPath ? findWorkspaceRoot() : dirname$2(tsconfigPath)
20401
20426
  } : {},
20402
20427
  ...parserOptions
20403
20428
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storm-software/eslint",
3
- "version": "0.170.92",
3
+ "version": "0.170.94",
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": "9922d1f0f3307b6823f994db8545e164984c8be7"
274
+ "gitHead": "8e16cad354d1a5fecfbd25f87783ecdf4062e5c4"
275
275
  }