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 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
- javascript?: {
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
- typescript?: {
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
- javascript?: {
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
- typescript?: {
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 javascript_rules = {
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 typescript_rules = {
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
- javascript: {
172
+ js: {
173
173
  files: ["**/*.ts", "**/*.tsx", "**/*.mts", "**/*.cts", "**/*.js", "**/*.jsx", "**/*.mjs", "**/*.cjs"],
174
174
  languageOptions: {},
175
175
  plugins: {},
176
176
  rules: {
177
- ...javascript_rules.configs,
178
- ...javascript_rules.custom
177
+ ...js_rules.configs,
178
+ ...js_rules.custom
179
179
  }
180
180
  },
181
- typescript: {
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
- ...typescript_rules.configs,
195
- ...typescript_rules.custom
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.javascript?.files,
207
- languageOptions: options.javascript?.languageOptions,
208
- plugins: options.javascript?.plugins,
209
- rules: options.disabled === true ? {} : options.javascript?.rules
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.typescript?.files,
213
- languageOptions: options.typescript?.languageOptions,
214
- plugins: options.typescript?.plugins,
215
- rules: options.disabled === true ? {} : options.typescript?.rules
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 javascript_rules = {
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 typescript_rules = {
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
- javascript: {
136
+ js: {
137
137
  files: ["**/*.ts", "**/*.tsx", "**/*.mts", "**/*.cts", "**/*.js", "**/*.jsx", "**/*.mjs", "**/*.cjs"],
138
138
  languageOptions: {},
139
139
  plugins: {},
140
140
  rules: {
141
- ...javascript_rules.configs,
142
- ...javascript_rules.custom
141
+ ...js_rules.configs,
142
+ ...js_rules.custom
143
143
  }
144
144
  },
145
- typescript: {
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
- ...typescript_rules.configs,
159
- ...typescript_rules.custom
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.javascript?.files,
171
- languageOptions: options.javascript?.languageOptions,
172
- plugins: options.javascript?.plugins,
173
- rules: options.disabled === true ? {} : options.javascript?.rules
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.typescript?.files,
177
- languageOptions: options.typescript?.languageOptions,
178
- plugins: options.typescript?.plugins,
179
- rules: options.disabled === true ? {} : options.typescript?.rules
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
  ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "neatlint",
3
- "version": "1.2.3",
3
+ "version": "1.2.5",
4
4
  "description": "Strict ESLint presets for modern TypeScript projects.",
5
5
  "license": "MIT",
6
6
  "homepage": "https://github.com/keift/neatlint",