rulint 1.0.7 → 1.1.1
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 +2 -2
- package/dist/main.d.ts +2 -2
- package/dist/main.js +23 -19
- package/dist/main.mjs +23 -19
- 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
|
@@ -3,7 +3,7 @@ import { Linter } from 'eslint';
|
|
|
3
3
|
type ESLintConfig = Linter.Config;
|
|
4
4
|
|
|
5
5
|
type RulintOptions = {
|
|
6
|
-
|
|
6
|
+
enabled?: boolean;
|
|
7
7
|
ignores?: ESLintConfig['ignores'];
|
|
8
8
|
append?: {
|
|
9
9
|
'no-restricted-imports'?: object[];
|
|
@@ -24,7 +24,7 @@ type RulintOptions = {
|
|
|
24
24
|
plugins?: ESLintConfig['plugins'];
|
|
25
25
|
rules?: ESLintConfig['rules'];
|
|
26
26
|
};
|
|
27
|
-
|
|
27
|
+
configs?: ESLintConfig[];
|
|
28
28
|
};
|
|
29
29
|
|
|
30
30
|
declare const rulint: (options?: RulintOptions) => ESLintConfig[];
|
package/dist/main.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { Linter } from 'eslint';
|
|
|
3
3
|
type ESLintConfig = Linter.Config;
|
|
4
4
|
|
|
5
5
|
type RulintOptions = {
|
|
6
|
-
|
|
6
|
+
enabled?: boolean;
|
|
7
7
|
ignores?: ESLintConfig['ignores'];
|
|
8
8
|
append?: {
|
|
9
9
|
'no-restricted-imports'?: object[];
|
|
@@ -24,7 +24,7 @@ type RulintOptions = {
|
|
|
24
24
|
plugins?: ESLintConfig['plugins'];
|
|
25
25
|
rules?: ESLintConfig['rules'];
|
|
26
26
|
};
|
|
27
|
-
|
|
27
|
+
configs?: ESLintConfig[];
|
|
28
28
|
};
|
|
29
29
|
|
|
30
30
|
declare const rulint: (options?: RulintOptions) => ESLintConfig[];
|
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: {
|
|
@@ -212,22 +213,25 @@ var rulint = (options = RulintOptionsDefault) => {
|
|
|
212
213
|
options = (0, import_lodash.default)({}, RulintOptionsDefault, options);
|
|
213
214
|
if (options.append?.["no-restricted-imports"] && typeof options.js?.rules?.["no-restricted-imports"] === "object") options.js.rules["no-restricted-imports"] = [...options.js.rules["no-restricted-imports"], ...options.append["no-restricted-imports"]];
|
|
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
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
216
|
+
if (options.enabled === true) {
|
|
217
|
+
return [
|
|
218
|
+
{ ignores: options.ignores },
|
|
219
|
+
import_eslint_plugin_zod.default.configs.recommended,
|
|
220
|
+
{
|
|
221
|
+
files: options.js?.files,
|
|
222
|
+
languageOptions: options.js?.languageOptions,
|
|
223
|
+
plugins: options.js?.plugins,
|
|
224
|
+
rules: options.js?.rules
|
|
225
|
+
},
|
|
226
|
+
{
|
|
227
|
+
files: options.ts?.files,
|
|
228
|
+
languageOptions: options.ts?.languageOptions,
|
|
229
|
+
plugins: options.ts?.plugins,
|
|
230
|
+
rules: options.ts?.rules
|
|
231
|
+
},
|
|
232
|
+
...options.configs ?? []
|
|
233
|
+
];
|
|
234
|
+
} else return [{ ignores: options.ignores }, ...options.configs ?? []];
|
|
231
235
|
};
|
|
232
236
|
// Annotate the CommonJS export names for ESM import in node:
|
|
233
237
|
0 && (module.exports = {
|
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: {
|
|
@@ -176,22 +177,25 @@ var rulint = (options = RulintOptionsDefault) => {
|
|
|
176
177
|
options = merge({}, RulintOptionsDefault, options);
|
|
177
178
|
if (options.append?.["no-restricted-imports"] && typeof options.js?.rules?.["no-restricted-imports"] === "object") options.js.rules["no-restricted-imports"] = [...options.js.rules["no-restricted-imports"], ...options.append["no-restricted-imports"]];
|
|
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
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
180
|
+
if (options.enabled === true) {
|
|
181
|
+
return [
|
|
182
|
+
{ ignores: options.ignores },
|
|
183
|
+
EslintPluginZod.configs.recommended,
|
|
184
|
+
{
|
|
185
|
+
files: options.js?.files,
|
|
186
|
+
languageOptions: options.js?.languageOptions,
|
|
187
|
+
plugins: options.js?.plugins,
|
|
188
|
+
rules: options.js?.rules
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
files: options.ts?.files,
|
|
192
|
+
languageOptions: options.ts?.languageOptions,
|
|
193
|
+
plugins: options.ts?.plugins,
|
|
194
|
+
rules: options.ts?.rules
|
|
195
|
+
},
|
|
196
|
+
...options.configs ?? []
|
|
197
|
+
];
|
|
198
|
+
} else return [{ ignores: options.ignores }, ...options.configs ?? []];
|
|
195
199
|
};
|
|
196
200
|
export {
|
|
197
201
|
rulint
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rulint",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.1",
|
|
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",
|