@storm-software/eslint 0.170.90 → 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.
- package/dist/{chunk-PQXDULCW.js → chunk-BI2UMAQU.js} +4 -4
- package/dist/preset.cjs +56 -48
- package/dist/preset.js +20 -10
- package/dist/types.d.cts +18 -3
- package/dist/types.d.ts +18 -3
- package/dist/utils/{tsconfig-path.cjs → tsconfig.cjs} +5 -5
- package/dist/utils/tsconfig.d.cts +25 -0
- package/dist/utils/tsconfig.d.ts +25 -0
- package/dist/utils/{tsconfig-path.js → tsconfig.js} +1 -1
- package/package.json +2 -2
- package/dist/utils/tsconfig-path.d.cts +0 -4
- package/dist/utils/tsconfig-path.d.ts +0 -4
|
@@ -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
|
|
6
|
+
// src/utils/tsconfig.ts
|
|
7
7
|
init_esm_shims();
|
|
8
|
-
function getTsConfigPath(tsconfigPath, type
|
|
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
|
-
|
|
20781
|
-
|
|
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",
|
|
@@ -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",
|
|
@@ -21290,6 +21290,12 @@ function preset(options, ...userConfigs) {
|
|
|
21290
21290
|
}
|
|
21291
21291
|
}
|
|
21292
21292
|
const typescriptOptions = resolveSubOptions(options, "typescript");
|
|
21293
|
+
if (typescriptOptions.tsconfigPath !== false) {
|
|
21294
|
+
typescriptOptions.tsconfigPath = getTsConfigPath(
|
|
21295
|
+
typescriptOptions.tsconfigPath,
|
|
21296
|
+
options.type
|
|
21297
|
+
);
|
|
21298
|
+
}
|
|
21293
21299
|
configs6.push(
|
|
21294
21300
|
ignores(options.ignores),
|
|
21295
21301
|
javascript({
|
|
@@ -21345,6 +21351,7 @@ function preset(options, ...userConfigs) {
|
|
|
21345
21351
|
configs6.push(
|
|
21346
21352
|
typescript({
|
|
21347
21353
|
...typescriptOptions,
|
|
21354
|
+
tsconfigPath: typescriptOptions.tsconfigPath === false ? void 0 : typescriptOptions.tsconfigPath,
|
|
21348
21355
|
componentExts,
|
|
21349
21356
|
overrides: getOverrides(options, "typescript"),
|
|
21350
21357
|
type: options.type
|
|
@@ -21386,8 +21393,9 @@ function preset(options, ...userConfigs) {
|
|
|
21386
21393
|
configs6.push(
|
|
21387
21394
|
react({
|
|
21388
21395
|
...typescriptOptions,
|
|
21389
|
-
|
|
21390
|
-
|
|
21396
|
+
tsconfigPath: typescriptOptions.tsconfigPath === false ? void 0 : typescriptOptions.tsconfigPath,
|
|
21397
|
+
...typeof enableReact === "boolean" ? { strict: false } : enableReact,
|
|
21398
|
+
overrides: getOverrides(options, "react")
|
|
21391
21399
|
})
|
|
21392
21400
|
);
|
|
21393
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-
|
|
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,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
|
-
|
|
20343
|
-
|
|
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",
|
|
@@ -20852,6 +20854,12 @@ function preset(options, ...userConfigs) {
|
|
|
20852
20854
|
}
|
|
20853
20855
|
}
|
|
20854
20856
|
const typescriptOptions = resolveSubOptions(options, "typescript");
|
|
20857
|
+
if (typescriptOptions.tsconfigPath !== false) {
|
|
20858
|
+
typescriptOptions.tsconfigPath = getTsConfigPath(
|
|
20859
|
+
typescriptOptions.tsconfigPath,
|
|
20860
|
+
options.type
|
|
20861
|
+
);
|
|
20862
|
+
}
|
|
20855
20863
|
configs6.push(
|
|
20856
20864
|
ignores(options.ignores),
|
|
20857
20865
|
javascript({
|
|
@@ -20907,6 +20915,7 @@ function preset(options, ...userConfigs) {
|
|
|
20907
20915
|
configs6.push(
|
|
20908
20916
|
typescript({
|
|
20909
20917
|
...typescriptOptions,
|
|
20918
|
+
tsconfigPath: typescriptOptions.tsconfigPath === false ? void 0 : typescriptOptions.tsconfigPath,
|
|
20910
20919
|
componentExts,
|
|
20911
20920
|
overrides: getOverrides(options, "typescript"),
|
|
20912
20921
|
type: options.type
|
|
@@ -20948,8 +20957,9 @@ function preset(options, ...userConfigs) {
|
|
|
20948
20957
|
configs6.push(
|
|
20949
20958
|
react({
|
|
20950
20959
|
...typescriptOptions,
|
|
20951
|
-
|
|
20952
|
-
|
|
20960
|
+
tsconfigPath: typescriptOptions.tsconfigPath === false ? void 0 : typescriptOptions.tsconfigPath,
|
|
20961
|
+
...typeof enableReact === "boolean" ? { strict: false } : enableReact,
|
|
20962
|
+
overrides: getOverrides(options, "react")
|
|
20953
20963
|
})
|
|
20954
20964
|
);
|
|
20955
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 |
|
|
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 |
|
|
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
|
|
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
|
|
261
|
-
function getTsConfigPath(tsconfigPath, type
|
|
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 };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storm-software/eslint",
|
|
3
|
-
"version": "0.170.
|
|
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": "
|
|
274
|
+
"gitHead": "68cf7b0a3e91562c05d5b4fb909326e65066c262"
|
|
275
275
|
}
|