rulint 1.0.7 → 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 +2 -1
- package/dist/main.d.mts +1 -1
- package/dist/main.d.ts +1 -1
- package/dist/main.js +7 -5
- package/dist/main.mjs +7 -5
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -55,6 +55,7 @@ Strict ESLint presets for modern TypeScript projects.
|
|
|
55
55
|
- Enforces type safety
|
|
56
56
|
- Prohibits potentially unsafe patterns
|
|
57
57
|
- Encourages modern syntax
|
|
58
|
+
- Encourages more accurate [Zod](https://npmjs.com/package/zod) ([eslint-plugin-zod](https://npmjs.com/package/eslint-plugin-zod))
|
|
58
59
|
- Encourages the use of arrow functions
|
|
59
60
|
- Encourages the use of try/catch
|
|
60
61
|
- Bans `var` and warns about proper use of `const` and `let`
|
|
@@ -68,7 +69,7 @@ You can install it as follows.
|
|
|
68
69
|
|
|
69
70
|
> **ⓘ Note**
|
|
70
71
|
>
|
|
71
|
-
> During installation, these packages are installed automatically: `@eslint/js`, `@types/node`, `eslint`, `jiti`, `typescript`, and `typescript-eslint`.
|
|
72
|
+
> During installation, these packages are installed automatically: `@eslint/js`, `@types/node`, `eslint`, `eslint-plugin-zod`, `jiti`, `typescript`, and `typescript-eslint`.
|
|
72
73
|
>
|
|
73
74
|
> Therefore, you do not need to install these packages separately. If they are already listed in your project's dependencies, keeping them is unnecessary and they can be safely removed.
|
|
74
75
|
|
package/dist/main.d.mts
CHANGED
package/dist/main.d.ts
CHANGED
package/dist/main.js
CHANGED
|
@@ -35,6 +35,7 @@ __export(main_exports, {
|
|
|
35
35
|
module.exports = __toCommonJS(main_exports);
|
|
36
36
|
|
|
37
37
|
// src/utils/Rulint.util.ts
|
|
38
|
+
var import_eslint_plugin_zod = __toESM(require("eslint-plugin-zod"));
|
|
38
39
|
var import_lodash = __toESM(require("lodash.merge"));
|
|
39
40
|
|
|
40
41
|
// src/defaults/RulintOptions.default.ts
|
|
@@ -177,10 +178,10 @@ var ts_rules = {
|
|
|
177
178
|
}
|
|
178
179
|
};
|
|
179
180
|
var RulintOptionsDefault = {
|
|
180
|
-
|
|
181
|
+
enabled: true,
|
|
181
182
|
ignores: ["**/dist"],
|
|
182
183
|
js: {
|
|
183
|
-
files: ["**/*.ts", "**/*.tsx", "**/*.mts", "**/*.cts", "**/*.js", "**/*.jsx", "**/*.mjs", "**/*.cjs"],
|
|
184
|
+
files: ["**/*.ts", "**/*.tsx", "**/*.mts", "**/*.mtsx", "**/*.cts", "**/*.ctsx", "**/*.js", "**/*.jsx", "**/*.mjs", "**/*.mjsx", "**/*.cjs", "**/*.cjsx"],
|
|
184
185
|
languageOptions: {},
|
|
185
186
|
plugins: {},
|
|
186
187
|
rules: {
|
|
@@ -189,7 +190,7 @@ var RulintOptionsDefault = {
|
|
|
189
190
|
}
|
|
190
191
|
},
|
|
191
192
|
ts: {
|
|
192
|
-
files: ["**/*.ts", "**/*.tsx", "**/*.mts", "**/*.cts"],
|
|
193
|
+
files: ["**/*.ts", "**/*.tsx", "**/*.mts", "**/*.mtsx", "**/*.cts", "**/*.ctsx"],
|
|
193
194
|
languageOptions: {
|
|
194
195
|
parser: import_typescript_eslint.default.parser,
|
|
195
196
|
parserOptions: {
|
|
@@ -214,17 +215,18 @@ var rulint = (options = RulintOptionsDefault) => {
|
|
|
214
215
|
if (options.append?.["no-restricted-syntax"] && typeof options.js?.rules?.["no-restricted-syntax"] === "object") options.js.rules["no-restricted-syntax"] = [...options.js.rules["no-restricted-syntax"], ...options.append["no-restricted-syntax"]];
|
|
215
216
|
return [
|
|
216
217
|
{ ignores: options.ignores },
|
|
218
|
+
import_eslint_plugin_zod.default.configs.recommended,
|
|
217
219
|
{
|
|
218
220
|
files: options.js?.files,
|
|
219
221
|
languageOptions: options.js?.languageOptions,
|
|
220
222
|
plugins: options.js?.plugins,
|
|
221
|
-
rules: options.
|
|
223
|
+
rules: options.enabled === true ? options.js?.rules : {}
|
|
222
224
|
},
|
|
223
225
|
{
|
|
224
226
|
files: options.ts?.files,
|
|
225
227
|
languageOptions: options.ts?.languageOptions,
|
|
226
228
|
plugins: options.ts?.plugins,
|
|
227
|
-
rules: options.
|
|
229
|
+
rules: options.enabled === true ? options.ts?.rules : {}
|
|
228
230
|
},
|
|
229
231
|
...options.config && options.config.length !== 0 ? options.config : []
|
|
230
232
|
];
|
package/dist/main.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
// src/utils/Rulint.util.ts
|
|
2
|
+
import EslintPluginZod from "eslint-plugin-zod";
|
|
2
3
|
import merge from "lodash.merge";
|
|
3
4
|
|
|
4
5
|
// src/defaults/RulintOptions.default.ts
|
|
@@ -141,10 +142,10 @@ var ts_rules = {
|
|
|
141
142
|
}
|
|
142
143
|
};
|
|
143
144
|
var RulintOptionsDefault = {
|
|
144
|
-
|
|
145
|
+
enabled: true,
|
|
145
146
|
ignores: ["**/dist"],
|
|
146
147
|
js: {
|
|
147
|
-
files: ["**/*.ts", "**/*.tsx", "**/*.mts", "**/*.cts", "**/*.js", "**/*.jsx", "**/*.mjs", "**/*.cjs"],
|
|
148
|
+
files: ["**/*.ts", "**/*.tsx", "**/*.mts", "**/*.mtsx", "**/*.cts", "**/*.ctsx", "**/*.js", "**/*.jsx", "**/*.mjs", "**/*.mjsx", "**/*.cjs", "**/*.cjsx"],
|
|
148
149
|
languageOptions: {},
|
|
149
150
|
plugins: {},
|
|
150
151
|
rules: {
|
|
@@ -153,7 +154,7 @@ var RulintOptionsDefault = {
|
|
|
153
154
|
}
|
|
154
155
|
},
|
|
155
156
|
ts: {
|
|
156
|
-
files: ["**/*.ts", "**/*.tsx", "**/*.mts", "**/*.cts"],
|
|
157
|
+
files: ["**/*.ts", "**/*.tsx", "**/*.mts", "**/*.mtsx", "**/*.cts", "**/*.ctsx"],
|
|
157
158
|
languageOptions: {
|
|
158
159
|
parser: TSESLint.parser,
|
|
159
160
|
parserOptions: {
|
|
@@ -178,17 +179,18 @@ var rulint = (options = RulintOptionsDefault) => {
|
|
|
178
179
|
if (options.append?.["no-restricted-syntax"] && typeof options.js?.rules?.["no-restricted-syntax"] === "object") options.js.rules["no-restricted-syntax"] = [...options.js.rules["no-restricted-syntax"], ...options.append["no-restricted-syntax"]];
|
|
179
180
|
return [
|
|
180
181
|
{ ignores: options.ignores },
|
|
182
|
+
EslintPluginZod.configs.recommended,
|
|
181
183
|
{
|
|
182
184
|
files: options.js?.files,
|
|
183
185
|
languageOptions: options.js?.languageOptions,
|
|
184
186
|
plugins: options.js?.plugins,
|
|
185
|
-
rules: options.
|
|
187
|
+
rules: options.enabled === true ? options.js?.rules : {}
|
|
186
188
|
},
|
|
187
189
|
{
|
|
188
190
|
files: options.ts?.files,
|
|
189
191
|
languageOptions: options.ts?.languageOptions,
|
|
190
192
|
plugins: options.ts?.plugins,
|
|
191
|
-
rules: options.
|
|
193
|
+
rules: options.enabled === true ? options.ts?.rules : {}
|
|
192
194
|
},
|
|
193
195
|
...options.config && options.config.length !== 0 ? options.config : []
|
|
194
196
|
];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rulint",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "Strict ESLint presets for modern TypeScript projects.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://github.com/keift/rulint",
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
"@types/lodash.merge": "^4.6.9",
|
|
20
20
|
"@types/node": "latest",
|
|
21
21
|
"eslint": "latest",
|
|
22
|
+
"eslint-plugin-zod": "latest",
|
|
22
23
|
"jiti": "latest",
|
|
23
24
|
"lodash.merge": "^4.6.2",
|
|
24
25
|
"typescript": "latest",
|