@storm-software/eslint 0.170.90 → 0.170.92

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,7 +20220,6 @@ 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",
@@ -20244,7 +20244,9 @@ async function react(options = {}) {
20244
20244
  ignores: ignoresTypeAware,
20245
20245
  name: "storm/react/type-aware-rules",
20246
20246
  rules: {
20247
- "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"
20248
20250
  }
20249
20251
  }
20250
20252
  ] : []
@@ -20732,53 +20734,15 @@ async function tsdoc(options = {}) {
20732
20734
 
20733
20735
  // src/configs/typescript.ts
20734
20736
  init_cjs_shims();
20735
-
20736
- // src/utils/tsconfig-path.ts
20737
- init_cjs_shims();
20738
- function getTsConfigPath(tsconfigPath, type = "app") {
20739
- const workspaceRoot = findWorkspaceRoot2();
20740
- if (tsconfigPath && fs3.existsSync(tsconfigPath) && fs3.statSync(tsconfigPath).isFile()) {
20741
- return relative(workspaceRoot, tsconfigPath);
20742
- }
20743
- let result = checkTsConfigPath(process.cwd());
20744
- if (result) {
20745
- return relative(workspaceRoot, joinPaths2(process.cwd(), result));
20746
- }
20747
- result = checkTsConfigPath(workspaceRoot);
20748
- if (result) {
20749
- return result;
20750
- }
20751
- console.warn(
20752
- `No tsconfig.json found${tsconfigPath ? ` provided: ${tsconfigPath}` : ""}. Consider adding a tsconfig.json file to your project's ESLint configuration.`
20753
- );
20754
- return workspaceRoot?.replace(/\\/g, "/").replaceAll(/\/$/g, "") === process.cwd().replace(/\\/g, "/").replaceAll(/\/$/g, "") ? "tsconfig.base.json" : `tsconfig.${type}.json`;
20755
- }
20756
- function checkTsConfigPath(root) {
20757
- if (fs3.existsSync(joinPaths2(root, "tsconfig.json"))) {
20758
- return "tsconfig.json";
20759
- } else if (fs3.existsSync(joinPaths2(root, "tsconfig.base.json"))) {
20760
- return "tsconfig.base.json";
20761
- } else if (fs3.existsSync(joinPaths2(root, "tsconfig.app.json"))) {
20762
- return "tsconfig.app.json";
20763
- } else if (fs3.existsSync(joinPaths2(root, "tsconfig.lib.json"))) {
20764
- return "tsconfig.lib.json";
20765
- } else if (fs3.existsSync(joinPaths2(root, "tsconfig.eslint.json"))) {
20766
- return "tsconfig.eslint.json";
20767
- } else if (fs3.existsSync(joinPaths2(root, "tsconfig.lint.json"))) {
20768
- return "tsconfig.lint.json";
20769
- }
20770
- return void 0;
20771
- }
20772
-
20773
- // src/configs/typescript.ts
20774
20737
  async function typescript(options = {}) {
20775
20738
  const {
20776
20739
  componentExts = [],
20777
20740
  overrides = {},
20778
20741
  overridesTypeAware = {},
20779
20742
  parserOptions = {},
20780
- typeImports = "always",
20781
- type = "app"
20743
+ tsconfigPath,
20744
+ typeImports = tsconfigPath ? "always" : "optional",
20745
+ type
20782
20746
  } = options;
20783
20747
  const files = options.files ?? [
20784
20748
  GLOB_TS,
@@ -20790,7 +20754,6 @@ async function typescript(options = {}) {
20790
20754
  `${GLOB_MARKDOWN}/**`,
20791
20755
  GLOB_ASTRO_TS
20792
20756
  ];
20793
- const tsconfigPath = getTsConfigPath(options?.tsconfigPath, type);
20794
20757
  const typeAwareRules = {
20795
20758
  "dot-notation": "off",
20796
20759
  "no-implied-eval": "off",
@@ -20833,7 +20796,7 @@ async function typescript(options = {}) {
20833
20796
  allowDefaultProject: [GLOB_SRC_FILE],
20834
20797
  defaultProject: tsconfigPath
20835
20798
  },
20836
- tsconfigRootDir: findWorkspaceRoot2()
20799
+ tsconfigRootDir: !tsconfigPath ? findWorkspaceRoot2() : path16.dirname(tsconfigPath)
20837
20800
  } : {},
20838
20801
  ...parserOptions
20839
20802
  }
@@ -21199,6 +21162,43 @@ async function zod(options = {}) {
21199
21162
  ];
21200
21163
  }
21201
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
+
21202
21202
  // src/preset.ts
21203
21203
  var flatConfigProps = [
21204
21204
  "name",
@@ -21289,7 +21289,6 @@ function preset(options, ...userConfigs) {
21289
21289
  );
21290
21290
  }
21291
21291
  }
21292
- const typescriptOptions = resolveSubOptions(options, "typescript");
21293
21292
  configs6.push(
21294
21293
  ignores(options.ignores),
21295
21294
  javascript({
@@ -21304,6 +21303,27 @@ function preset(options, ...userConfigs) {
21304
21303
  perfectionist(),
21305
21304
  secrets({ json: options.jsonc !== false })
21306
21305
  );
21306
+ let typescriptOptions = {};
21307
+ if (enableTypeScript) {
21308
+ typescriptOptions = resolveSubOptions(options, "typescript");
21309
+ if (typescriptOptions.tsconfigPath !== false) {
21310
+ typescriptOptions.tsconfigPath = getTsConfigPath(
21311
+ typescriptOptions.tsconfigPath,
21312
+ options.type
21313
+ );
21314
+ }
21315
+ }
21316
+ if (enableTypeScript) {
21317
+ configs6.push(
21318
+ typescript({
21319
+ ...typescriptOptions,
21320
+ tsconfigPath: typescriptOptions.tsconfigPath === false ? void 0 : typescriptOptions.tsconfigPath,
21321
+ componentExts,
21322
+ overrides: getOverrides(options, "typescript"),
21323
+ type: options.type
21324
+ })
21325
+ );
21326
+ }
21307
21327
  if (enableBanner) {
21308
21328
  configs6.push(
21309
21329
  banner({
@@ -21341,16 +21361,6 @@ function preset(options, ...userConfigs) {
21341
21361
  if (enableJsx) {
21342
21362
  configs6.push(jsx());
21343
21363
  }
21344
- if (enableTypeScript) {
21345
- configs6.push(
21346
- typescript({
21347
- ...typescriptOptions,
21348
- componentExts,
21349
- overrides: getOverrides(options, "typescript"),
21350
- type: options.type
21351
- })
21352
- );
21353
- }
21354
21364
  if (enableZod) {
21355
21365
  configs6.push(
21356
21366
  zod({
@@ -21386,8 +21396,9 @@ function preset(options, ...userConfigs) {
21386
21396
  configs6.push(
21387
21397
  react({
21388
21398
  ...typescriptOptions,
21389
- overrides: getOverrides(options, "react"),
21390
- tsconfigPath: "tsconfigPath" in typescriptOptions ? typescriptOptions.tsconfigPath : void 0
21399
+ tsconfigPath: typescriptOptions.tsconfigPath === false ? void 0 : typescriptOptions.tsconfigPath,
21400
+ ...typeof enableReact === "boolean" ? { strict: false } : enableReact,
21401
+ overrides: getOverrides(options, "react")
21391
21402
  })
21392
21403
  );
21393
21404
  }
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';
@@ -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';
@@ -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,7 +19821,6 @@ 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",
@@ -19845,7 +19845,9 @@ async function react(options = {}) {
19845
19845
  ignores: ignoresTypeAware,
19846
19846
  name: "storm/react/type-aware-rules",
19847
19847
  rules: {
19848
- "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"
19849
19851
  }
19850
19852
  }
19851
19853
  ] : []
@@ -20339,8 +20341,9 @@ async function typescript(options = {}) {
20339
20341
  overrides = {},
20340
20342
  overridesTypeAware = {},
20341
20343
  parserOptions = {},
20342
- typeImports = "always",
20343
- type = "app"
20344
+ tsconfigPath,
20345
+ typeImports = tsconfigPath ? "always" : "optional",
20346
+ type
20344
20347
  } = options;
20345
20348
  const files = options.files ?? [
20346
20349
  GLOB_TS,
@@ -20352,7 +20355,6 @@ async function typescript(options = {}) {
20352
20355
  `${GLOB_MARKDOWN}/**`,
20353
20356
  GLOB_ASTRO_TS
20354
20357
  ];
20355
- const tsconfigPath = getTsConfigPath(options?.tsconfigPath, type);
20356
20358
  const typeAwareRules = {
20357
20359
  "dot-notation": "off",
20358
20360
  "no-implied-eval": "off",
@@ -20395,7 +20397,7 @@ async function typescript(options = {}) {
20395
20397
  allowDefaultProject: [GLOB_SRC_FILE],
20396
20398
  defaultProject: tsconfigPath
20397
20399
  },
20398
- tsconfigRootDir: findWorkspaceRoot()
20400
+ tsconfigRootDir: !tsconfigPath ? findWorkspaceRoot() : dirname$1(tsconfigPath)
20399
20401
  } : {},
20400
20402
  ...parserOptions
20401
20403
  }
@@ -20851,7 +20853,6 @@ function preset(options, ...userConfigs) {
20851
20853
  );
20852
20854
  }
20853
20855
  }
20854
- const typescriptOptions = resolveSubOptions(options, "typescript");
20855
20856
  configs6.push(
20856
20857
  ignores(options.ignores),
20857
20858
  javascript({
@@ -20866,6 +20867,27 @@ function preset(options, ...userConfigs) {
20866
20867
  perfectionist(),
20867
20868
  secrets({ json: options.jsonc !== false })
20868
20869
  );
20870
+ let typescriptOptions = {};
20871
+ if (enableTypeScript) {
20872
+ typescriptOptions = resolveSubOptions(options, "typescript");
20873
+ if (typescriptOptions.tsconfigPath !== false) {
20874
+ typescriptOptions.tsconfigPath = getTsConfigPath(
20875
+ typescriptOptions.tsconfigPath,
20876
+ options.type
20877
+ );
20878
+ }
20879
+ }
20880
+ if (enableTypeScript) {
20881
+ configs6.push(
20882
+ typescript({
20883
+ ...typescriptOptions,
20884
+ tsconfigPath: typescriptOptions.tsconfigPath === false ? void 0 : typescriptOptions.tsconfigPath,
20885
+ componentExts,
20886
+ overrides: getOverrides(options, "typescript"),
20887
+ type: options.type
20888
+ })
20889
+ );
20890
+ }
20869
20891
  if (enableBanner) {
20870
20892
  configs6.push(
20871
20893
  banner({
@@ -20903,16 +20925,6 @@ function preset(options, ...userConfigs) {
20903
20925
  if (enableJsx) {
20904
20926
  configs6.push(jsx());
20905
20927
  }
20906
- if (enableTypeScript) {
20907
- configs6.push(
20908
- typescript({
20909
- ...typescriptOptions,
20910
- componentExts,
20911
- overrides: getOverrides(options, "typescript"),
20912
- type: options.type
20913
- })
20914
- );
20915
- }
20916
20928
  if (enableZod) {
20917
20929
  configs6.push(
20918
20930
  zod({
@@ -20948,8 +20960,9 @@ function preset(options, ...userConfigs) {
20948
20960
  configs6.push(
20949
20961
  react({
20950
20962
  ...typescriptOptions,
20951
- overrides: getOverrides(options, "react"),
20952
- tsconfigPath: "tsconfigPath" in typescriptOptions ? typescriptOptions.tsconfigPath : void 0
20963
+ tsconfigPath: typescriptOptions.tsconfigPath === false ? void 0 : typescriptOptions.tsconfigPath,
20964
+ ...typeof enableReact === "boolean" ? { strict: false } : enableReact,
20965
+ overrides: getOverrides(options, "react")
20953
20966
  })
20954
20967
  );
20955
20968
  }
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.90",
3
+ "version": "0.170.92",
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": "4c788d0e53b1bdc097166dd42dc6422f80ba6f1f"
274
+ "gitHead": "9922d1f0f3307b6823f994db8545e164984c8be7"
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 };