neatlint 1.2.3 → 1.2.5
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 +6 -2
- package/dist/main.d.mts +9 -2
- package/dist/main.d.ts +9 -2
- package/dist/main.js +18 -16
- package/dist/main.mjs +18 -16
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
[String]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String
|
|
2
2
|
[Number]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number
|
|
3
3
|
[Boolean]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean
|
|
4
|
-
[Date]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date
|
|
5
4
|
[Object]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object
|
|
6
5
|
[Array]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array
|
|
6
|
+
[Date]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date
|
|
7
7
|
[Buffer]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer
|
|
8
|
-
[Function]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function
|
|
9
8
|
[Promise]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise
|
|
10
9
|
[Void]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Undefined
|
|
10
|
+
[Null]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/null
|
|
11
|
+
[Undefined]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Undefined
|
|
12
|
+
|
|
13
|
+
<!---->
|
|
14
|
+
|
|
11
15
|
[NeatlintOptionsDefault]: ./src/defaults/NeatlintOptions.default.ts
|
|
12
16
|
[ESLintConfig]: ./src/types/ESLintConfig.type.ts
|
|
13
17
|
[NeatlintOptions]: ./src/types/NeatlintOptions.type.ts
|
package/dist/main.d.mts
CHANGED
|
@@ -5,13 +5,20 @@ type ESLintConfig = Linter.Config;
|
|
|
5
5
|
type NeatlintOptions = {
|
|
6
6
|
disabled?: boolean;
|
|
7
7
|
ignores?: ESLintConfig['ignores'];
|
|
8
|
-
|
|
8
|
+
append?: {
|
|
9
|
+
'no-restricted-imports'?: object[];
|
|
10
|
+
'no-restricted-syntax'?: {
|
|
11
|
+
selector: string;
|
|
12
|
+
message: string;
|
|
13
|
+
}[];
|
|
14
|
+
};
|
|
15
|
+
js?: {
|
|
9
16
|
files?: ESLintConfig['files'];
|
|
10
17
|
languageOptions?: ESLintConfig['languageOptions'];
|
|
11
18
|
plugins?: ESLintConfig['plugins'];
|
|
12
19
|
rules?: ESLintConfig['rules'];
|
|
13
20
|
};
|
|
14
|
-
|
|
21
|
+
ts?: {
|
|
15
22
|
files?: ESLintConfig['files'];
|
|
16
23
|
languageOptions?: ESLintConfig['languageOptions'];
|
|
17
24
|
plugins?: ESLintConfig['plugins'];
|
package/dist/main.d.ts
CHANGED
|
@@ -5,13 +5,20 @@ type ESLintConfig = Linter.Config;
|
|
|
5
5
|
type NeatlintOptions = {
|
|
6
6
|
disabled?: boolean;
|
|
7
7
|
ignores?: ESLintConfig['ignores'];
|
|
8
|
-
|
|
8
|
+
append?: {
|
|
9
|
+
'no-restricted-imports'?: object[];
|
|
10
|
+
'no-restricted-syntax'?: {
|
|
11
|
+
selector: string;
|
|
12
|
+
message: string;
|
|
13
|
+
}[];
|
|
14
|
+
};
|
|
15
|
+
js?: {
|
|
9
16
|
files?: ESLintConfig['files'];
|
|
10
17
|
languageOptions?: ESLintConfig['languageOptions'];
|
|
11
18
|
plugins?: ESLintConfig['plugins'];
|
|
12
19
|
rules?: ESLintConfig['rules'];
|
|
13
20
|
};
|
|
14
|
-
|
|
21
|
+
ts?: {
|
|
15
22
|
files?: ESLintConfig['files'];
|
|
16
23
|
languageOptions?: ESLintConfig['languageOptions'];
|
|
17
24
|
plugins?: ESLintConfig['plugins'];
|
package/dist/main.js
CHANGED
|
@@ -40,7 +40,7 @@ var import_lodash = __toESM(require("lodash.merge"));
|
|
|
40
40
|
// src/defaults/NeatlintOptions.default.ts
|
|
41
41
|
var import_typescript_eslint = __toESM(require("typescript-eslint"));
|
|
42
42
|
var import_js = __toESM(require("@eslint/js"));
|
|
43
|
-
var
|
|
43
|
+
var js_rules = {
|
|
44
44
|
configs: {
|
|
45
45
|
...import_js.default.configs.recommended.rules,
|
|
46
46
|
...Object.assign(
|
|
@@ -152,7 +152,7 @@ var javascript_rules = {
|
|
|
152
152
|
eqeqeq: "error"
|
|
153
153
|
}
|
|
154
154
|
};
|
|
155
|
-
var
|
|
155
|
+
var ts_rules = {
|
|
156
156
|
configs: {
|
|
157
157
|
...Object.assign({}, ...import_typescript_eslint.default.configs.strictTypeChecked.map((item) => item.rules ?? {})),
|
|
158
158
|
...Object.assign({}, ...import_typescript_eslint.default.configs.stylisticTypeChecked.map((item) => item.rules ?? {}))
|
|
@@ -169,16 +169,16 @@ var typescript_rules = {
|
|
|
169
169
|
var NeatlintOptionsDefault = {
|
|
170
170
|
disabled: false,
|
|
171
171
|
ignores: ["./dist/**"],
|
|
172
|
-
|
|
172
|
+
js: {
|
|
173
173
|
files: ["**/*.ts", "**/*.tsx", "**/*.mts", "**/*.cts", "**/*.js", "**/*.jsx", "**/*.mjs", "**/*.cjs"],
|
|
174
174
|
languageOptions: {},
|
|
175
175
|
plugins: {},
|
|
176
176
|
rules: {
|
|
177
|
-
...
|
|
178
|
-
...
|
|
177
|
+
...js_rules.configs,
|
|
178
|
+
...js_rules.custom
|
|
179
179
|
}
|
|
180
180
|
},
|
|
181
|
-
|
|
181
|
+
ts: {
|
|
182
182
|
files: ["**/*.ts", "**/*.tsx", "**/*.mts", "**/*.cts"],
|
|
183
183
|
languageOptions: {
|
|
184
184
|
parser: import_typescript_eslint.default.parser,
|
|
@@ -191,8 +191,8 @@ var NeatlintOptionsDefault = {
|
|
|
191
191
|
"@typescript-eslint": import_typescript_eslint.default.plugin
|
|
192
192
|
},
|
|
193
193
|
rules: {
|
|
194
|
-
...
|
|
195
|
-
...
|
|
194
|
+
...ts_rules.configs,
|
|
195
|
+
...ts_rules.custom
|
|
196
196
|
}
|
|
197
197
|
}
|
|
198
198
|
};
|
|
@@ -200,19 +200,21 @@ var NeatlintOptionsDefault = {
|
|
|
200
200
|
// src/utils/Neatlint.util.ts
|
|
201
201
|
var Neatlint = (options = NeatlintOptionsDefault) => {
|
|
202
202
|
options = (0, import_lodash.default)({}, NeatlintOptionsDefault, options);
|
|
203
|
+
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"]];
|
|
204
|
+
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"]];
|
|
203
205
|
return [
|
|
204
206
|
{ ignores: options.ignores },
|
|
205
207
|
{
|
|
206
|
-
files: options.
|
|
207
|
-
languageOptions: options.
|
|
208
|
-
plugins: options.
|
|
209
|
-
rules: options.disabled === true ? {} : options.
|
|
208
|
+
files: options.js?.files,
|
|
209
|
+
languageOptions: options.js?.languageOptions,
|
|
210
|
+
plugins: options.js?.plugins,
|
|
211
|
+
rules: options.disabled === true ? {} : options.js?.rules
|
|
210
212
|
},
|
|
211
213
|
{
|
|
212
|
-
files: options.
|
|
213
|
-
languageOptions: options.
|
|
214
|
-
plugins: options.
|
|
215
|
-
rules: options.disabled === true ? {} : options.
|
|
214
|
+
files: options.ts?.files,
|
|
215
|
+
languageOptions: options.ts?.languageOptions,
|
|
216
|
+
plugins: options.ts?.plugins,
|
|
217
|
+
rules: options.disabled === true ? {} : options.ts?.rules
|
|
216
218
|
},
|
|
217
219
|
...options.config && options.config.length !== 0 ? options.config : []
|
|
218
220
|
];
|
package/dist/main.mjs
CHANGED
|
@@ -4,7 +4,7 @@ import merge from "lodash.merge";
|
|
|
4
4
|
// src/defaults/NeatlintOptions.default.ts
|
|
5
5
|
import TSESLint from "typescript-eslint";
|
|
6
6
|
import ESLintJS from "@eslint/js";
|
|
7
|
-
var
|
|
7
|
+
var js_rules = {
|
|
8
8
|
configs: {
|
|
9
9
|
...ESLintJS.configs.recommended.rules,
|
|
10
10
|
...Object.assign(
|
|
@@ -116,7 +116,7 @@ var javascript_rules = {
|
|
|
116
116
|
eqeqeq: "error"
|
|
117
117
|
}
|
|
118
118
|
};
|
|
119
|
-
var
|
|
119
|
+
var ts_rules = {
|
|
120
120
|
configs: {
|
|
121
121
|
...Object.assign({}, ...TSESLint.configs.strictTypeChecked.map((item) => item.rules ?? {})),
|
|
122
122
|
...Object.assign({}, ...TSESLint.configs.stylisticTypeChecked.map((item) => item.rules ?? {}))
|
|
@@ -133,16 +133,16 @@ var typescript_rules = {
|
|
|
133
133
|
var NeatlintOptionsDefault = {
|
|
134
134
|
disabled: false,
|
|
135
135
|
ignores: ["./dist/**"],
|
|
136
|
-
|
|
136
|
+
js: {
|
|
137
137
|
files: ["**/*.ts", "**/*.tsx", "**/*.mts", "**/*.cts", "**/*.js", "**/*.jsx", "**/*.mjs", "**/*.cjs"],
|
|
138
138
|
languageOptions: {},
|
|
139
139
|
plugins: {},
|
|
140
140
|
rules: {
|
|
141
|
-
...
|
|
142
|
-
...
|
|
141
|
+
...js_rules.configs,
|
|
142
|
+
...js_rules.custom
|
|
143
143
|
}
|
|
144
144
|
},
|
|
145
|
-
|
|
145
|
+
ts: {
|
|
146
146
|
files: ["**/*.ts", "**/*.tsx", "**/*.mts", "**/*.cts"],
|
|
147
147
|
languageOptions: {
|
|
148
148
|
parser: TSESLint.parser,
|
|
@@ -155,8 +155,8 @@ var NeatlintOptionsDefault = {
|
|
|
155
155
|
"@typescript-eslint": TSESLint.plugin
|
|
156
156
|
},
|
|
157
157
|
rules: {
|
|
158
|
-
...
|
|
159
|
-
...
|
|
158
|
+
...ts_rules.configs,
|
|
159
|
+
...ts_rules.custom
|
|
160
160
|
}
|
|
161
161
|
}
|
|
162
162
|
};
|
|
@@ -164,19 +164,21 @@ var NeatlintOptionsDefault = {
|
|
|
164
164
|
// src/utils/Neatlint.util.ts
|
|
165
165
|
var Neatlint = (options = NeatlintOptionsDefault) => {
|
|
166
166
|
options = merge({}, NeatlintOptionsDefault, options);
|
|
167
|
+
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"]];
|
|
168
|
+
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"]];
|
|
167
169
|
return [
|
|
168
170
|
{ ignores: options.ignores },
|
|
169
171
|
{
|
|
170
|
-
files: options.
|
|
171
|
-
languageOptions: options.
|
|
172
|
-
plugins: options.
|
|
173
|
-
rules: options.disabled === true ? {} : options.
|
|
172
|
+
files: options.js?.files,
|
|
173
|
+
languageOptions: options.js?.languageOptions,
|
|
174
|
+
plugins: options.js?.plugins,
|
|
175
|
+
rules: options.disabled === true ? {} : options.js?.rules
|
|
174
176
|
},
|
|
175
177
|
{
|
|
176
|
-
files: options.
|
|
177
|
-
languageOptions: options.
|
|
178
|
-
plugins: options.
|
|
179
|
-
rules: options.disabled === true ? {} : options.
|
|
178
|
+
files: options.ts?.files,
|
|
179
|
+
languageOptions: options.ts?.languageOptions,
|
|
180
|
+
plugins: options.ts?.plugins,
|
|
181
|
+
rules: options.disabled === true ? {} : options.ts?.rules
|
|
180
182
|
},
|
|
181
183
|
...options.config && options.config.length !== 0 ? options.config : []
|
|
182
184
|
];
|