eslint-plugin-zod 3.6.0 → 3.7.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 +58 -2
- package/package.json +9 -1
package/README.md
CHANGED
|
@@ -17,7 +17,10 @@
|
|
|
17
17
|
[issuesBadge]: https://img.shields.io/github/issues/marcalexiei/eslint-plugin-zod.svg?style=for-the-badge
|
|
18
18
|
[issuesURL]: https://github.com/marcalexiei/eslint-plugin-zod/issues
|
|
19
19
|
|
|
20
|
-
[ESLint](https://eslint.org) plugin that adds custom linting rules to enforce best practices when using [Zod](https://github.com/colinhacks/zod)
|
|
20
|
+
[ESLint](https://eslint.org) plugin that adds custom linting rules to enforce best practices when using [Zod](https://github.com/colinhacks/zod).
|
|
21
|
+
|
|
22
|
+
It can also work with [Oxlint](https://oxc.rs/docs/guide/usage/linter.html)!\
|
|
23
|
+
Find out more about [Oxlint's `jsPLugins`](https://oxc.rs/docs/guide/usage/linter/js-plugins.html).
|
|
21
24
|
|
|
22
25
|
## Rules
|
|
23
26
|
|
|
@@ -68,6 +71,8 @@ This plugin is primarily built for `zod`, so some rules are exclusive to `zod` a
|
|
|
68
71
|
|
|
69
72
|
## Installation
|
|
70
73
|
|
|
74
|
+
### ESLint
|
|
75
|
+
|
|
71
76
|
Install `eslint` and `eslint-plugin-zod` using your preferred package manager:
|
|
72
77
|
|
|
73
78
|
```shell
|
|
@@ -82,7 +87,7 @@ yarn add --dev eslint eslint-plugin-zod
|
|
|
82
87
|
pnpm add --save-dev eslint eslint-plugin-zod
|
|
83
88
|
```
|
|
84
89
|
|
|
85
|
-
|
|
90
|
+
#### ESLint Configuration
|
|
86
91
|
|
|
87
92
|
1. Import the plugin
|
|
88
93
|
|
|
@@ -110,6 +115,57 @@ export default defineConfig(
|
|
|
110
115
|
);
|
|
111
116
|
```
|
|
112
117
|
|
|
118
|
+
### Oxlint
|
|
119
|
+
|
|
120
|
+
Install `oxlint` and `eslint-plugin-zod` using your preferred package manager:
|
|
121
|
+
|
|
122
|
+
```shell
|
|
123
|
+
npm i --save-dev oxlint eslint-plugin-zod
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
```shell
|
|
127
|
+
yarn add --dev oxlint eslint-plugin-zod
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
```shell
|
|
131
|
+
pnpm add --save-dev oxlint eslint-plugin-zod
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
#### Oxlint Configuration
|
|
135
|
+
|
|
136
|
+
1. Import the plugin
|
|
137
|
+
|
|
138
|
+
```ts
|
|
139
|
+
import eslintPluginZod from 'eslint-plugin-zod';
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
2. Add `eslint-plugin-zod` to the `jsPlugins` key
|
|
143
|
+
|
|
144
|
+
```ts
|
|
145
|
+
{
|
|
146
|
+
jsPlugins: ['eslint-plugin-zod'],
|
|
147
|
+
// ...
|
|
148
|
+
}
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
3. Add `eslintPluginZod.configs.recommended.rules` to your Oxlint config.\
|
|
152
|
+
Alternatively you can specify the rules manually
|
|
153
|
+
|
|
154
|
+
Here’s a minimal example using the flat config format:
|
|
155
|
+
|
|
156
|
+
```ts
|
|
157
|
+
// oxlint.config.ts
|
|
158
|
+
import eslintPluginZod from 'eslint-plugin-zod';
|
|
159
|
+
import { defineConfig } from 'oxlint';
|
|
160
|
+
|
|
161
|
+
export default defineConfig({
|
|
162
|
+
jsPlugins: ['eslint-plugin-zod'],
|
|
163
|
+
rules: {
|
|
164
|
+
...eslintPluginZod.configs.recommended.rules,
|
|
165
|
+
},
|
|
166
|
+
});
|
|
167
|
+
```
|
|
168
|
+
|
|
113
169
|
## Zod peer dependency version
|
|
114
170
|
|
|
115
171
|
`eslint-plugin-zod` is designed for projects that use `zod@^4`.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-zod",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.7.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "ESLint plugin that adds custom linting rules to enforce best practices when using Zod",
|
|
6
6
|
"engines": {
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
"eslint",
|
|
28
28
|
"eslintplugin",
|
|
29
29
|
"eslint-plugin",
|
|
30
|
+
"oxlint",
|
|
30
31
|
"zod"
|
|
31
32
|
],
|
|
32
33
|
"files": [
|
|
@@ -45,9 +46,16 @@
|
|
|
45
46
|
},
|
|
46
47
|
"peerDependencies": {
|
|
47
48
|
"eslint": "^9 || ^10",
|
|
49
|
+
"oxlint": "^1.59.0",
|
|
48
50
|
"zod": "^4"
|
|
49
51
|
},
|
|
50
52
|
"peerDependenciesMeta": {
|
|
53
|
+
"eslint": {
|
|
54
|
+
"optional": true
|
|
55
|
+
},
|
|
56
|
+
"oxlint": {
|
|
57
|
+
"optional": true
|
|
58
|
+
},
|
|
51
59
|
"zod": {
|
|
52
60
|
"optional": true
|
|
53
61
|
}
|