@storm-software/eslint 0.170.85 → 0.170.86
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/preset.cjs +153 -22
- package/dist/preset.js +153 -21
- package/package.json +8 -10
package/dist/preset.cjs
CHANGED
|
@@ -29,14 +29,14 @@ var braceExpansion = require('brace-expansion');
|
|
|
29
29
|
var semver = require('semver');
|
|
30
30
|
var isGlob = require('is-glob');
|
|
31
31
|
var eslintUnsupportedApi = require('eslint/use-at-your-own-risk');
|
|
32
|
-
var
|
|
33
|
-
var
|
|
34
|
-
var
|
|
35
|
-
var
|
|
36
|
-
var
|
|
37
|
-
var
|
|
38
|
-
var
|
|
39
|
-
var
|
|
32
|
+
var utils = require('@typescript-eslint/utils');
|
|
33
|
+
var default5 = require('eslint-plugin-n');
|
|
34
|
+
var default6 = require('eslint-plugin-no-only-tests');
|
|
35
|
+
var default7 = require('eslint-plugin-no-secrets');
|
|
36
|
+
var default8 = require('eslint-plugin-perfectionist');
|
|
37
|
+
var default9 = require('eslint-plugin-prettier');
|
|
38
|
+
var default10 = require('eslint-plugin-unicorn');
|
|
39
|
+
var default11 = require('eslint-plugin-unused-imports');
|
|
40
40
|
var globalsLib = require('globals');
|
|
41
41
|
var eslintMergeProcessors = require('eslint-merge-processors');
|
|
42
42
|
var devkit = require('@nx/devkit');
|
|
@@ -90,7 +90,6 @@ var default8__default = /*#__PURE__*/_interopDefault(default8);
|
|
|
90
90
|
var default9__default = /*#__PURE__*/_interopDefault(default9);
|
|
91
91
|
var default10__default = /*#__PURE__*/_interopDefault(default10);
|
|
92
92
|
var default11__default = /*#__PURE__*/_interopDefault(default11);
|
|
93
|
-
var default12__default = /*#__PURE__*/_interopDefault(default12);
|
|
94
93
|
var globalsLib__default = /*#__PURE__*/_interopDefault(globalsLib);
|
|
95
94
|
var jsoncParser__namespace = /*#__PURE__*/_interopNamespace(jsoncParser);
|
|
96
95
|
var yamlParser__namespace = /*#__PURE__*/_interopNamespace(yamlParser);
|
|
@@ -5659,7 +5658,7 @@ init_cjs_shims();
|
|
|
5659
5658
|
|
|
5660
5659
|
// ../eslint-plugin-banner/package.json
|
|
5661
5660
|
var package_default = {
|
|
5662
|
-
version: "0.0.
|
|
5661
|
+
version: "0.0.23"};
|
|
5663
5662
|
|
|
5664
5663
|
// ../eslint-plugin-banner/src/rules/banner.ts
|
|
5665
5664
|
init_cjs_shims();
|
|
@@ -17486,6 +17485,138 @@ plugin2.flatConfigs = flatConfigs;
|
|
|
17486
17485
|
plugin2.configs = configs2;
|
|
17487
17486
|
var lib_default = plugin2;
|
|
17488
17487
|
|
|
17488
|
+
// ../../node_modules/.pnpm/eslint-plugin-import-zod@1.2.1_@typescript-eslint+utils@8.61.0_eslint@10.5.0_jiti@2.7.0_93f73e2cf9fd550a22d85f8bbd8eb2eb/node_modules/eslint-plugin-import-zod/dist/index.mjs
|
|
17489
|
+
init_cjs_shims();
|
|
17490
|
+
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
17491
|
+
var __esm2 = (fn, res) => function() {
|
|
17492
|
+
return fn && (res = (0, fn[__getOwnPropNames2(fn)[0]])(fn = 0)), res;
|
|
17493
|
+
};
|
|
17494
|
+
var __commonJS2 = (cb, mod) => function() {
|
|
17495
|
+
return mod || (0, cb[__getOwnPropNames2(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
17496
|
+
};
|
|
17497
|
+
var createRule3;
|
|
17498
|
+
var getImportSource;
|
|
17499
|
+
var isAllSameSubmodule;
|
|
17500
|
+
var prefer_zod_namespace_default;
|
|
17501
|
+
var init_prefer_zod_namespace = __esm2({ "src/rules/prefer-zod-namespace.ts"() {
|
|
17502
|
+
createRule3 = utils.ESLintUtils.RuleCreator((name3) => `https://github.com/samchungy/eslint-plugin-import-zod/blob/main/docs/rules/${name3}.md`);
|
|
17503
|
+
getImportSource = (importedName, originalSource) => {
|
|
17504
|
+
return importedName === "core" && originalSource === "zod/v4" ? `${originalSource}/${importedName}` : originalSource;
|
|
17505
|
+
};
|
|
17506
|
+
isAllSameSubmodule = (specifiers, targetName) => {
|
|
17507
|
+
return specifiers.every((s) => s.imported.type === utils.TSESTree.AST_NODE_TYPES.Identifier && s.imported.name === targetName);
|
|
17508
|
+
};
|
|
17509
|
+
prefer_zod_namespace_default = createRule3({
|
|
17510
|
+
name: "prefer-zod-namespace",
|
|
17511
|
+
meta: {
|
|
17512
|
+
type: "suggestion",
|
|
17513
|
+
docs: { description: "Enforce using namespace imports for zod" },
|
|
17514
|
+
fixable: "code",
|
|
17515
|
+
schema: [],
|
|
17516
|
+
messages: { preferNamespaceImport: 'Import zod as a namespace (import * as z from "zod") instead of destructuring its exports or using default imports' }
|
|
17517
|
+
},
|
|
17518
|
+
defaultOptions: [],
|
|
17519
|
+
create(context) {
|
|
17520
|
+
return { ImportDeclaration(node2) {
|
|
17521
|
+
if (node2.source.value !== "zod" && !node2.source.value.startsWith("zod/")) return;
|
|
17522
|
+
const namedSpecifiers = node2.specifiers.filter((specifier) => specifier.type === utils.TSESTree.AST_NODE_TYPES.ImportSpecifier);
|
|
17523
|
+
const defaultSpecifiers = node2.specifiers.filter((specifier) => specifier.type === utils.TSESTree.AST_NODE_TYPES.ImportDefaultSpecifier);
|
|
17524
|
+
if (namedSpecifiers.length === 0 && defaultSpecifiers.length === 0) return;
|
|
17525
|
+
const zodSpecifiers = namedSpecifiers.filter((specifier) => specifier.imported.type === utils.TSESTree.AST_NODE_TYPES.Identifier && (specifier.imported.name === "z" || specifier.imported.name === "core"));
|
|
17526
|
+
const zodDefaultSpecifiers = defaultSpecifiers;
|
|
17527
|
+
if (zodSpecifiers.length === 0 && zodDefaultSpecifiers.length === 0) return;
|
|
17528
|
+
for (const zodDefaultSpecifier of zodDefaultSpecifiers) {
|
|
17529
|
+
const localName = zodDefaultSpecifier.local.name;
|
|
17530
|
+
const importSource = node2.source.value;
|
|
17531
|
+
context.report({
|
|
17532
|
+
node: zodDefaultSpecifier,
|
|
17533
|
+
messageId: "preferNamespaceImport",
|
|
17534
|
+
fix(fixer) {
|
|
17535
|
+
if (node2.specifiers.length === 1) {
|
|
17536
|
+
const isTypeOnlyImport = node2.importKind === "type";
|
|
17537
|
+
const typePrefix = isTypeOnlyImport ? "type " : "";
|
|
17538
|
+
return fixer.replaceText(node2, `import ${typePrefix}* as ${localName} from '${importSource}';`);
|
|
17539
|
+
} else {
|
|
17540
|
+
const otherSpecifiers = node2.specifiers.filter((s) => s !== zodDefaultSpecifier);
|
|
17541
|
+
const isTypeOnlyImport = node2.importKind === "type";
|
|
17542
|
+
const typePrefix = isTypeOnlyImport ? "type " : "";
|
|
17543
|
+
const namespaceImport = `import ${typePrefix}* as ${localName} from '${importSource}';
|
|
17544
|
+
`;
|
|
17545
|
+
const otherImportParts = [];
|
|
17546
|
+
const otherDefaultSpecifiers = otherSpecifiers.filter((s) => s.type === utils.TSESTree.AST_NODE_TYPES.ImportDefaultSpecifier);
|
|
17547
|
+
const otherNamedSpecifiers = otherSpecifiers.filter((s) => s.type === utils.TSESTree.AST_NODE_TYPES.ImportSpecifier);
|
|
17548
|
+
if (otherDefaultSpecifiers.length > 0) {
|
|
17549
|
+
const defaultName = otherDefaultSpecifiers[0].local.name;
|
|
17550
|
+
otherImportParts.push(defaultName);
|
|
17551
|
+
}
|
|
17552
|
+
if (otherNamedSpecifiers.length > 0) {
|
|
17553
|
+
const namedPart = `{ ${otherNamedSpecifiers.map((s) => {
|
|
17554
|
+
const specifierLocalName = s.local.name;
|
|
17555
|
+
const specifierImportedName = s.imported.type === utils.TSESTree.AST_NODE_TYPES.Identifier ? s.imported.name : "";
|
|
17556
|
+
const typeModifier = !isTypeOnlyImport && s.importKind === "type" ? "type " : "";
|
|
17557
|
+
return specifierLocalName === specifierImportedName ? `${typeModifier}${specifierImportedName}` : `${typeModifier}${specifierImportedName} as ${specifierLocalName}`;
|
|
17558
|
+
}).join(", ")} }`;
|
|
17559
|
+
otherImportParts.push(namedPart);
|
|
17560
|
+
}
|
|
17561
|
+
const otherImport = `import ${isTypeOnlyImport ? "type " : ""}${otherImportParts.join(", ")} from '${importSource}';`;
|
|
17562
|
+
return fixer.replaceText(node2, `${namespaceImport}${otherImport}`);
|
|
17563
|
+
}
|
|
17564
|
+
}
|
|
17565
|
+
});
|
|
17566
|
+
}
|
|
17567
|
+
for (const zodSpecifier of zodSpecifiers) {
|
|
17568
|
+
const localName = zodSpecifier.local.name;
|
|
17569
|
+
const importedName = zodSpecifier.imported.name;
|
|
17570
|
+
const importSource = getImportSource(importedName, node2.source.value);
|
|
17571
|
+
const isSubmoduleImport = importSource !== node2.source.value;
|
|
17572
|
+
context.report({
|
|
17573
|
+
node: zodSpecifier,
|
|
17574
|
+
messageId: "preferNamespaceImport",
|
|
17575
|
+
fix(fixer) {
|
|
17576
|
+
if (namedSpecifiers.length === 1 || isSubmoduleImport && isAllSameSubmodule(namedSpecifiers, importedName)) {
|
|
17577
|
+
const isTypeOnlyImport = node2.importKind === "type";
|
|
17578
|
+
const typePrefix = isTypeOnlyImport ? "type " : "";
|
|
17579
|
+
return fixer.replaceText(node2, `import ${typePrefix}* as ${localName} from '${importSource}';`);
|
|
17580
|
+
} else {
|
|
17581
|
+
const otherSpecifiers = namedSpecifiers.filter((s) => s !== zodSpecifier);
|
|
17582
|
+
const isTypeOnlyImport = node2.importKind === "type";
|
|
17583
|
+
const typePrefix = isTypeOnlyImport ? "type " : "";
|
|
17584
|
+
const namespaceImport = `import ${typePrefix}* as ${localName} from '${importSource}';
|
|
17585
|
+
`;
|
|
17586
|
+
const originalSource = node2.source.value;
|
|
17587
|
+
const otherImport = `import ${isTypeOnlyImport ? "type " : ""}{ ${otherSpecifiers.map((s) => {
|
|
17588
|
+
const specifierLocalName = s.local.name;
|
|
17589
|
+
const specifierImportedName = s.imported.type === utils.TSESTree.AST_NODE_TYPES.Identifier ? s.imported.name : "";
|
|
17590
|
+
const typeModifier = !isTypeOnlyImport && s.importKind === "type" ? "type " : "";
|
|
17591
|
+
return specifierLocalName === specifierImportedName ? `${typeModifier}${specifierImportedName}` : `${typeModifier}${specifierImportedName} as ${specifierLocalName}`;
|
|
17592
|
+
}).join(", ")} } from '${originalSource}';`;
|
|
17593
|
+
return fixer.replaceText(node2, `${namespaceImport}${otherImport}`);
|
|
17594
|
+
}
|
|
17595
|
+
}
|
|
17596
|
+
});
|
|
17597
|
+
}
|
|
17598
|
+
} };
|
|
17599
|
+
}
|
|
17600
|
+
});
|
|
17601
|
+
} });
|
|
17602
|
+
var require_src = __commonJS2({ "src/index.ts"(exports, module) {
|
|
17603
|
+
init_prefer_zod_namespace();
|
|
17604
|
+
const importZod = {
|
|
17605
|
+
meta: {
|
|
17606
|
+
name: "import-zod",
|
|
17607
|
+
version: "1.0.0"
|
|
17608
|
+
},
|
|
17609
|
+
rules: { "prefer-zod-namespace": prefer_zod_namespace_default },
|
|
17610
|
+
configs: {}
|
|
17611
|
+
};
|
|
17612
|
+
Object.assign(importZod.configs, { recommended: [{
|
|
17613
|
+
plugins: { "import-zod": importZod },
|
|
17614
|
+
rules: { "import-zod/prefer-zod-namespace": "error" }
|
|
17615
|
+
}] });
|
|
17616
|
+
module.exports = importZod;
|
|
17617
|
+
} });
|
|
17618
|
+
var dist_default = require_src();
|
|
17619
|
+
|
|
17489
17620
|
// src/configs/imports.ts
|
|
17490
17621
|
async function imports(options = {}) {
|
|
17491
17622
|
const { stylistic: stylistic2 = true } = options;
|
|
@@ -17542,7 +17673,7 @@ async function javascript(options = {}) {
|
|
|
17542
17673
|
{
|
|
17543
17674
|
name: "storm/javascript/rules",
|
|
17544
17675
|
plugins: {
|
|
17545
|
-
"unused-imports":
|
|
17676
|
+
"unused-imports": default11__default.default
|
|
17546
17677
|
},
|
|
17547
17678
|
rules: {
|
|
17548
17679
|
// disallow use of console
|
|
@@ -18850,7 +18981,7 @@ async function node() {
|
|
|
18850
18981
|
{
|
|
18851
18982
|
name: "storm/node/rules",
|
|
18852
18983
|
plugins: {
|
|
18853
|
-
node:
|
|
18984
|
+
node: default5__default.default
|
|
18854
18985
|
},
|
|
18855
18986
|
rules: {
|
|
18856
18987
|
"node/handle-callback-err": ["error", "^(err|error)$"],
|
|
@@ -18940,7 +19071,7 @@ async function perfectionist() {
|
|
|
18940
19071
|
{
|
|
18941
19072
|
name: "storm/perfectionist/rules",
|
|
18942
19073
|
plugins: {
|
|
18943
|
-
perfectionist:
|
|
19074
|
+
perfectionist: default8__default.default
|
|
18944
19075
|
},
|
|
18945
19076
|
rules: {
|
|
18946
19077
|
"perfectionist/sort-exports": [
|
|
@@ -19007,7 +19138,7 @@ function RuleCreator3(urlCreator) {
|
|
|
19007
19138
|
meta: meta3,
|
|
19008
19139
|
...rule
|
|
19009
19140
|
}) {
|
|
19010
|
-
return
|
|
19141
|
+
return createRule4({
|
|
19011
19142
|
meta: {
|
|
19012
19143
|
...meta3,
|
|
19013
19144
|
docs: {
|
|
@@ -19019,7 +19150,7 @@ function RuleCreator3(urlCreator) {
|
|
|
19019
19150
|
});
|
|
19020
19151
|
};
|
|
19021
19152
|
}
|
|
19022
|
-
function
|
|
19153
|
+
function createRule4({
|
|
19023
19154
|
create,
|
|
19024
19155
|
defaultOptions,
|
|
19025
19156
|
meta: meta3
|
|
@@ -19679,7 +19810,7 @@ plugin3.configs = configs3;
|
|
|
19679
19810
|
|
|
19680
19811
|
// ../eslint-plugin-pnpm/package.json
|
|
19681
19812
|
var package_default2 = {
|
|
19682
|
-
version: "0.0.
|
|
19813
|
+
version: "0.0.22"};
|
|
19683
19814
|
|
|
19684
19815
|
// ../eslint-plugin-pnpm/src/plugin.ts
|
|
19685
19816
|
var plugin4 = {
|
|
@@ -19855,7 +19986,7 @@ async function prettier() {
|
|
|
19855
19986
|
{
|
|
19856
19987
|
name: "storm/prettier",
|
|
19857
19988
|
plugins: {
|
|
19858
|
-
prettier:
|
|
19989
|
+
prettier: default9__default.default
|
|
19859
19990
|
},
|
|
19860
19991
|
rules: {
|
|
19861
19992
|
"prettier/prettier": "error",
|
|
@@ -20137,7 +20268,7 @@ async function secrets(options) {
|
|
|
20137
20268
|
name: "storm/secrets/rules",
|
|
20138
20269
|
files: [`**/*.{js,ts,jsx,tsx${json ? ",json,jsonc" : ""}`],
|
|
20139
20270
|
plugins: {
|
|
20140
|
-
"no-secrets":
|
|
20271
|
+
"no-secrets": default7__default.default
|
|
20141
20272
|
},
|
|
20142
20273
|
rules: {
|
|
20143
20274
|
"no-secrets/no-secrets": [
|
|
@@ -20441,7 +20572,7 @@ async function test(options = {}) {
|
|
|
20441
20572
|
rules: {
|
|
20442
20573
|
...default4__default.default.rules,
|
|
20443
20574
|
// extend `test/no-only-tests` rule
|
|
20444
|
-
...
|
|
20575
|
+
...default6__default.default.rules
|
|
20445
20576
|
}
|
|
20446
20577
|
};
|
|
20447
20578
|
return [
|
|
@@ -20876,10 +21007,10 @@ async function unicorn(options = {}) {
|
|
|
20876
21007
|
{
|
|
20877
21008
|
name: "storm/unicorn/rules",
|
|
20878
21009
|
plugins: {
|
|
20879
|
-
unicorn:
|
|
21010
|
+
unicorn: default10__default.default
|
|
20880
21011
|
},
|
|
20881
21012
|
rules: {
|
|
20882
|
-
...options.allRecommended ?
|
|
21013
|
+
...options.allRecommended ? default10__default.default.configs["recommended"].rules : {
|
|
20883
21014
|
"unicorn/consistent-empty-array-spread": "error",
|
|
20884
21015
|
"unicorn/error-message": "error",
|
|
20885
21016
|
"unicorn/escape-case": "error",
|
|
@@ -21015,7 +21146,7 @@ async function zod(options = {}) {
|
|
|
21015
21146
|
name: "storm/zod/rules",
|
|
21016
21147
|
files: [GLOB_SRC],
|
|
21017
21148
|
plugins: {
|
|
21018
|
-
"import-zod":
|
|
21149
|
+
"import-zod": dist_default
|
|
21019
21150
|
},
|
|
21020
21151
|
rules: {
|
|
21021
21152
|
"import-zod/prefer-zod-namespace": "error"
|
package/dist/preset.js
CHANGED
|
@@ -35,14 +35,14 @@ import { expand } from 'brace-expansion';
|
|
|
35
35
|
import * as semver from 'semver';
|
|
36
36
|
import isGlob from 'is-glob';
|
|
37
37
|
import eslintUnsupportedApi from 'eslint/use-at-your-own-risk';
|
|
38
|
-
import
|
|
39
|
-
import
|
|
40
|
-
import
|
|
41
|
-
import
|
|
42
|
-
import
|
|
43
|
-
import
|
|
44
|
-
import
|
|
45
|
-
import
|
|
38
|
+
import { ESLintUtils, TSESTree as TSESTree$1 } from '@typescript-eslint/utils';
|
|
39
|
+
import default5 from 'eslint-plugin-n';
|
|
40
|
+
import default6 from 'eslint-plugin-no-only-tests';
|
|
41
|
+
import default7 from 'eslint-plugin-no-secrets';
|
|
42
|
+
import default8 from 'eslint-plugin-perfectionist';
|
|
43
|
+
import default9 from 'eslint-plugin-prettier';
|
|
44
|
+
import default10 from 'eslint-plugin-unicorn';
|
|
45
|
+
import default11 from 'eslint-plugin-unused-imports';
|
|
46
46
|
import globalsLib from 'globals';
|
|
47
47
|
import { mergeProcessors, processorPassThrough } from 'eslint-merge-processors';
|
|
48
48
|
import { readCachedProjectGraph, createProjectGraphAsync } from '@nx/devkit';
|
|
@@ -5515,7 +5515,7 @@ init_esm_shims();
|
|
|
5515
5515
|
|
|
5516
5516
|
// ../eslint-plugin-banner/package.json
|
|
5517
5517
|
var package_default = {
|
|
5518
|
-
version: "0.0.
|
|
5518
|
+
version: "0.0.23"};
|
|
5519
5519
|
|
|
5520
5520
|
// ../eslint-plugin-banner/src/rules/banner.ts
|
|
5521
5521
|
init_esm_shims();
|
|
@@ -17084,6 +17084,138 @@ plugin2.flatConfigs = flatConfigs;
|
|
|
17084
17084
|
plugin2.configs = configs2;
|
|
17085
17085
|
var lib_default = plugin2;
|
|
17086
17086
|
|
|
17087
|
+
// ../../node_modules/.pnpm/eslint-plugin-import-zod@1.2.1_@typescript-eslint+utils@8.61.0_eslint@10.5.0_jiti@2.7.0_93f73e2cf9fd550a22d85f8bbd8eb2eb/node_modules/eslint-plugin-import-zod/dist/index.mjs
|
|
17088
|
+
init_esm_shims();
|
|
17089
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
17090
|
+
var __esm = (fn, res) => function() {
|
|
17091
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
17092
|
+
};
|
|
17093
|
+
var __commonJS2 = (cb, mod) => function() {
|
|
17094
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
17095
|
+
};
|
|
17096
|
+
var createRule3;
|
|
17097
|
+
var getImportSource;
|
|
17098
|
+
var isAllSameSubmodule;
|
|
17099
|
+
var prefer_zod_namespace_default;
|
|
17100
|
+
var init_prefer_zod_namespace = __esm({ "src/rules/prefer-zod-namespace.ts"() {
|
|
17101
|
+
createRule3 = ESLintUtils.RuleCreator((name3) => `https://github.com/samchungy/eslint-plugin-import-zod/blob/main/docs/rules/${name3}.md`);
|
|
17102
|
+
getImportSource = (importedName, originalSource) => {
|
|
17103
|
+
return importedName === "core" && originalSource === "zod/v4" ? `${originalSource}/${importedName}` : originalSource;
|
|
17104
|
+
};
|
|
17105
|
+
isAllSameSubmodule = (specifiers, targetName) => {
|
|
17106
|
+
return specifiers.every((s) => s.imported.type === TSESTree$1.AST_NODE_TYPES.Identifier && s.imported.name === targetName);
|
|
17107
|
+
};
|
|
17108
|
+
prefer_zod_namespace_default = createRule3({
|
|
17109
|
+
name: "prefer-zod-namespace",
|
|
17110
|
+
meta: {
|
|
17111
|
+
type: "suggestion",
|
|
17112
|
+
docs: { description: "Enforce using namespace imports for zod" },
|
|
17113
|
+
fixable: "code",
|
|
17114
|
+
schema: [],
|
|
17115
|
+
messages: { preferNamespaceImport: 'Import zod as a namespace (import * as z from "zod") instead of destructuring its exports or using default imports' }
|
|
17116
|
+
},
|
|
17117
|
+
defaultOptions: [],
|
|
17118
|
+
create(context) {
|
|
17119
|
+
return { ImportDeclaration(node2) {
|
|
17120
|
+
if (node2.source.value !== "zod" && !node2.source.value.startsWith("zod/")) return;
|
|
17121
|
+
const namedSpecifiers = node2.specifiers.filter((specifier) => specifier.type === TSESTree$1.AST_NODE_TYPES.ImportSpecifier);
|
|
17122
|
+
const defaultSpecifiers = node2.specifiers.filter((specifier) => specifier.type === TSESTree$1.AST_NODE_TYPES.ImportDefaultSpecifier);
|
|
17123
|
+
if (namedSpecifiers.length === 0 && defaultSpecifiers.length === 0) return;
|
|
17124
|
+
const zodSpecifiers = namedSpecifiers.filter((specifier) => specifier.imported.type === TSESTree$1.AST_NODE_TYPES.Identifier && (specifier.imported.name === "z" || specifier.imported.name === "core"));
|
|
17125
|
+
const zodDefaultSpecifiers = defaultSpecifiers;
|
|
17126
|
+
if (zodSpecifiers.length === 0 && zodDefaultSpecifiers.length === 0) return;
|
|
17127
|
+
for (const zodDefaultSpecifier of zodDefaultSpecifiers) {
|
|
17128
|
+
const localName = zodDefaultSpecifier.local.name;
|
|
17129
|
+
const importSource = node2.source.value;
|
|
17130
|
+
context.report({
|
|
17131
|
+
node: zodDefaultSpecifier,
|
|
17132
|
+
messageId: "preferNamespaceImport",
|
|
17133
|
+
fix(fixer) {
|
|
17134
|
+
if (node2.specifiers.length === 1) {
|
|
17135
|
+
const isTypeOnlyImport = node2.importKind === "type";
|
|
17136
|
+
const typePrefix = isTypeOnlyImport ? "type " : "";
|
|
17137
|
+
return fixer.replaceText(node2, `import ${typePrefix}* as ${localName} from '${importSource}';`);
|
|
17138
|
+
} else {
|
|
17139
|
+
const otherSpecifiers = node2.specifiers.filter((s) => s !== zodDefaultSpecifier);
|
|
17140
|
+
const isTypeOnlyImport = node2.importKind === "type";
|
|
17141
|
+
const typePrefix = isTypeOnlyImport ? "type " : "";
|
|
17142
|
+
const namespaceImport = `import ${typePrefix}* as ${localName} from '${importSource}';
|
|
17143
|
+
`;
|
|
17144
|
+
const otherImportParts = [];
|
|
17145
|
+
const otherDefaultSpecifiers = otherSpecifiers.filter((s) => s.type === TSESTree$1.AST_NODE_TYPES.ImportDefaultSpecifier);
|
|
17146
|
+
const otherNamedSpecifiers = otherSpecifiers.filter((s) => s.type === TSESTree$1.AST_NODE_TYPES.ImportSpecifier);
|
|
17147
|
+
if (otherDefaultSpecifiers.length > 0) {
|
|
17148
|
+
const defaultName = otherDefaultSpecifiers[0].local.name;
|
|
17149
|
+
otherImportParts.push(defaultName);
|
|
17150
|
+
}
|
|
17151
|
+
if (otherNamedSpecifiers.length > 0) {
|
|
17152
|
+
const namedPart = `{ ${otherNamedSpecifiers.map((s) => {
|
|
17153
|
+
const specifierLocalName = s.local.name;
|
|
17154
|
+
const specifierImportedName = s.imported.type === TSESTree$1.AST_NODE_TYPES.Identifier ? s.imported.name : "";
|
|
17155
|
+
const typeModifier = !isTypeOnlyImport && s.importKind === "type" ? "type " : "";
|
|
17156
|
+
return specifierLocalName === specifierImportedName ? `${typeModifier}${specifierImportedName}` : `${typeModifier}${specifierImportedName} as ${specifierLocalName}`;
|
|
17157
|
+
}).join(", ")} }`;
|
|
17158
|
+
otherImportParts.push(namedPart);
|
|
17159
|
+
}
|
|
17160
|
+
const otherImport = `import ${isTypeOnlyImport ? "type " : ""}${otherImportParts.join(", ")} from '${importSource}';`;
|
|
17161
|
+
return fixer.replaceText(node2, `${namespaceImport}${otherImport}`);
|
|
17162
|
+
}
|
|
17163
|
+
}
|
|
17164
|
+
});
|
|
17165
|
+
}
|
|
17166
|
+
for (const zodSpecifier of zodSpecifiers) {
|
|
17167
|
+
const localName = zodSpecifier.local.name;
|
|
17168
|
+
const importedName = zodSpecifier.imported.name;
|
|
17169
|
+
const importSource = getImportSource(importedName, node2.source.value);
|
|
17170
|
+
const isSubmoduleImport = importSource !== node2.source.value;
|
|
17171
|
+
context.report({
|
|
17172
|
+
node: zodSpecifier,
|
|
17173
|
+
messageId: "preferNamespaceImport",
|
|
17174
|
+
fix(fixer) {
|
|
17175
|
+
if (namedSpecifiers.length === 1 || isSubmoduleImport && isAllSameSubmodule(namedSpecifiers, importedName)) {
|
|
17176
|
+
const isTypeOnlyImport = node2.importKind === "type";
|
|
17177
|
+
const typePrefix = isTypeOnlyImport ? "type " : "";
|
|
17178
|
+
return fixer.replaceText(node2, `import ${typePrefix}* as ${localName} from '${importSource}';`);
|
|
17179
|
+
} else {
|
|
17180
|
+
const otherSpecifiers = namedSpecifiers.filter((s) => s !== zodSpecifier);
|
|
17181
|
+
const isTypeOnlyImport = node2.importKind === "type";
|
|
17182
|
+
const typePrefix = isTypeOnlyImport ? "type " : "";
|
|
17183
|
+
const namespaceImport = `import ${typePrefix}* as ${localName} from '${importSource}';
|
|
17184
|
+
`;
|
|
17185
|
+
const originalSource = node2.source.value;
|
|
17186
|
+
const otherImport = `import ${isTypeOnlyImport ? "type " : ""}{ ${otherSpecifiers.map((s) => {
|
|
17187
|
+
const specifierLocalName = s.local.name;
|
|
17188
|
+
const specifierImportedName = s.imported.type === TSESTree$1.AST_NODE_TYPES.Identifier ? s.imported.name : "";
|
|
17189
|
+
const typeModifier = !isTypeOnlyImport && s.importKind === "type" ? "type " : "";
|
|
17190
|
+
return specifierLocalName === specifierImportedName ? `${typeModifier}${specifierImportedName}` : `${typeModifier}${specifierImportedName} as ${specifierLocalName}`;
|
|
17191
|
+
}).join(", ")} } from '${originalSource}';`;
|
|
17192
|
+
return fixer.replaceText(node2, `${namespaceImport}${otherImport}`);
|
|
17193
|
+
}
|
|
17194
|
+
}
|
|
17195
|
+
});
|
|
17196
|
+
}
|
|
17197
|
+
} };
|
|
17198
|
+
}
|
|
17199
|
+
});
|
|
17200
|
+
} });
|
|
17201
|
+
var require_src = __commonJS2({ "src/index.ts"(exports, module) {
|
|
17202
|
+
init_prefer_zod_namespace();
|
|
17203
|
+
const importZod = {
|
|
17204
|
+
meta: {
|
|
17205
|
+
name: "import-zod",
|
|
17206
|
+
version: "1.0.0"
|
|
17207
|
+
},
|
|
17208
|
+
rules: { "prefer-zod-namespace": prefer_zod_namespace_default },
|
|
17209
|
+
configs: {}
|
|
17210
|
+
};
|
|
17211
|
+
Object.assign(importZod.configs, { recommended: [{
|
|
17212
|
+
plugins: { "import-zod": importZod },
|
|
17213
|
+
rules: { "import-zod/prefer-zod-namespace": "error" }
|
|
17214
|
+
}] });
|
|
17215
|
+
module.exports = importZod;
|
|
17216
|
+
} });
|
|
17217
|
+
var dist_default = require_src();
|
|
17218
|
+
|
|
17087
17219
|
// src/configs/imports.ts
|
|
17088
17220
|
async function imports(options = {}) {
|
|
17089
17221
|
const { stylistic: stylistic2 = true } = options;
|
|
@@ -17140,7 +17272,7 @@ async function javascript(options = {}) {
|
|
|
17140
17272
|
{
|
|
17141
17273
|
name: "storm/javascript/rules",
|
|
17142
17274
|
plugins: {
|
|
17143
|
-
"unused-imports":
|
|
17275
|
+
"unused-imports": default11
|
|
17144
17276
|
},
|
|
17145
17277
|
rules: {
|
|
17146
17278
|
// disallow use of console
|
|
@@ -18448,7 +18580,7 @@ async function node() {
|
|
|
18448
18580
|
{
|
|
18449
18581
|
name: "storm/node/rules",
|
|
18450
18582
|
plugins: {
|
|
18451
|
-
node:
|
|
18583
|
+
node: default5
|
|
18452
18584
|
},
|
|
18453
18585
|
rules: {
|
|
18454
18586
|
"node/handle-callback-err": ["error", "^(err|error)$"],
|
|
@@ -18538,7 +18670,7 @@ async function perfectionist() {
|
|
|
18538
18670
|
{
|
|
18539
18671
|
name: "storm/perfectionist/rules",
|
|
18540
18672
|
plugins: {
|
|
18541
|
-
perfectionist:
|
|
18673
|
+
perfectionist: default8
|
|
18542
18674
|
},
|
|
18543
18675
|
rules: {
|
|
18544
18676
|
"perfectionist/sort-exports": [
|
|
@@ -18605,7 +18737,7 @@ function RuleCreator3(urlCreator) {
|
|
|
18605
18737
|
meta: meta3,
|
|
18606
18738
|
...rule
|
|
18607
18739
|
}) {
|
|
18608
|
-
return
|
|
18740
|
+
return createRule4({
|
|
18609
18741
|
meta: {
|
|
18610
18742
|
...meta3,
|
|
18611
18743
|
docs: {
|
|
@@ -18617,7 +18749,7 @@ function RuleCreator3(urlCreator) {
|
|
|
18617
18749
|
});
|
|
18618
18750
|
};
|
|
18619
18751
|
}
|
|
18620
|
-
function
|
|
18752
|
+
function createRule4({
|
|
18621
18753
|
create,
|
|
18622
18754
|
defaultOptions,
|
|
18623
18755
|
meta: meta3
|
|
@@ -19277,7 +19409,7 @@ plugin3.configs = configs3;
|
|
|
19277
19409
|
|
|
19278
19410
|
// ../eslint-plugin-pnpm/package.json
|
|
19279
19411
|
var package_default2 = {
|
|
19280
|
-
version: "0.0.
|
|
19412
|
+
version: "0.0.22"};
|
|
19281
19413
|
|
|
19282
19414
|
// ../eslint-plugin-pnpm/src/plugin.ts
|
|
19283
19415
|
var plugin4 = {
|
|
@@ -19453,7 +19585,7 @@ async function prettier() {
|
|
|
19453
19585
|
{
|
|
19454
19586
|
name: "storm/prettier",
|
|
19455
19587
|
plugins: {
|
|
19456
|
-
prettier:
|
|
19588
|
+
prettier: default9
|
|
19457
19589
|
},
|
|
19458
19590
|
rules: {
|
|
19459
19591
|
"prettier/prettier": "error",
|
|
@@ -19735,7 +19867,7 @@ async function secrets(options) {
|
|
|
19735
19867
|
name: "storm/secrets/rules",
|
|
19736
19868
|
files: [`**/*.{js,ts,jsx,tsx${json ? ",json,jsonc" : ""}`],
|
|
19737
19869
|
plugins: {
|
|
19738
|
-
"no-secrets":
|
|
19870
|
+
"no-secrets": default7
|
|
19739
19871
|
},
|
|
19740
19872
|
rules: {
|
|
19741
19873
|
"no-secrets/no-secrets": [
|
|
@@ -20039,7 +20171,7 @@ async function test(options = {}) {
|
|
|
20039
20171
|
rules: {
|
|
20040
20172
|
...default4.rules,
|
|
20041
20173
|
// extend `test/no-only-tests` rule
|
|
20042
|
-
...
|
|
20174
|
+
...default6.rules
|
|
20043
20175
|
}
|
|
20044
20176
|
};
|
|
20045
20177
|
return [
|
|
@@ -20435,10 +20567,10 @@ async function unicorn(options = {}) {
|
|
|
20435
20567
|
{
|
|
20436
20568
|
name: "storm/unicorn/rules",
|
|
20437
20569
|
plugins: {
|
|
20438
|
-
unicorn:
|
|
20570
|
+
unicorn: default10
|
|
20439
20571
|
},
|
|
20440
20572
|
rules: {
|
|
20441
|
-
...options.allRecommended ?
|
|
20573
|
+
...options.allRecommended ? default10.configs["recommended"].rules : {
|
|
20442
20574
|
"unicorn/consistent-empty-array-spread": "error",
|
|
20443
20575
|
"unicorn/error-message": "error",
|
|
20444
20576
|
"unicorn/escape-case": "error",
|
|
@@ -20574,7 +20706,7 @@ async function zod(options = {}) {
|
|
|
20574
20706
|
name: "storm/zod/rules",
|
|
20575
20707
|
files: [GLOB_SRC],
|
|
20576
20708
|
plugins: {
|
|
20577
|
-
"import-zod":
|
|
20709
|
+
"import-zod": dist_default
|
|
20578
20710
|
},
|
|
20579
20711
|
rules: {
|
|
20580
20712
|
"import-zod/prefer-zod-namespace": "error"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storm-software/eslint",
|
|
3
|
-
"version": "0.170.
|
|
3
|
+
"version": "0.170.86",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "A package containing the base ESLint configuration used by Storm Software across many projects.",
|
|
6
6
|
"keywords": [
|
|
@@ -141,9 +141,9 @@
|
|
|
141
141
|
"@eslint/eslintrc": "^3.3.5",
|
|
142
142
|
"@eslint/markdown": "^6.6.0",
|
|
143
143
|
"@nx/eslint-plugin": "22.7.5",
|
|
144
|
-
"@storm-software/config": "1.137.91",
|
|
145
|
-
"@storm-software/config-tools": "1.190.59",
|
|
146
|
-
"@storm-software/package-constants": "0.1.72",
|
|
144
|
+
"@storm-software/config": "^1.137.91",
|
|
145
|
+
"@storm-software/config-tools": "^1.190.59",
|
|
146
|
+
"@storm-software/package-constants": "^0.1.72",
|
|
147
147
|
"@stylistic/eslint-plugin": "^4.4.1",
|
|
148
148
|
"@typescript-eslint/eslint-plugin": "^8.61.0",
|
|
149
149
|
"@typescript-eslint/parser": "^8.61.0",
|
|
@@ -196,9 +196,9 @@
|
|
|
196
196
|
"@next/eslint-plugin-next": "^15.5.19",
|
|
197
197
|
"@nx/eslint": "22.7.5",
|
|
198
198
|
"@prettier/plugin-xml": "^3.4.2",
|
|
199
|
-
"@storm-software/eslint-plugin-banner": "0.0.23",
|
|
200
|
-
"@storm-software/eslint-plugin-pnpm": "0.0.22",
|
|
201
|
-
"@storm-software/eslint-plugin-tsdoc": "0.0.22",
|
|
199
|
+
"@storm-software/eslint-plugin-banner": "^0.0.23",
|
|
200
|
+
"@storm-software/eslint-plugin-pnpm": "^0.0.22",
|
|
201
|
+
"@storm-software/eslint-plugin-tsdoc": "^0.0.22",
|
|
202
202
|
"@stylistic/eslint-plugin-migrate": "^4.4.1",
|
|
203
203
|
"@types/eslint": "^9.6.1",
|
|
204
204
|
"@types/eslint__js": "^8.42.3",
|
|
@@ -240,7 +240,6 @@
|
|
|
240
240
|
"eslint": "^10.5.0",
|
|
241
241
|
"eslint-plugin-astro": "^1.2.0",
|
|
242
242
|
"eslint-plugin-format": ">=0.1.0",
|
|
243
|
-
"eslint-plugin-import-zod": "^1.2.0",
|
|
244
243
|
"eslint-plugin-mdx": "^3.8.1",
|
|
245
244
|
"eslint-plugin-react-compiler": "19.1.0-rc.2",
|
|
246
245
|
"eslint-plugin-react-hooks": "^7.1.1",
|
|
@@ -264,7 +263,6 @@
|
|
|
264
263
|
"eslint": { "optional": false },
|
|
265
264
|
"eslint-plugin-astro": { "optional": true },
|
|
266
265
|
"eslint-plugin-format": { "optional": true },
|
|
267
|
-
"eslint-plugin-import-zod": { "optional": true },
|
|
268
266
|
"eslint-plugin-mdx": { "optional": true },
|
|
269
267
|
"eslint-plugin-react-compiler": { "optional": true },
|
|
270
268
|
"eslint-plugin-react-hooks": { "optional": true },
|
|
@@ -277,5 +275,5 @@
|
|
|
277
275
|
"zod": { "optional": true }
|
|
278
276
|
},
|
|
279
277
|
"publishConfig": { "access": "public" },
|
|
280
|
-
"gitHead": "
|
|
278
|
+
"gitHead": "6bbc53a6ddfb9ea7bcaac796ccc4c51882fc5cf7"
|
|
281
279
|
}
|