@storm-software/eslint 0.170.89 → 0.170.91

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.
@@ -3,9 +3,9 @@ import { relative, joinPaths } from './chunk-6BPUJHCC.js';
3
3
  import { init_esm_shims } from './chunk-67G5I72Q.js';
4
4
  import { existsSync, statSync } from 'node:fs';
5
5
 
6
- // src/utils/tsconfig-path.ts
6
+ // src/utils/tsconfig.ts
7
7
  init_esm_shims();
8
- function getTsConfigPath(tsconfigPath, type = "app") {
8
+ function getTsConfigPath(tsconfigPath, type) {
9
9
  const workspaceRoot = findWorkspaceRoot();
10
10
  if (tsconfigPath && existsSync(tsconfigPath) && statSync(tsconfigPath).isFile()) {
11
11
  return relative(workspaceRoot, tsconfigPath);
@@ -16,12 +16,12 @@ function getTsConfigPath(tsconfigPath, type = "app") {
16
16
  }
17
17
  result = checkTsConfigPath(workspaceRoot);
18
18
  if (result) {
19
- return result;
19
+ return relative(workspaceRoot, joinPaths(workspaceRoot, result));
20
20
  }
21
21
  console.warn(
22
22
  `No tsconfig.json found${tsconfigPath ? ` provided: ${tsconfigPath}` : ""}. Consider adding a tsconfig.json file to your project's ESLint configuration.`
23
23
  );
24
- return workspaceRoot?.replace(/\\/g, "/").replaceAll(/\/$/g, "") === process.cwd().replace(/\\/g, "/").replaceAll(/\/$/g, "") ? "tsconfig.base.json" : `tsconfig.${type}.json`;
24
+ return workspaceRoot?.replace(/\\/g, "/").replaceAll(/\/$/g, "") === process.cwd().replace(/\\/g, "/").replaceAll(/\/$/g, "") ? "tsconfig.base.json" : type ? `tsconfig.${type}.json` : "tsconfig.json";
25
25
  }
26
26
  function checkTsConfigPath(root) {
27
27
  if (existsSync(joinPaths(root, "tsconfig.json"))) {
package/dist/preset.cjs CHANGED
@@ -20087,6 +20087,7 @@ async function react(options = {}) {
20087
20087
  files = [GLOB_SRC],
20088
20088
  filesTypeAware = [GLOB_TS, GLOB_TSX],
20089
20089
  ignoresTypeAware = [`${GLOB_MARKDOWN}/**`, GLOB_ASTRO_TS],
20090
+ strict = false,
20090
20091
  overrides = {},
20091
20092
  tsconfigPath
20092
20093
  } = options;
@@ -20158,9 +20159,9 @@ async function react(options = {}) {
20158
20159
  name: "storm/react/rules",
20159
20160
  rules: {
20160
20161
  ...renameRules2(
20161
- !!tsconfigPath ? pluginReact.configs["recommended-type-checked"] : pluginReact.configs["recommended"]
20162
+ !!tsconfigPath ? strict ? pluginReact.configs["strict-type-checked"] : pluginReact.configs["recommended-type-checked"] : strict ? pluginReact.configs["strict"] : pluginReact.configs["recommended"]
20162
20163
  ),
20163
- "react-hooks/exhaustive-deps": "warn",
20164
+ "react-hooks/exhaustive-deps": strict ? "error" : "warn",
20164
20165
  "react-hooks/rules-of-hooks": "error",
20165
20166
  "react-refresh/only-export-components": [
20166
20167
  "warn",
@@ -20219,13 +20220,11 @@ async function react(options = {}) {
20219
20220
  "react/no-direct-mutation-state": "error",
20220
20221
  "react/no-duplicate-key": "error",
20221
20222
  "react/no-forward-ref": "warn",
20222
- "react/no-implicit-key": "warn",
20223
20223
  "react/no-missing-key": "error",
20224
20224
  "react/no-nested-component-definitions": "error",
20225
20225
  "react/no-set-state-in-component-did-mount": "warn",
20226
20226
  "react/no-set-state-in-component-did-update": "warn",
20227
20227
  "react/no-set-state-in-component-will-update": "warn",
20228
- "react/no-string-refs": "error",
20229
20228
  "react/no-unsafe-component-will-mount": "warn",
20230
20229
  "react/no-unsafe-component-will-receive-props": "warn",
20231
20230
  "react/no-unsafe-component-will-update": "warn",
@@ -20233,9 +20232,9 @@ async function react(options = {}) {
20233
20232
  "react/no-unstable-default-props": "warn",
20234
20233
  "react/no-unused-class-component-members": "warn",
20235
20234
  "react/no-unused-state": "warn",
20236
- "react/prefer-destructuring-assignment": "warn",
20237
- "react/prefer-shorthand-boolean": "warn",
20238
- "react/prefer-shorthand-fragment": "warn",
20235
+ // "react/prefer-destructuring-assignment": "warn",
20236
+ // "react/prefer-shorthand-boolean": "warn",
20237
+ // "react/prefer-shorthand-fragment": "warn",
20239
20238
  ...overrides
20240
20239
  }
20241
20240
  },
@@ -20245,7 +20244,9 @@ async function react(options = {}) {
20245
20244
  ignores: ignoresTypeAware,
20246
20245
  name: "storm/react/type-aware-rules",
20247
20246
  rules: {
20248
- "react/no-leaked-conditional-rendering": "warn"
20247
+ "react/no-leaked-conditional-rendering": "warn",
20248
+ "react/no-implicit-key": "warn",
20249
+ "react/no-unused-props": strict ? "error" : "warn"
20249
20250
  }
20250
20251
  }
20251
20252
  ] : []
@@ -20733,53 +20734,15 @@ async function tsdoc(options = {}) {
20733
20734
 
20734
20735
  // src/configs/typescript.ts
20735
20736
  init_cjs_shims();
20736
-
20737
- // src/utils/tsconfig-path.ts
20738
- init_cjs_shims();
20739
- function getTsConfigPath(tsconfigPath, type = "app") {
20740
- const workspaceRoot = findWorkspaceRoot2();
20741
- if (tsconfigPath && fs3.existsSync(tsconfigPath) && fs3.statSync(tsconfigPath).isFile()) {
20742
- return relative(workspaceRoot, tsconfigPath);
20743
- }
20744
- let result = checkTsConfigPath(process.cwd());
20745
- if (result) {
20746
- return relative(workspaceRoot, joinPaths2(process.cwd(), result));
20747
- }
20748
- result = checkTsConfigPath(workspaceRoot);
20749
- if (result) {
20750
- return result;
20751
- }
20752
- console.warn(
20753
- `No tsconfig.json found${tsconfigPath ? ` provided: ${tsconfigPath}` : ""}. Consider adding a tsconfig.json file to your project's ESLint configuration.`
20754
- );
20755
- return workspaceRoot?.replace(/\\/g, "/").replaceAll(/\/$/g, "") === process.cwd().replace(/\\/g, "/").replaceAll(/\/$/g, "") ? "tsconfig.base.json" : `tsconfig.${type}.json`;
20756
- }
20757
- function checkTsConfigPath(root) {
20758
- if (fs3.existsSync(joinPaths2(root, "tsconfig.json"))) {
20759
- return "tsconfig.json";
20760
- } else if (fs3.existsSync(joinPaths2(root, "tsconfig.base.json"))) {
20761
- return "tsconfig.base.json";
20762
- } else if (fs3.existsSync(joinPaths2(root, "tsconfig.app.json"))) {
20763
- return "tsconfig.app.json";
20764
- } else if (fs3.existsSync(joinPaths2(root, "tsconfig.lib.json"))) {
20765
- return "tsconfig.lib.json";
20766
- } else if (fs3.existsSync(joinPaths2(root, "tsconfig.eslint.json"))) {
20767
- return "tsconfig.eslint.json";
20768
- } else if (fs3.existsSync(joinPaths2(root, "tsconfig.lint.json"))) {
20769
- return "tsconfig.lint.json";
20770
- }
20771
- return void 0;
20772
- }
20773
-
20774
- // src/configs/typescript.ts
20775
20737
  async function typescript(options = {}) {
20776
20738
  const {
20777
20739
  componentExts = [],
20778
20740
  overrides = {},
20779
20741
  overridesTypeAware = {},
20780
20742
  parserOptions = {},
20781
- typeImports = "always",
20782
- type = "app"
20743
+ tsconfigPath,
20744
+ typeImports = tsconfigPath ? "always" : "optional",
20745
+ type
20783
20746
  } = options;
20784
20747
  const files = options.files ?? [
20785
20748
  GLOB_TS,
@@ -20791,7 +20754,6 @@ async function typescript(options = {}) {
20791
20754
  `${GLOB_MARKDOWN}/**`,
20792
20755
  GLOB_ASTRO_TS
20793
20756
  ];
20794
- const tsconfigPath = getTsConfigPath(options?.tsconfigPath, type);
20795
20757
  const typeAwareRules = {
20796
20758
  "dot-notation": "off",
20797
20759
  "no-implied-eval": "off",
@@ -21200,6 +21162,43 @@ async function zod(options = {}) {
21200
21162
  ];
21201
21163
  }
21202
21164
 
21165
+ // src/utils/tsconfig.ts
21166
+ init_cjs_shims();
21167
+ function getTsConfigPath(tsconfigPath, type) {
21168
+ const workspaceRoot = findWorkspaceRoot2();
21169
+ if (tsconfigPath && fs3.existsSync(tsconfigPath) && fs3.statSync(tsconfigPath).isFile()) {
21170
+ return relative(workspaceRoot, tsconfigPath);
21171
+ }
21172
+ let result = checkTsConfigPath(process.cwd());
21173
+ if (result) {
21174
+ return relative(workspaceRoot, joinPaths2(process.cwd(), result));
21175
+ }
21176
+ result = checkTsConfigPath(workspaceRoot);
21177
+ if (result) {
21178
+ return relative(workspaceRoot, joinPaths2(workspaceRoot, result));
21179
+ }
21180
+ console.warn(
21181
+ `No tsconfig.json found${tsconfigPath ? ` provided: ${tsconfigPath}` : ""}. Consider adding a tsconfig.json file to your project's ESLint configuration.`
21182
+ );
21183
+ return workspaceRoot?.replace(/\\/g, "/").replaceAll(/\/$/g, "") === process.cwd().replace(/\\/g, "/").replaceAll(/\/$/g, "") ? "tsconfig.base.json" : type ? `tsconfig.${type}.json` : "tsconfig.json";
21184
+ }
21185
+ function checkTsConfigPath(root) {
21186
+ if (fs3.existsSync(joinPaths2(root, "tsconfig.json"))) {
21187
+ return "tsconfig.json";
21188
+ } else if (fs3.existsSync(joinPaths2(root, "tsconfig.base.json"))) {
21189
+ return "tsconfig.base.json";
21190
+ } else if (fs3.existsSync(joinPaths2(root, "tsconfig.app.json"))) {
21191
+ return "tsconfig.app.json";
21192
+ } else if (fs3.existsSync(joinPaths2(root, "tsconfig.lib.json"))) {
21193
+ return "tsconfig.lib.json";
21194
+ } else if (fs3.existsSync(joinPaths2(root, "tsconfig.eslint.json"))) {
21195
+ return "tsconfig.eslint.json";
21196
+ } else if (fs3.existsSync(joinPaths2(root, "tsconfig.lint.json"))) {
21197
+ return "tsconfig.lint.json";
21198
+ }
21199
+ return void 0;
21200
+ }
21201
+
21203
21202
  // src/preset.ts
21204
21203
  var flatConfigProps = [
21205
21204
  "name",
@@ -21291,6 +21290,12 @@ function preset(options, ...userConfigs) {
21291
21290
  }
21292
21291
  }
21293
21292
  const typescriptOptions = resolveSubOptions(options, "typescript");
21293
+ if (typescriptOptions.tsconfigPath !== false) {
21294
+ typescriptOptions.tsconfigPath = getTsConfigPath(
21295
+ typescriptOptions.tsconfigPath,
21296
+ options.type
21297
+ );
21298
+ }
21294
21299
  configs6.push(
21295
21300
  ignores(options.ignores),
21296
21301
  javascript({
@@ -21346,6 +21351,7 @@ function preset(options, ...userConfigs) {
21346
21351
  configs6.push(
21347
21352
  typescript({
21348
21353
  ...typescriptOptions,
21354
+ tsconfigPath: typescriptOptions.tsconfigPath === false ? void 0 : typescriptOptions.tsconfigPath,
21349
21355
  componentExts,
21350
21356
  overrides: getOverrides(options, "typescript"),
21351
21357
  type: options.type
@@ -21387,8 +21393,9 @@ function preset(options, ...userConfigs) {
21387
21393
  configs6.push(
21388
21394
  react({
21389
21395
  ...typescriptOptions,
21390
- overrides: getOverrides(options, "react"),
21391
- tsconfigPath: "tsconfigPath" in typescriptOptions ? typescriptOptions.tsconfigPath : void 0
21396
+ tsconfigPath: typescriptOptions.tsconfigPath === false ? void 0 : typescriptOptions.tsconfigPath,
21397
+ ...typeof enableReact === "boolean" ? { strict: false } : enableReact,
21398
+ overrides: getOverrides(options, "react")
21392
21399
  })
21393
21400
  );
21394
21401
  }
package/dist/preset.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { isInEditorEnv, interopDefault, ensurePackages, renameRules, parserPlain, isPackageInScope } from './chunk-ZTS57MZL.js';
2
- import { getTsConfigPath } from './chunk-PQXDULCW.js';
2
+ import { getTsConfigPath } from './chunk-BI2UMAQU.js';
3
3
  import { findWorkspaceRoot } from './chunk-DC6IKVKL.js';
4
4
  import { joinPaths } from './chunk-6BPUJHCC.js';
5
5
  import { __commonJS, init_esm_shims, __toESM, __require, __filename as __filename$1 } from './chunk-67G5I72Q.js';
@@ -19688,6 +19688,7 @@ async function react(options = {}) {
19688
19688
  files = [GLOB_SRC],
19689
19689
  filesTypeAware = [GLOB_TS, GLOB_TSX],
19690
19690
  ignoresTypeAware = [`${GLOB_MARKDOWN}/**`, GLOB_ASTRO_TS],
19691
+ strict = false,
19691
19692
  overrides = {},
19692
19693
  tsconfigPath
19693
19694
  } = options;
@@ -19759,9 +19760,9 @@ async function react(options = {}) {
19759
19760
  name: "storm/react/rules",
19760
19761
  rules: {
19761
19762
  ...renameRules2(
19762
- !!tsconfigPath ? pluginReact.configs["recommended-type-checked"] : pluginReact.configs["recommended"]
19763
+ !!tsconfigPath ? strict ? pluginReact.configs["strict-type-checked"] : pluginReact.configs["recommended-type-checked"] : strict ? pluginReact.configs["strict"] : pluginReact.configs["recommended"]
19763
19764
  ),
19764
- "react-hooks/exhaustive-deps": "warn",
19765
+ "react-hooks/exhaustive-deps": strict ? "error" : "warn",
19765
19766
  "react-hooks/rules-of-hooks": "error",
19766
19767
  "react-refresh/only-export-components": [
19767
19768
  "warn",
@@ -19820,13 +19821,11 @@ async function react(options = {}) {
19820
19821
  "react/no-direct-mutation-state": "error",
19821
19822
  "react/no-duplicate-key": "error",
19822
19823
  "react/no-forward-ref": "warn",
19823
- "react/no-implicit-key": "warn",
19824
19824
  "react/no-missing-key": "error",
19825
19825
  "react/no-nested-component-definitions": "error",
19826
19826
  "react/no-set-state-in-component-did-mount": "warn",
19827
19827
  "react/no-set-state-in-component-did-update": "warn",
19828
19828
  "react/no-set-state-in-component-will-update": "warn",
19829
- "react/no-string-refs": "error",
19830
19829
  "react/no-unsafe-component-will-mount": "warn",
19831
19830
  "react/no-unsafe-component-will-receive-props": "warn",
19832
19831
  "react/no-unsafe-component-will-update": "warn",
@@ -19834,9 +19833,9 @@ async function react(options = {}) {
19834
19833
  "react/no-unstable-default-props": "warn",
19835
19834
  "react/no-unused-class-component-members": "warn",
19836
19835
  "react/no-unused-state": "warn",
19837
- "react/prefer-destructuring-assignment": "warn",
19838
- "react/prefer-shorthand-boolean": "warn",
19839
- "react/prefer-shorthand-fragment": "warn",
19836
+ // "react/prefer-destructuring-assignment": "warn",
19837
+ // "react/prefer-shorthand-boolean": "warn",
19838
+ // "react/prefer-shorthand-fragment": "warn",
19840
19839
  ...overrides
19841
19840
  }
19842
19841
  },
@@ -19846,7 +19845,9 @@ async function react(options = {}) {
19846
19845
  ignores: ignoresTypeAware,
19847
19846
  name: "storm/react/type-aware-rules",
19848
19847
  rules: {
19849
- "react/no-leaked-conditional-rendering": "warn"
19848
+ "react/no-leaked-conditional-rendering": "warn",
19849
+ "react/no-implicit-key": "warn",
19850
+ "react/no-unused-props": strict ? "error" : "warn"
19850
19851
  }
19851
19852
  }
19852
19853
  ] : []
@@ -20340,8 +20341,9 @@ async function typescript(options = {}) {
20340
20341
  overrides = {},
20341
20342
  overridesTypeAware = {},
20342
20343
  parserOptions = {},
20343
- typeImports = "always",
20344
- type = "app"
20344
+ tsconfigPath,
20345
+ typeImports = tsconfigPath ? "always" : "optional",
20346
+ type
20345
20347
  } = options;
20346
20348
  const files = options.files ?? [
20347
20349
  GLOB_TS,
@@ -20353,7 +20355,6 @@ async function typescript(options = {}) {
20353
20355
  `${GLOB_MARKDOWN}/**`,
20354
20356
  GLOB_ASTRO_TS
20355
20357
  ];
20356
- const tsconfigPath = getTsConfigPath(options?.tsconfigPath, type);
20357
20358
  const typeAwareRules = {
20358
20359
  "dot-notation": "off",
20359
20360
  "no-implied-eval": "off",
@@ -20853,6 +20854,12 @@ function preset(options, ...userConfigs) {
20853
20854
  }
20854
20855
  }
20855
20856
  const typescriptOptions = resolveSubOptions(options, "typescript");
20857
+ if (typescriptOptions.tsconfigPath !== false) {
20858
+ typescriptOptions.tsconfigPath = getTsConfigPath(
20859
+ typescriptOptions.tsconfigPath,
20860
+ options.type
20861
+ );
20862
+ }
20856
20863
  configs6.push(
20857
20864
  ignores(options.ignores),
20858
20865
  javascript({
@@ -20908,6 +20915,7 @@ function preset(options, ...userConfigs) {
20908
20915
  configs6.push(
20909
20916
  typescript({
20910
20917
  ...typescriptOptions,
20918
+ tsconfigPath: typescriptOptions.tsconfigPath === false ? void 0 : typescriptOptions.tsconfigPath,
20911
20919
  componentExts,
20912
20920
  overrides: getOverrides(options, "typescript"),
20913
20921
  type: options.type
@@ -20949,8 +20957,9 @@ function preset(options, ...userConfigs) {
20949
20957
  configs6.push(
20950
20958
  react({
20951
20959
  ...typescriptOptions,
20952
- overrides: getOverrides(options, "react"),
20953
- tsconfigPath: "tsconfigPath" in typescriptOptions ? typescriptOptions.tsconfigPath : void 0
20960
+ tsconfigPath: typescriptOptions.tsconfigPath === false ? void 0 : typescriptOptions.tsconfigPath,
20961
+ ...typeof enableReact === "boolean" ? { strict: false } : enableReact,
20962
+ overrides: getOverrides(options, "react")
20954
20963
  })
20955
20964
  );
20956
20965
  }
package/dist/types.d.cts CHANGED
@@ -18578,6 +18578,12 @@ interface OptionsJSDoc extends OptionsOverrides {
18578
18578
  stylistic?: boolean;
18579
18579
  }
18580
18580
  interface OptionsTypeScriptParserOptions {
18581
+ /**
18582
+ * When this options is provided as false, type aware rules will be **disabled**.
18583
+ *
18584
+ * @see https://typescript-eslint.io/linting/typed-linting/
18585
+ */
18586
+ tsconfigPath: false;
18581
18587
  /**
18582
18588
  * Additional parser options for TypeScript.
18583
18589
  */
@@ -18595,7 +18601,8 @@ interface OptionsTypeScriptParserOptions {
18595
18601
  }
18596
18602
  interface OptionsTypeScriptWithTypes {
18597
18603
  /**
18598
- * When this options is provided, type aware rules will be enabled.
18604
+ * When this options is provided (or if `tsconfigPath` is found with {@link @storm-software/eslint/utils/tsconfig#getTsConfigPath | the getTsConfigPath function}), type aware rules will be enabled.
18605
+ *
18599
18606
  * @see https://typescript-eslint.io/linting/typed-linting/
18600
18607
  */
18601
18608
  tsconfigPath?: string;
@@ -18711,6 +18718,14 @@ interface OptionsStorybook extends OptionsOverrides {
18711
18718
  */
18712
18719
  csf?: "none" | "loose" | "strict";
18713
18720
  }
18721
+ interface OptionsReact extends OptionsOverrides {
18722
+ /**
18723
+ * Use a strict mode for React rules, which will enable more strict rules that may cause more false positives but can catch more potential issues.
18724
+ *
18725
+ * @defaultValue false
18726
+ */
18727
+ strict?: boolean;
18728
+ }
18714
18729
  interface OptionsNxDependencyChecks extends OptionsOverrides {
18715
18730
  /**
18716
18731
  * List of build target names
@@ -19058,7 +19073,7 @@ interface OptionsConfig extends OptionsComponentExts, OptionsJavascript, Options
19058
19073
  *
19059
19074
  * @defaultValue false
19060
19075
  */
19061
- react?: boolean | OptionsOverrides;
19076
+ react?: boolean | OptionsReact;
19062
19077
  /**
19063
19078
  * Enable react native rules.
19064
19079
  *
@@ -19113,4 +19128,4 @@ type UserConfig = Awaitable<TypedFlatConfigItem | TypedFlatConfigItem[] | FlatCo
19113
19128
  type PresetConfig<TOptions> = TOptions & Omit<TypedFlatConfigItem, "files">;
19114
19129
  type PresetResult = FlatConfigComposer<TypedFlatConfigItem, ConfigNames>;
19115
19130
 
19116
- export type { Awaitable, ConfigNames, ESLintGlobalsPropValue, OptionsBanner, OptionsCSpell, OptionsComponentExts, OptionsConfig, OptionsFiles, OptionsFormatters, OptionsGraphQL, OptionsHasTypeScript, OptionsIsInEditor, OptionsJSDoc, OptionsJavascript, OptionsNext, OptionsNx, OptionsNxDependencyChecks, OptionsNxEnforceModuleBoundaries, OptionsOverrides, OptionsPnpm, OptionsProjectType, OptionsRegExp, OptionsStorybook, OptionsStylistic, OptionsTSDoc, OptionsTypeScriptParserOptions, OptionsTypeScriptWithTypes, OptionsTypescript, OptionsUnicorn, OptionsUnoCSS, PresetConfig, PresetResult, RuleOptions, Rules, StylisticConfig, TypedFlatConfigItem, UserConfig };
19131
+ export type { Awaitable, ConfigNames, ESLintGlobalsPropValue, OptionsBanner, OptionsCSpell, OptionsComponentExts, OptionsConfig, OptionsFiles, OptionsFormatters, OptionsGraphQL, OptionsHasTypeScript, OptionsIsInEditor, OptionsJSDoc, OptionsJavascript, OptionsNext, OptionsNx, OptionsNxDependencyChecks, OptionsNxEnforceModuleBoundaries, OptionsOverrides, OptionsPnpm, OptionsProjectType, OptionsReact, OptionsRegExp, OptionsStorybook, OptionsStylistic, OptionsTSDoc, OptionsTypeScriptParserOptions, OptionsTypeScriptWithTypes, OptionsTypescript, OptionsUnicorn, OptionsUnoCSS, PresetConfig, PresetResult, RuleOptions, Rules, StylisticConfig, TypedFlatConfigItem, UserConfig };
package/dist/types.d.ts CHANGED
@@ -18578,6 +18578,12 @@ interface OptionsJSDoc extends OptionsOverrides {
18578
18578
  stylistic?: boolean;
18579
18579
  }
18580
18580
  interface OptionsTypeScriptParserOptions {
18581
+ /**
18582
+ * When this options is provided as false, type aware rules will be **disabled**.
18583
+ *
18584
+ * @see https://typescript-eslint.io/linting/typed-linting/
18585
+ */
18586
+ tsconfigPath: false;
18581
18587
  /**
18582
18588
  * Additional parser options for TypeScript.
18583
18589
  */
@@ -18595,7 +18601,8 @@ interface OptionsTypeScriptParserOptions {
18595
18601
  }
18596
18602
  interface OptionsTypeScriptWithTypes {
18597
18603
  /**
18598
- * When this options is provided, type aware rules will be enabled.
18604
+ * When this options is provided (or if `tsconfigPath` is found with {@link @storm-software/eslint/utils/tsconfig#getTsConfigPath | the getTsConfigPath function}), type aware rules will be enabled.
18605
+ *
18599
18606
  * @see https://typescript-eslint.io/linting/typed-linting/
18600
18607
  */
18601
18608
  tsconfigPath?: string;
@@ -18711,6 +18718,14 @@ interface OptionsStorybook extends OptionsOverrides {
18711
18718
  */
18712
18719
  csf?: "none" | "loose" | "strict";
18713
18720
  }
18721
+ interface OptionsReact extends OptionsOverrides {
18722
+ /**
18723
+ * Use a strict mode for React rules, which will enable more strict rules that may cause more false positives but can catch more potential issues.
18724
+ *
18725
+ * @defaultValue false
18726
+ */
18727
+ strict?: boolean;
18728
+ }
18714
18729
  interface OptionsNxDependencyChecks extends OptionsOverrides {
18715
18730
  /**
18716
18731
  * List of build target names
@@ -19058,7 +19073,7 @@ interface OptionsConfig extends OptionsComponentExts, OptionsJavascript, Options
19058
19073
  *
19059
19074
  * @defaultValue false
19060
19075
  */
19061
- react?: boolean | OptionsOverrides;
19076
+ react?: boolean | OptionsReact;
19062
19077
  /**
19063
19078
  * Enable react native rules.
19064
19079
  *
@@ -19113,4 +19128,4 @@ type UserConfig = Awaitable<TypedFlatConfigItem | TypedFlatConfigItem[] | FlatCo
19113
19128
  type PresetConfig<TOptions> = TOptions & Omit<TypedFlatConfigItem, "files">;
19114
19129
  type PresetResult = FlatConfigComposer<TypedFlatConfigItem, ConfigNames>;
19115
19130
 
19116
- export type { Awaitable, ConfigNames, ESLintGlobalsPropValue, OptionsBanner, OptionsCSpell, OptionsComponentExts, OptionsConfig, OptionsFiles, OptionsFormatters, OptionsGraphQL, OptionsHasTypeScript, OptionsIsInEditor, OptionsJSDoc, OptionsJavascript, OptionsNext, OptionsNx, OptionsNxDependencyChecks, OptionsNxEnforceModuleBoundaries, OptionsOverrides, OptionsPnpm, OptionsProjectType, OptionsRegExp, OptionsStorybook, OptionsStylistic, OptionsTSDoc, OptionsTypeScriptParserOptions, OptionsTypeScriptWithTypes, OptionsTypescript, OptionsUnicorn, OptionsUnoCSS, PresetConfig, PresetResult, RuleOptions, Rules, StylisticConfig, TypedFlatConfigItem, UserConfig };
19131
+ export type { Awaitable, ConfigNames, ESLintGlobalsPropValue, OptionsBanner, OptionsCSpell, OptionsComponentExts, OptionsConfig, OptionsFiles, OptionsFormatters, OptionsGraphQL, OptionsHasTypeScript, OptionsIsInEditor, OptionsJSDoc, OptionsJavascript, OptionsNext, OptionsNx, OptionsNxDependencyChecks, OptionsNxEnforceModuleBoundaries, OptionsOverrides, OptionsPnpm, OptionsProjectType, OptionsReact, OptionsRegExp, OptionsStorybook, OptionsStylistic, OptionsTSDoc, OptionsTypeScriptParserOptions, OptionsTypeScriptWithTypes, OptionsTypescript, OptionsUnicorn, OptionsUnoCSS, PresetConfig, PresetResult, RuleOptions, Rules, StylisticConfig, TypedFlatConfigItem, UserConfig };
@@ -3,7 +3,7 @@
3
3
  var fs = require('fs');
4
4
  var path = require('path');
5
5
 
6
- // src/utils/tsconfig-path.ts
6
+ // src/utils/tsconfig.ts
7
7
 
8
8
  // src/utils/correct-paths.ts
9
9
  var _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
@@ -257,8 +257,8 @@ Path: ${process.cwd()}`
257
257
  return result;
258
258
  }
259
259
 
260
- // src/utils/tsconfig-path.ts
261
- function getTsConfigPath(tsconfigPath, type = "app") {
260
+ // src/utils/tsconfig.ts
261
+ function getTsConfigPath(tsconfigPath, type) {
262
262
  const workspaceRoot = findWorkspaceRoot();
263
263
  if (tsconfigPath && fs.existsSync(tsconfigPath) && fs.statSync(tsconfigPath).isFile()) {
264
264
  return relative(workspaceRoot, tsconfigPath);
@@ -269,12 +269,12 @@ function getTsConfigPath(tsconfigPath, type = "app") {
269
269
  }
270
270
  result = checkTsConfigPath(workspaceRoot);
271
271
  if (result) {
272
- return result;
272
+ return relative(workspaceRoot, joinPaths(workspaceRoot, result));
273
273
  }
274
274
  console.warn(
275
275
  `No tsconfig.json found${tsconfigPath ? ` provided: ${tsconfigPath}` : ""}. Consider adding a tsconfig.json file to your project's ESLint configuration.`
276
276
  );
277
- return workspaceRoot?.replace(/\\/g, "/").replaceAll(/\/$/g, "") === process.cwd().replace(/\\/g, "/").replaceAll(/\/$/g, "") ? "tsconfig.base.json" : `tsconfig.${type}.json`;
277
+ return workspaceRoot?.replace(/\\/g, "/").replaceAll(/\/$/g, "") === process.cwd().replace(/\\/g, "/").replaceAll(/\/$/g, "") ? "tsconfig.base.json" : type ? `tsconfig.${type}.json` : "tsconfig.json";
278
278
  }
279
279
  function checkTsConfigPath(root) {
280
280
  if (fs.existsSync(joinPaths(root, "tsconfig.json"))) {
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Gets the path to the nearest tsconfig file by walking up from start path.
3
+ *
4
+ * The search order is as follows:
5
+ * 1. If `tsconfigPath` is provided and exists, it will be used.
6
+ * 2. If a tsconfig file is found in the current working directory, it will be used.
7
+ * 3. If a tsconfig file is found in the workspace root, it will be used.
8
+ * 4. If no tsconfig file is found, a warning will be logged and a default path will be returned based on the project type (app or lib).
9
+ *
10
+ * The function checks for the following tsconfig file names in order:
11
+ * - tsconfig.json
12
+ * - tsconfig.base.json
13
+ * - tsconfig.app.json
14
+ * - tsconfig.lib.json
15
+ * - tsconfig.eslint.json
16
+ * - tsconfig.lint.json
17
+ *
18
+ * @param tsconfigPath Optional path to a tsconfig file. If provided, it will be used if it exists.
19
+ * @param type The type of project (app or lib) to determine the default tsconfig file name if no tsconfig file is found. Default is "app".
20
+ * @returns The path to the nearest tsconfig file relative to the workspace root.
21
+ */
22
+ declare function getTsConfigPath(tsconfigPath?: string, type?: "app" | "lib"): string;
23
+ declare function checkTsConfigPath(root: string): string | undefined;
24
+
25
+ export { checkTsConfigPath, getTsConfigPath };
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Gets the path to the nearest tsconfig file by walking up from start path.
3
+ *
4
+ * The search order is as follows:
5
+ * 1. If `tsconfigPath` is provided and exists, it will be used.
6
+ * 2. If a tsconfig file is found in the current working directory, it will be used.
7
+ * 3. If a tsconfig file is found in the workspace root, it will be used.
8
+ * 4. If no tsconfig file is found, a warning will be logged and a default path will be returned based on the project type (app or lib).
9
+ *
10
+ * The function checks for the following tsconfig file names in order:
11
+ * - tsconfig.json
12
+ * - tsconfig.base.json
13
+ * - tsconfig.app.json
14
+ * - tsconfig.lib.json
15
+ * - tsconfig.eslint.json
16
+ * - tsconfig.lint.json
17
+ *
18
+ * @param tsconfigPath Optional path to a tsconfig file. If provided, it will be used if it exists.
19
+ * @param type The type of project (app or lib) to determine the default tsconfig file name if no tsconfig file is found. Default is "app".
20
+ * @returns The path to the nearest tsconfig file relative to the workspace root.
21
+ */
22
+ declare function getTsConfigPath(tsconfigPath?: string, type?: "app" | "lib"): string;
23
+ declare function checkTsConfigPath(root: string): string | undefined;
24
+
25
+ export { checkTsConfigPath, getTsConfigPath };
@@ -1,4 +1,4 @@
1
- export { checkTsConfigPath, getTsConfigPath } from '../chunk-PQXDULCW.js';
1
+ export { checkTsConfigPath, getTsConfigPath } from '../chunk-BI2UMAQU.js';
2
2
  import '../chunk-DC6IKVKL.js';
3
3
  import '../chunk-6BPUJHCC.js';
4
4
  import '../chunk-67G5I72Q.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storm-software/eslint",
3
- "version": "0.170.89",
3
+ "version": "0.170.91",
4
4
  "private": false,
5
5
  "description": "A package containing the base ESLint configuration used by Storm Software across many projects.",
6
6
  "keywords": [
@@ -271,5 +271,5 @@
271
271
  "zod": { "optional": true }
272
272
  },
273
273
  "publishConfig": { "access": "public" },
274
- "gitHead": "c72566c3320d96ce5a660e908392709006ade899"
274
+ "gitHead": "68cf7b0a3e91562c05d5b4fb909326e65066c262"
275
275
  }
@@ -1,4 +0,0 @@
1
- declare function getTsConfigPath(tsconfigPath?: string, type?: "app" | "lib"): string;
2
- declare function checkTsConfigPath(root: string): string | undefined;
3
-
4
- export { checkTsConfigPath, getTsConfigPath };
@@ -1,4 +0,0 @@
1
- declare function getTsConfigPath(tsconfigPath?: string, type?: "app" | "lib"): string;
2
- declare function checkTsConfigPath(root: string): string | undefined;
3
-
4
- export { checkTsConfigPath, getTsConfigPath };