eslint-plugin-zod-core 1.0.13 → 1.1.0
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 +8 -6
- package/dist/index.cjs +3 -1
- package/dist/index.mjs +3 -1
- package/dist/rules/prefer-validate.cjs +21 -0
- package/dist/rules/prefer-validate.mjs +21 -0
- package/package.json +9 -7
package/README.md
CHANGED
|
@@ -28,12 +28,14 @@ Find out more about [Oxlint's `jsPLugins`](https://oxc.rs/docs/guide/usage/linte
|
|
|
28
28
|
|
|
29
29
|
💼 Configurations enabled in.\
|
|
30
30
|
✅ Set in the `recommended` configuration.\
|
|
31
|
-
🔧 Automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/user-guide/command-line-interface#--fix)
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
|
35
|
-
|
|
|
36
|
-
| [consistent-
|
|
31
|
+
🔧 Automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/user-guide/command-line-interface#--fix).\
|
|
32
|
+
💡 Manually fixable by [editor suggestions](https://eslint.org/docs/latest/use/core-concepts#rule-suggestions).
|
|
33
|
+
|
|
34
|
+
| Name | Description | 💼 | 🔧 | 💡 |
|
|
35
|
+
| :--------------------------------------------------------------------------------------- | :---------------------------------------------------------------------------- | :-- | :-- | :-- |
|
|
36
|
+
| [consistent-import](docs/rules/consistent-import.md) | Enforce a consistent import style for Zod core | ✅ | 🔧 | |
|
|
37
|
+
| [consistent-schema-output-type-style](docs/rules/consistent-schema-output-type-style.md) | Enforce consistent use of core.infer or core.output for schema type inference | | 🔧 | |
|
|
38
|
+
| [prefer-validate](docs/rules/prefer-validate.md) | Prefer boolean validation when only the success of parsing is used | | | 💡 |
|
|
37
39
|
|
|
38
40
|
<!-- end auto-generated rules list -->
|
|
39
41
|
|
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
const require_meta = require("./meta.cjs");
|
|
2
2
|
const require_consistent_import = require("./rules/consistent-import.cjs");
|
|
3
3
|
const require_consistent_schema_output_type_style = require("./rules/consistent-schema-output-type-style.cjs");
|
|
4
|
+
const require_prefer_validate = require("./rules/prefer-validate.cjs");
|
|
4
5
|
//#region src/index.ts
|
|
5
6
|
const eslintPluginZodCore = {
|
|
6
7
|
meta: {
|
|
@@ -9,7 +10,8 @@ const eslintPluginZodCore = {
|
|
|
9
10
|
},
|
|
10
11
|
rules: {
|
|
11
12
|
"consistent-import": require_consistent_import.consistentImport,
|
|
12
|
-
"consistent-schema-output-type-style": require_consistent_schema_output_type_style.consistentSchemaOutputTypeStyle
|
|
13
|
+
"consistent-schema-output-type-style": require_consistent_schema_output_type_style.consistentSchemaOutputTypeStyle,
|
|
14
|
+
"prefer-validate": require_prefer_validate.preferValidate
|
|
13
15
|
}
|
|
14
16
|
};
|
|
15
17
|
const recommendedConfig = {
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { PLUGIN_NAME, PLUGIN_VERSION } from "./meta.mjs";
|
|
2
2
|
import { consistentImport } from "./rules/consistent-import.mjs";
|
|
3
3
|
import { consistentSchemaOutputTypeStyle } from "./rules/consistent-schema-output-type-style.mjs";
|
|
4
|
+
import { preferValidate } from "./rules/prefer-validate.mjs";
|
|
4
5
|
//#region src/index.ts
|
|
5
6
|
const eslintPluginZodCore = {
|
|
6
7
|
meta: {
|
|
@@ -9,7 +10,8 @@ const eslintPluginZodCore = {
|
|
|
9
10
|
},
|
|
10
11
|
rules: {
|
|
11
12
|
"consistent-import": consistentImport,
|
|
12
|
-
"consistent-schema-output-type-style": consistentSchemaOutputTypeStyle
|
|
13
|
+
"consistent-schema-output-type-style": consistentSchemaOutputTypeStyle,
|
|
14
|
+
"prefer-validate": preferValidate
|
|
13
15
|
}
|
|
14
16
|
};
|
|
15
17
|
const recommendedConfig = {
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
const require_create_plugin_rule = require("../utils/create-plugin-rule.cjs");
|
|
2
|
+
let _eslint_zod_utils = require("@eslint-zod/utils");
|
|
3
|
+
let _eslint_zod_utils_rule_builders_prefer_validate = require("@eslint-zod/utils/rule-builders/prefer-validate");
|
|
4
|
+
//#region src/rules/prefer-validate.ts
|
|
5
|
+
const preferValidate = require_create_plugin_rule.createZodPluginRule({
|
|
6
|
+
name: "prefer-validate",
|
|
7
|
+
meta: {
|
|
8
|
+
type: "suggestion",
|
|
9
|
+
hasSuggestions: true,
|
|
10
|
+
docs: { description: "Prefer boolean validation when only the success of parsing is used" },
|
|
11
|
+
messages: {
|
|
12
|
+
preferValidate: "Prefer `{{method}}` when only parse success is used.",
|
|
13
|
+
useValidate: "Replace success-only parsing with `{{method}}`."
|
|
14
|
+
},
|
|
15
|
+
schema: []
|
|
16
|
+
},
|
|
17
|
+
defaultOptions: [],
|
|
18
|
+
create: (0, _eslint_zod_utils_rule_builders_prefer_validate.buildPreferValidateCreate)(_eslint_zod_utils.zodCoreImportScope, "standalone")
|
|
19
|
+
});
|
|
20
|
+
//#endregion
|
|
21
|
+
exports.preferValidate = preferValidate;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { createZodPluginRule } from "../utils/create-plugin-rule.mjs";
|
|
2
|
+
import { zodCoreImportScope } from "@eslint-zod/utils";
|
|
3
|
+
import { buildPreferValidateCreate } from "@eslint-zod/utils/rule-builders/prefer-validate";
|
|
4
|
+
//#region src/rules/prefer-validate.ts
|
|
5
|
+
const preferValidate = createZodPluginRule({
|
|
6
|
+
name: "prefer-validate",
|
|
7
|
+
meta: {
|
|
8
|
+
type: "suggestion",
|
|
9
|
+
hasSuggestions: true,
|
|
10
|
+
docs: { description: "Prefer boolean validation when only the success of parsing is used" },
|
|
11
|
+
messages: {
|
|
12
|
+
preferValidate: "Prefer `{{method}}` when only parse success is used.",
|
|
13
|
+
useValidate: "Replace success-only parsing with `{{method}}`."
|
|
14
|
+
},
|
|
15
|
+
schema: []
|
|
16
|
+
},
|
|
17
|
+
defaultOptions: [],
|
|
18
|
+
create: buildPreferValidateCreate(zodCoreImportScope, "standalone")
|
|
19
|
+
});
|
|
20
|
+
//#endregion
|
|
21
|
+
export { preferValidate };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-zod-core",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "ESLint plugin that adds custom linting rules to enforce best practices when using Zod core",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eslint",
|
|
@@ -38,15 +38,16 @@
|
|
|
38
38
|
"access": "public"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@typescript-eslint/utils": "^8.
|
|
42
|
-
"@eslint-zod/utils": "
|
|
41
|
+
"@typescript-eslint/utils": "^8.70.0",
|
|
42
|
+
"@eslint-zod/utils": "5.0.0"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@
|
|
45
|
+
"@arethetypeswrong/cli": "0.18.5",
|
|
46
|
+
"@typescript-eslint/rule-tester": "8.70.0",
|
|
46
47
|
"dedent": "1.7.2",
|
|
47
|
-
"eslint-doc-generator": "3.7.
|
|
48
|
-
"tsdown": "0.
|
|
49
|
-
"vitest": "
|
|
48
|
+
"eslint-doc-generator": "3.7.1",
|
|
49
|
+
"tsdown": "0.23.0",
|
|
50
|
+
"vitest": "5.0.0",
|
|
50
51
|
"@eslint-zod/tooling": "0.0.0"
|
|
51
52
|
},
|
|
52
53
|
"peerDependencies": {
|
|
@@ -70,6 +71,7 @@
|
|
|
70
71
|
},
|
|
71
72
|
"scripts": {
|
|
72
73
|
"build": "tsdown",
|
|
74
|
+
"lint:publish": "attw --pack .",
|
|
73
75
|
"build:docs": "pnpm run build && eslint-doc-generator",
|
|
74
76
|
"lint:docs": "eslint-doc-generator --check",
|
|
75
77
|
"test": "vitest"
|