@storm-software/eslint 0.87.1 → 0.87.3
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/README.md +1 -1
- package/dist/preset.d.mts +3 -0
- package/dist/preset.d.ts +3 -0
- package/dist/preset.mjs +280 -252
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -21,7 +21,7 @@ This package is part of the <b>⚡Storm-Ops</b> monorepo. The Storm-Ops packages
|
|
|
21
21
|
|
|
22
22
|
<h3 align="center">💻 Visit <a href="https://stormsoftware.com" target="_blank">stormsoftware.com</a> to stay up to date with this developer</h3><br />
|
|
23
23
|
|
|
24
|
-
[](https://prettier.io/) [](http://nx.dev/) [](https://nextjs.org/) [](http://commitizen.github.io/cz-cli/)  [](https://fumadocs.vercel.app/) 
|
|
25
25
|
|
|
26
26
|
<!-- prettier-ignore-start -->
|
|
27
27
|
<!-- markdownlint-disable -->
|
package/dist/preset.d.mts
CHANGED
|
@@ -7010,6 +7010,7 @@ type TypeScriptEslintConfigType = "none" | "all" | "base" | "disable-type-checke
|
|
|
7010
7010
|
interface GetStormRulesConfigOptions {
|
|
7011
7011
|
typescriptEslintConfigType?: TypeScriptEslintConfigType;
|
|
7012
7012
|
useUnicorn?: boolean;
|
|
7013
|
+
useNx?: boolean;
|
|
7013
7014
|
}
|
|
7014
7015
|
|
|
7015
7016
|
/**
|
|
@@ -7040,8 +7041,10 @@ type PresetOptions = GetStormRulesConfigOptions & {
|
|
|
7040
7041
|
parserOptions?: Linter.ParserOptions;
|
|
7041
7042
|
markdown?: false | Linter.RulesRecord;
|
|
7042
7043
|
react?: false | Linter.RulesRecord;
|
|
7044
|
+
nx?: false | Linter.RulesRecord;
|
|
7043
7045
|
useReactCompiler?: boolean;
|
|
7044
7046
|
nextFiles?: string[];
|
|
7047
|
+
logLevel?: "all" | "trace" | "debug" | "info" | "warn" | "error" | "fatal" | "silent";
|
|
7045
7048
|
};
|
|
7046
7049
|
/**
|
|
7047
7050
|
* Get the ESLint configuration for a Storm workspace.
|
package/dist/preset.d.ts
CHANGED
|
@@ -7010,6 +7010,7 @@ type TypeScriptEslintConfigType = "none" | "all" | "base" | "disable-type-checke
|
|
|
7010
7010
|
interface GetStormRulesConfigOptions {
|
|
7011
7011
|
typescriptEslintConfigType?: TypeScriptEslintConfigType;
|
|
7012
7012
|
useUnicorn?: boolean;
|
|
7013
|
+
useNx?: boolean;
|
|
7013
7014
|
}
|
|
7014
7015
|
|
|
7015
7016
|
/**
|
|
@@ -7040,8 +7041,10 @@ type PresetOptions = GetStormRulesConfigOptions & {
|
|
|
7040
7041
|
parserOptions?: Linter.ParserOptions;
|
|
7041
7042
|
markdown?: false | Linter.RulesRecord;
|
|
7042
7043
|
react?: false | Linter.RulesRecord;
|
|
7044
|
+
nx?: false | Linter.RulesRecord;
|
|
7043
7045
|
useReactCompiler?: boolean;
|
|
7044
7046
|
nextFiles?: string[];
|
|
7047
|
+
logLevel?: "all" | "trace" | "debug" | "info" | "warn" | "error" | "fatal" | "silent";
|
|
7045
7048
|
};
|
|
7046
7049
|
/**
|
|
7047
7050
|
* Get the ESLint configuration for a Storm workspace.
|
package/dist/preset.mjs
CHANGED
|
@@ -17,7 +17,7 @@ import tsdoc from 'eslint-plugin-tsdoc';
|
|
|
17
17
|
import unicorn from 'eslint-plugin-unicorn';
|
|
18
18
|
import yml from 'eslint-plugin-yml';
|
|
19
19
|
import globals from 'globals';
|
|
20
|
-
import { writeInfo, writeDebug } from '@storm-software/config-tools';
|
|
20
|
+
import { writeInfo, writeDebug, formatLogMessage, writeFatal, writeError } from '@storm-software/config-tools';
|
|
21
21
|
import { defu } from 'defu';
|
|
22
22
|
import tsEslint$1 from 'typescript-eslint';
|
|
23
23
|
import require$$0 from 'eslint/use-at-your-own-risk';
|
|
@@ -1279,26 +1279,7 @@ const getStormRulesConfig = (options) => {
|
|
|
1279
1279
|
"unicode-bom": ["error", "never"],
|
|
1280
1280
|
// require regex literals to be wrapped in parentheses
|
|
1281
1281
|
"wrap-regex": "off",
|
|
1282
|
-
"class-methods-use-this": "off"
|
|
1283
|
-
/*************************************************************
|
|
1284
|
-
*
|
|
1285
|
-
* Nx Rules - The following rules are specific to the Nx plugin
|
|
1286
|
-
*
|
|
1287
|
-
**************************************************************/
|
|
1288
|
-
"@nx/enforce-module-boundaries": [
|
|
1289
|
-
"error",
|
|
1290
|
-
{
|
|
1291
|
-
enforceBuildableLibDependency: true,
|
|
1292
|
-
checkDynamicDependenciesExceptions: [".*"],
|
|
1293
|
-
allow: [],
|
|
1294
|
-
depConstraints: [
|
|
1295
|
-
{
|
|
1296
|
-
sourceTag: "*",
|
|
1297
|
-
onlyDependOnLibsWithTags: ["*"]
|
|
1298
|
-
}
|
|
1299
|
-
]
|
|
1300
|
-
}
|
|
1301
|
-
]
|
|
1282
|
+
"class-methods-use-this": "off"
|
|
1302
1283
|
};
|
|
1303
1284
|
if (options.typescriptEslintConfigType !== "none") {
|
|
1304
1285
|
rules = {
|
|
@@ -1352,6 +1333,30 @@ const getStormRulesConfig = (options) => {
|
|
|
1352
1333
|
]
|
|
1353
1334
|
};
|
|
1354
1335
|
}
|
|
1336
|
+
if (options.useNx !== false) {
|
|
1337
|
+
rules = {
|
|
1338
|
+
...rules,
|
|
1339
|
+
/*************************************************************
|
|
1340
|
+
*
|
|
1341
|
+
* Nx Rules - The following rules are specific to the Nx plugin
|
|
1342
|
+
*
|
|
1343
|
+
**************************************************************/
|
|
1344
|
+
"@nx/enforce-module-boundaries": [
|
|
1345
|
+
"error",
|
|
1346
|
+
{
|
|
1347
|
+
enforceBuildableLibDependency: true,
|
|
1348
|
+
checkDynamicDependenciesExceptions: [".*"],
|
|
1349
|
+
allow: [],
|
|
1350
|
+
depConstraints: [
|
|
1351
|
+
{
|
|
1352
|
+
sourceTag: "*",
|
|
1353
|
+
onlyDependOnLibsWithTags: ["*"]
|
|
1354
|
+
}
|
|
1355
|
+
]
|
|
1356
|
+
}
|
|
1357
|
+
]
|
|
1358
|
+
};
|
|
1359
|
+
}
|
|
1355
1360
|
if (options.useUnicorn !== false) {
|
|
1356
1361
|
rules = {
|
|
1357
1362
|
...rules,
|
|
@@ -12920,265 +12925,288 @@ const ignores = [
|
|
|
12920
12925
|
function getStormConfig(options = {
|
|
12921
12926
|
rules: {},
|
|
12922
12927
|
ignores: [],
|
|
12923
|
-
tsconfig: "./tsconfig.base.json",
|
|
12924
|
-
parserOptions: {},
|
|
12925
12928
|
typescriptEslintConfigType: "eslint-recommended",
|
|
12926
12929
|
useUnicorn: true,
|
|
12927
12930
|
markdown: {},
|
|
12928
12931
|
react: {},
|
|
12929
|
-
|
|
12932
|
+
nx: {},
|
|
12933
|
+
useReactCompiler: false,
|
|
12934
|
+
logLevel: "info"
|
|
12930
12935
|
}, ...userConfigs) {
|
|
12931
|
-
|
|
12936
|
+
var _a;
|
|
12937
|
+
const tsconfig = options.tsconfig;
|
|
12938
|
+
const parserOptions = options.parserOptions;
|
|
12932
12939
|
const typescriptEslintConfigType = options.typescriptEslintConfigType || "eslint-recommended";
|
|
12933
12940
|
const useUnicorn = options.useUnicorn ?? true;
|
|
12934
12941
|
const react = options.react ?? {};
|
|
12942
|
+
const nx = options.nx ?? {};
|
|
12935
12943
|
const useReactCompiler = options.useReactCompiler ?? false;
|
|
12936
|
-
const
|
|
12937
|
-
|
|
12938
|
-
|
|
12939
|
-
|
|
12940
|
-
|
|
12941
|
-
|
|
12942
|
-
|
|
12943
|
-
|
|
12944
|
-
|
|
12945
|
-
|
|
12946
|
-
|
|
12947
|
-
|
|
12948
|
-
|
|
12949
|
-
|
|
12950
|
-
|
|
12951
|
-
|
|
12952
|
-
|
|
12953
|
-
|
|
12954
|
-
|
|
12955
|
-
|
|
12956
|
-
|
|
12957
|
-
"json/json": ["warn", { "allowComments": true }]
|
|
12958
|
-
}
|
|
12959
|
-
},
|
|
12960
|
-
{
|
|
12961
|
-
files: ["**/executors/**/schema.json", "**/generators/**/schema.json"],
|
|
12962
|
-
rules: {
|
|
12963
|
-
"@nx/workspace/valid-schema-description": "error"
|
|
12964
|
-
}
|
|
12965
|
-
},
|
|
12966
|
-
{
|
|
12967
|
-
files: ["**/package.json"],
|
|
12968
|
-
rules: {
|
|
12969
|
-
"@nx/dependency-checks": [
|
|
12970
|
-
"error",
|
|
12971
|
-
{
|
|
12972
|
-
buildTargets: ["build"],
|
|
12973
|
-
ignoredDependencies: ["typescript"],
|
|
12974
|
-
ignoredFiles: [],
|
|
12975
|
-
checkMissingDependencies: true,
|
|
12976
|
-
checkObsoleteDependencies: true,
|
|
12977
|
-
checkVersionMismatches: false,
|
|
12978
|
-
includeTransitiveDependencies: true,
|
|
12979
|
-
useLocalPathsForWorkspaceDependencies: true
|
|
12980
|
-
}
|
|
12981
|
-
]
|
|
12982
|
-
}
|
|
12983
|
-
},
|
|
12984
|
-
// YML
|
|
12985
|
-
// https://www.npmjs.com/package/eslint-plugin-yml
|
|
12986
|
-
...yml.configs["flat/recommended"],
|
|
12987
|
-
...yml.configs["flat/prettier"],
|
|
12988
|
-
// CSpell
|
|
12989
|
-
{
|
|
12990
|
-
plugins: {
|
|
12991
|
-
...plugins
|
|
12944
|
+
const logLevel = options.logLevel ?? "info";
|
|
12945
|
+
try {
|
|
12946
|
+
const configs = [
|
|
12947
|
+
// Prettier
|
|
12948
|
+
prettierConfig,
|
|
12949
|
+
// Import
|
|
12950
|
+
// https://www.npmjs.com/package/eslint-plugin-import
|
|
12951
|
+
// { plugins: { import: importEslint } },
|
|
12952
|
+
// {
|
|
12953
|
+
// files: [CODE_FILE],
|
|
12954
|
+
// rules: importRules
|
|
12955
|
+
// },
|
|
12956
|
+
// bannerConfig,
|
|
12957
|
+
// Json
|
|
12958
|
+
// https://www.npmjs.com/package/eslint-plugin-json
|
|
12959
|
+
{
|
|
12960
|
+
files: ["**/*.json"],
|
|
12961
|
+
...json.configs["recommended"],
|
|
12962
|
+
rules: {
|
|
12963
|
+
"json/json": ["warn", { "allowComments": true }]
|
|
12964
|
+
}
|
|
12992
12965
|
},
|
|
12993
|
-
rules: {
|
|
12994
|
-
...rules,
|
|
12995
|
-
"@cspell/spellchecker": [
|
|
12996
|
-
"warn",
|
|
12997
|
-
{
|
|
12998
|
-
// configFile: new URL(
|
|
12999
|
-
// "./.vscode/cspell.json",
|
|
13000
|
-
// import.meta.url
|
|
13001
|
-
// ).toString(),
|
|
13002
|
-
autoFix: true
|
|
13003
|
-
}
|
|
13004
|
-
]
|
|
13005
|
-
}
|
|
13006
|
-
},
|
|
13007
|
-
// User overrides
|
|
13008
|
-
...userConfigs
|
|
13009
|
-
].filter(Boolean);
|
|
13010
|
-
configs.push(eslint.configs.recommended);
|
|
13011
|
-
if (typescriptEslintConfigType !== "none") {
|
|
13012
|
-
if (!(typescriptEslintConfigType in tsEslint$1.configs)) {
|
|
13013
|
-
console.warn(
|
|
13014
|
-
"Invalid TypeScript ESLint configuration type:",
|
|
13015
|
-
typescriptEslintConfigType
|
|
13016
|
-
);
|
|
13017
|
-
} else {
|
|
13018
|
-
configs.push(
|
|
13019
|
-
...Array.isArray(tsEslint$1.configs[typescriptEslintConfigType]) ? tsEslint$1.configs[typescriptEslintConfigType] : [tsEslint$1.configs[typescriptEslintConfigType]]
|
|
13020
|
-
);
|
|
13021
|
-
}
|
|
13022
|
-
}
|
|
13023
|
-
if (useUnicorn) {
|
|
13024
|
-
configs.push({
|
|
13025
|
-
files: [TS_FILE],
|
|
13026
|
-
plugins: { unicorn },
|
|
13027
|
-
rules: {
|
|
13028
|
-
...unicorn.configs["flat/recommended"].rules
|
|
13029
|
-
}
|
|
13030
|
-
});
|
|
13031
|
-
}
|
|
13032
|
-
configs.push({
|
|
13033
|
-
files: [TS_FILE],
|
|
13034
|
-
plugins: { tsdoc },
|
|
13035
|
-
rules: config
|
|
13036
|
-
});
|
|
13037
|
-
configs.push({
|
|
13038
|
-
// ...banner.configs!["recommended"],
|
|
13039
|
-
name: "banner",
|
|
13040
|
-
plugins: { banner: plugin },
|
|
13041
|
-
files: [TS_FILE],
|
|
13042
|
-
rules: {
|
|
13043
|
-
"banner/banner": [
|
|
13044
|
-
"error",
|
|
13045
|
-
{ commentType: "block", numNewlines: 2, repositoryName: options.name }
|
|
13046
|
-
]
|
|
13047
|
-
}
|
|
13048
|
-
});
|
|
13049
|
-
if (react) {
|
|
13050
|
-
const reactConfigs = [
|
|
13051
12966
|
{
|
|
13052
|
-
|
|
13053
|
-
|
|
13054
|
-
|
|
13055
|
-
|
|
13056
|
-
ignores: [...ignores, ...options.ignores || []],
|
|
13057
|
-
...react
|
|
12967
|
+
files: ["**/executors/**/schema.json", "**/generators/**/schema.json"],
|
|
12968
|
+
rules: nx !== false ? {
|
|
12969
|
+
"@nx/workspace/valid-schema-description": "error"
|
|
12970
|
+
} : {}
|
|
13058
12971
|
},
|
|
13059
12972
|
{
|
|
13060
|
-
|
|
13061
|
-
|
|
13062
|
-
|
|
13063
|
-
|
|
13064
|
-
|
|
13065
|
-
|
|
13066
|
-
|
|
13067
|
-
|
|
13068
|
-
|
|
13069
|
-
|
|
13070
|
-
|
|
13071
|
-
|
|
13072
|
-
|
|
13073
|
-
|
|
13074
|
-
|
|
12973
|
+
files: ["**/package.json"],
|
|
12974
|
+
rules: nx !== false ? {
|
|
12975
|
+
"@nx/dependency-checks": [
|
|
12976
|
+
"error",
|
|
12977
|
+
{
|
|
12978
|
+
buildTargets: ["build"],
|
|
12979
|
+
ignoredDependencies: ["typescript"],
|
|
12980
|
+
ignoredFiles: options.ignores,
|
|
12981
|
+
checkMissingDependencies: true,
|
|
12982
|
+
checkObsoleteDependencies: true,
|
|
12983
|
+
checkVersionMismatches: false,
|
|
12984
|
+
includeTransitiveDependencies: true,
|
|
12985
|
+
useLocalPathsForWorkspaceDependencies: true
|
|
12986
|
+
}
|
|
12987
|
+
]
|
|
12988
|
+
} : {}
|
|
12989
|
+
},
|
|
12990
|
+
// YML
|
|
12991
|
+
// https://www.npmjs.com/package/eslint-plugin-yml
|
|
12992
|
+
...yml.configs["flat/recommended"],
|
|
12993
|
+
...yml.configs["flat/prettier"],
|
|
12994
|
+
// CSpell
|
|
12995
|
+
{
|
|
13075
12996
|
plugins: {
|
|
13076
|
-
|
|
12997
|
+
...plugins
|
|
13077
12998
|
},
|
|
13078
12999
|
rules: {
|
|
13079
|
-
|
|
13000
|
+
...rules,
|
|
13001
|
+
"@cspell/spellchecker": [
|
|
13002
|
+
"warn",
|
|
13003
|
+
{
|
|
13004
|
+
// configFile: new URL(
|
|
13005
|
+
// "./.vscode/cspell.json",
|
|
13006
|
+
// import.meta.url
|
|
13007
|
+
// ).toString(),
|
|
13008
|
+
autoFix: true
|
|
13009
|
+
}
|
|
13010
|
+
]
|
|
13011
|
+
}
|
|
13012
|
+
},
|
|
13013
|
+
// User overrides
|
|
13014
|
+
...userConfigs
|
|
13015
|
+
].filter(Boolean);
|
|
13016
|
+
if (nx) {
|
|
13017
|
+
configs.push({
|
|
13018
|
+
plugins: { "@nx": nxPlugin }
|
|
13019
|
+
});
|
|
13020
|
+
}
|
|
13021
|
+
configs.push(eslint.configs.recommended);
|
|
13022
|
+
if (typescriptEslintConfigType !== "none") {
|
|
13023
|
+
if (!(typescriptEslintConfigType in tsEslint$1.configs)) {
|
|
13024
|
+
console.warn(
|
|
13025
|
+
"Invalid TypeScript ESLint configuration type:",
|
|
13026
|
+
typescriptEslintConfigType
|
|
13027
|
+
);
|
|
13028
|
+
} else {
|
|
13029
|
+
configs.push(
|
|
13030
|
+
...Array.isArray(tsEslint$1.configs[typescriptEslintConfigType]) ? tsEslint$1.configs[typescriptEslintConfigType] : [tsEslint$1.configs[typescriptEslintConfigType]]
|
|
13031
|
+
);
|
|
13032
|
+
}
|
|
13033
|
+
}
|
|
13034
|
+
if (useUnicorn) {
|
|
13035
|
+
configs.push({
|
|
13036
|
+
files: [TS_FILE],
|
|
13037
|
+
plugins: { unicorn },
|
|
13038
|
+
rules: {
|
|
13039
|
+
...unicorn.configs["flat/recommended"].rules
|
|
13080
13040
|
}
|
|
13081
13041
|
});
|
|
13082
13042
|
}
|
|
13083
|
-
configs.push(...reactConfigs);
|
|
13084
|
-
}
|
|
13085
|
-
if (options.nextFiles && options.nextFiles.length > 0) {
|
|
13086
13043
|
configs.push({
|
|
13087
|
-
|
|
13088
|
-
|
|
13089
|
-
|
|
13044
|
+
files: [TS_FILE],
|
|
13045
|
+
plugins: { tsdoc },
|
|
13046
|
+
rules: config
|
|
13090
13047
|
});
|
|
13091
|
-
}
|
|
13092
|
-
configs.push({
|
|
13093
|
-
files: [TS_FILE],
|
|
13094
|
-
languageOptions: {
|
|
13095
|
-
globals: {
|
|
13096
|
-
...Object.fromEntries(
|
|
13097
|
-
Object.keys(globals).flatMap(
|
|
13098
|
-
(group) => Object.keys(globals[group]).map((key) => [
|
|
13099
|
-
key,
|
|
13100
|
-
"readonly"
|
|
13101
|
-
])
|
|
13102
|
-
)
|
|
13103
|
-
),
|
|
13104
|
-
...globals.browser,
|
|
13105
|
-
...globals.node,
|
|
13106
|
-
"window": "readonly",
|
|
13107
|
-
"Storm": "readonly"
|
|
13108
|
-
},
|
|
13109
|
-
parserOptions: {
|
|
13110
|
-
emitDecoratorMetadata: true,
|
|
13111
|
-
experimentalDecorators: true,
|
|
13112
|
-
project: tsconfig,
|
|
13113
|
-
projectService: true,
|
|
13114
|
-
sourceType: "module",
|
|
13115
|
-
projectFolderIgnoreList: [...ignores, ...options.ignores || []],
|
|
13116
|
-
...options.parserOptions
|
|
13117
|
-
}
|
|
13118
|
-
},
|
|
13119
|
-
rules: {
|
|
13120
|
-
...getStormRulesConfig({
|
|
13121
|
-
...options,
|
|
13122
|
-
typescriptEslintConfigType,
|
|
13123
|
-
useUnicorn
|
|
13124
|
-
}),
|
|
13125
|
-
...options.rules ?? {}
|
|
13126
|
-
},
|
|
13127
|
-
ignores: [...ignores, ...options.ignores || []]
|
|
13128
|
-
});
|
|
13129
|
-
if (options.markdown) {
|
|
13130
|
-
configs.push(...markdown.configs.recommended);
|
|
13131
13048
|
configs.push({
|
|
13132
|
-
|
|
13133
|
-
|
|
13049
|
+
// ...banner.configs!["recommended"],
|
|
13050
|
+
name: "banner",
|
|
13051
|
+
plugins: { banner: plugin },
|
|
13052
|
+
files: [TS_FILE],
|
|
13134
13053
|
rules: {
|
|
13135
|
-
"
|
|
13136
|
-
|
|
13137
|
-
|
|
13138
|
-
|
|
13139
|
-
"no-empty-pattern": "off",
|
|
13140
|
-
"no-redeclare": "off",
|
|
13141
|
-
"no-import-assign": "off",
|
|
13142
|
-
...options.markdown
|
|
13054
|
+
"banner/banner": [
|
|
13055
|
+
"error",
|
|
13056
|
+
{ commentType: "block", numNewlines: 2, repositoryName: options.name }
|
|
13057
|
+
]
|
|
13143
13058
|
}
|
|
13144
13059
|
});
|
|
13145
|
-
|
|
13146
|
-
|
|
13147
|
-
|
|
13148
|
-
|
|
13149
|
-
|
|
13150
|
-
|
|
13151
|
-
|
|
13152
|
-
|
|
13153
|
-
|
|
13154
|
-
|
|
13155
|
-
|
|
13060
|
+
if (react) {
|
|
13061
|
+
const reactConfigs = [
|
|
13062
|
+
{
|
|
13063
|
+
...reactPlugin.configs?.recommended,
|
|
13064
|
+
plugins: { "react": reactPlugin },
|
|
13065
|
+
files: ["**/*.tsx"],
|
|
13066
|
+
languageOptions: {
|
|
13067
|
+
parserOptions: {
|
|
13068
|
+
ecmaFeatures: {
|
|
13069
|
+
jsx: true
|
|
13070
|
+
}
|
|
13071
|
+
}
|
|
13072
|
+
},
|
|
13073
|
+
ignores: [...ignores, ...options.ignores || []],
|
|
13074
|
+
...react
|
|
13075
|
+
},
|
|
13076
|
+
{
|
|
13077
|
+
...reactHooks.configs?.recommended,
|
|
13078
|
+
plugins: { "react-hooks": reactHooks },
|
|
13079
|
+
files: [TS_FILE],
|
|
13080
|
+
ignores: [...ignores, ...options.ignores || []]
|
|
13081
|
+
}
|
|
13082
|
+
// {
|
|
13083
|
+
// files: ["**/*.{js,mjs,cjs,jsx,mjsx,ts,tsx,mtsx}"],
|
|
13084
|
+
// ...jsxA11y.flatConfigs?.recommended
|
|
13085
|
+
// }
|
|
13086
|
+
];
|
|
13087
|
+
if (useReactCompiler) {
|
|
13088
|
+
reactConfigs.push({
|
|
13089
|
+
files: ["**/*.tsx"],
|
|
13090
|
+
ignores: [...ignores, ...options.ignores || []],
|
|
13091
|
+
plugins: {
|
|
13092
|
+
"react-compiler": reactCompiler
|
|
13093
|
+
},
|
|
13094
|
+
rules: {
|
|
13095
|
+
"react-compiler/react-compiler": "error"
|
|
13096
|
+
}
|
|
13097
|
+
});
|
|
13156
13098
|
}
|
|
13099
|
+
configs.push(...reactConfigs);
|
|
13100
|
+
}
|
|
13101
|
+
if (options.nextFiles && options.nextFiles.length > 0) {
|
|
13102
|
+
configs.push({
|
|
13103
|
+
...next.configs["core-web-vitals"],
|
|
13104
|
+
ignores: [...options.ignores || []],
|
|
13105
|
+
files: options.nextFiles
|
|
13106
|
+
});
|
|
13107
|
+
}
|
|
13108
|
+
const typescriptConfig = {
|
|
13109
|
+
files: [TS_FILE],
|
|
13110
|
+
languageOptions: {
|
|
13111
|
+
globals: {
|
|
13112
|
+
...Object.fromEntries(
|
|
13113
|
+
Object.keys(globals).flatMap(
|
|
13114
|
+
(group) => Object.keys(globals[group]).map((key) => [
|
|
13115
|
+
key,
|
|
13116
|
+
"readonly"
|
|
13117
|
+
])
|
|
13118
|
+
)
|
|
13119
|
+
),
|
|
13120
|
+
...globals.browser,
|
|
13121
|
+
...globals.node,
|
|
13122
|
+
"window": "readonly",
|
|
13123
|
+
"Storm": "readonly"
|
|
13124
|
+
}
|
|
13125
|
+
},
|
|
13126
|
+
rules: {
|
|
13127
|
+
...getStormRulesConfig({
|
|
13128
|
+
...options,
|
|
13129
|
+
typescriptEslintConfigType,
|
|
13130
|
+
useUnicorn,
|
|
13131
|
+
useNx: nx !== false
|
|
13132
|
+
}),
|
|
13133
|
+
...Object.keys(options.rules ?? {}).filter(
|
|
13134
|
+
(ruleId) => !useUnicorn || !ruleId.startsWith("unicorn/") || !react || !ruleId.startsWith("react/") && !ruleId.startsWith("react-hooks/")
|
|
13135
|
+
).reduce((ret, ruleId) => {
|
|
13136
|
+
ret[ruleId] = options.rules[ruleId];
|
|
13137
|
+
return ret;
|
|
13138
|
+
}, {})
|
|
13139
|
+
},
|
|
13140
|
+
ignores: [...ignores, ...options.ignores || []]
|
|
13141
|
+
};
|
|
13142
|
+
if (parserOptions) {
|
|
13143
|
+
typescriptConfig.languageOptions ?? (typescriptConfig.languageOptions = {});
|
|
13144
|
+
typescriptConfig.languageOptions.parserOptions = parserOptions;
|
|
13145
|
+
}
|
|
13146
|
+
if (tsconfig) {
|
|
13147
|
+
typescriptConfig.languageOptions ?? (typescriptConfig.languageOptions = {});
|
|
13148
|
+
(_a = typescriptConfig.languageOptions).parserOptions ?? (_a.parserOptions = {});
|
|
13149
|
+
typescriptConfig.languageOptions.parserOptions.project = tsconfig;
|
|
13150
|
+
}
|
|
13151
|
+
configs.push(typescriptConfig);
|
|
13152
|
+
if (options.markdown) {
|
|
13153
|
+
configs.push(...markdown.configs.recommended);
|
|
13154
|
+
configs.push({
|
|
13155
|
+
files: [CODE_BLOCK],
|
|
13156
|
+
processor: "markdown/markdown",
|
|
13157
|
+
rules: {
|
|
13158
|
+
"unicorn/filename-case": "off",
|
|
13159
|
+
"no-undef": "off",
|
|
13160
|
+
"no-unused-expressions": "off",
|
|
13161
|
+
"padded-blocks": "off",
|
|
13162
|
+
"no-empty-pattern": "off",
|
|
13163
|
+
"no-redeclare": "off",
|
|
13164
|
+
"no-import-assign": "off",
|
|
13165
|
+
...options.markdown
|
|
13166
|
+
}
|
|
13167
|
+
});
|
|
13168
|
+
configs.push({
|
|
13169
|
+
files: ["**/*.md/*.js", "**/*.md/*.ts"],
|
|
13170
|
+
rules: {
|
|
13171
|
+
"unicorn/filename-case": "off",
|
|
13172
|
+
"no-undef": "off",
|
|
13173
|
+
"no-unused-expressions": "off",
|
|
13174
|
+
"padded-blocks": "off",
|
|
13175
|
+
"no-empty-pattern": "off",
|
|
13176
|
+
"no-redeclare": "off",
|
|
13177
|
+
"no-import-assign": "off",
|
|
13178
|
+
...options.markdown
|
|
13179
|
+
}
|
|
13180
|
+
});
|
|
13181
|
+
}
|
|
13182
|
+
const result = formatConfig(
|
|
13183
|
+
"Preset",
|
|
13184
|
+
configs.reduce((ret, config) => {
|
|
13185
|
+
const existingIndex = ret.findIndex(
|
|
13186
|
+
(existing) => areFilesEqual(existing.files, config.files)
|
|
13187
|
+
);
|
|
13188
|
+
if (existingIndex >= 0) {
|
|
13189
|
+
ret[existingIndex] = defu(ret[existingIndex], config);
|
|
13190
|
+
} else {
|
|
13191
|
+
ret.push(config);
|
|
13192
|
+
}
|
|
13193
|
+
return ret;
|
|
13194
|
+
}, [])
|
|
13195
|
+
);
|
|
13196
|
+
writeInfo("\u2699\uFE0F Completed generated Storm ESLint configuration objects", {
|
|
13197
|
+
logLevel
|
|
13157
13198
|
});
|
|
13199
|
+
writeDebug(formatLogMessage(result, { skip: ["globals"] }), {
|
|
13200
|
+
logLevel
|
|
13201
|
+
});
|
|
13202
|
+
return result;
|
|
13203
|
+
} catch (error) {
|
|
13204
|
+
writeFatal("Error generating Storm ESLint configuration objects", {
|
|
13205
|
+
logLevel
|
|
13206
|
+
});
|
|
13207
|
+
writeError(error, { logLevel });
|
|
13208
|
+
throw error;
|
|
13158
13209
|
}
|
|
13159
|
-
writeInfo("\u2699\uFE0F Merging generated Storm ESLint configuration objects", {
|
|
13160
|
-
logLevel: "all"
|
|
13161
|
-
});
|
|
13162
|
-
writeDebug(configs, { logLevel: "all" });
|
|
13163
|
-
const result = formatConfig(
|
|
13164
|
-
"Preset",
|
|
13165
|
-
configs.reduce((ret, config) => {
|
|
13166
|
-
const existingIndex = ret.findIndex(
|
|
13167
|
-
(existing) => areFilesEqual(existing.files, config.files)
|
|
13168
|
-
);
|
|
13169
|
-
if (existingIndex >= 0) {
|
|
13170
|
-
ret[existingIndex] = defu(ret[existingIndex], config);
|
|
13171
|
-
} else {
|
|
13172
|
-
ret.push(config);
|
|
13173
|
-
}
|
|
13174
|
-
return ret;
|
|
13175
|
-
}, [])
|
|
13176
|
-
);
|
|
13177
|
-
writeInfo("\u2699\uFE0F Completed generated Storm ESLint configuration objects", {
|
|
13178
|
-
logLevel: "all"
|
|
13179
|
-
});
|
|
13180
|
-
writeDebug(result, { logLevel: "all" });
|
|
13181
|
-
return result;
|
|
13182
13210
|
}
|
|
13183
13211
|
const areFilesEqual = (files1, files2) => {
|
|
13184
13212
|
if (files1 === files2) {
|
package/package.json
CHANGED