immosquare-cleaner 0.1.46 → 0.1.47

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/lib/immosquare-cleaner/version.rb +1 -1
  3. data/linters/rubocop-3.3.4.yml +2 -0
  4. data/linters/rubocop.yml +2 -0
  5. data/node_modules/@eslint/eslintrc/node_modules/ignore/LICENSE-MIT +21 -0
  6. data/node_modules/@eslint/eslintrc/node_modules/ignore/README.md +412 -0
  7. data/node_modules/@eslint/eslintrc/node_modules/ignore/index.d.ts +61 -0
  8. data/node_modules/@eslint/eslintrc/node_modules/ignore/index.js +618 -0
  9. data/node_modules/@eslint/eslintrc/node_modules/ignore/legacy.js +539 -0
  10. data/node_modules/@eslint/eslintrc/node_modules/ignore/package.json +73 -0
  11. data/node_modules/@eslint/js/package.json +1 -1
  12. data/node_modules/@eslint/plugin-kit/LICENSE +201 -0
  13. data/node_modules/@eslint/plugin-kit/README.md +224 -0
  14. data/node_modules/@eslint/plugin-kit/dist/cjs/index.cjs +555 -0
  15. data/node_modules/@eslint/plugin-kit/dist/cjs/index.d.cts +239 -0
  16. data/node_modules/@eslint/plugin-kit/dist/cjs/types.ts +7 -0
  17. data/node_modules/@eslint/plugin-kit/dist/esm/index.d.ts +239 -0
  18. data/node_modules/@eslint/plugin-kit/dist/esm/index.js +551 -0
  19. data/node_modules/@eslint/plugin-kit/dist/esm/types.d.ts +6 -0
  20. data/node_modules/@eslint/plugin-kit/dist/esm/types.ts +7 -0
  21. data/node_modules/@eslint/plugin-kit/package.json +62 -0
  22. data/node_modules/eslint/README.md +2 -2
  23. data/node_modules/eslint/lib/config/config.js +278 -0
  24. data/node_modules/eslint/lib/config/flat-config-array.js +3 -204
  25. data/node_modules/eslint/lib/languages/js/source-code/source-code.js +29 -94
  26. data/node_modules/eslint/lib/linter/apply-disable-directives.js +17 -28
  27. data/node_modules/eslint/lib/linter/file-context.js +134 -0
  28. data/node_modules/eslint/lib/linter/linter.js +37 -42
  29. data/node_modules/eslint/lib/rules/id-length.js +1 -0
  30. data/node_modules/eslint/lib/rules/no-invalid-regexp.js +34 -18
  31. data/node_modules/eslint/lib/rules/require-unicode-regexp.js +95 -14
  32. data/node_modules/eslint/lib/rules/utils/regular-expressions.js +11 -3
  33. data/node_modules/eslint/lib/types/index.d.ts +1635 -0
  34. data/node_modules/eslint/lib/types/rules/best-practices.d.ts +1075 -0
  35. data/node_modules/eslint/lib/types/rules/deprecated.d.ts +294 -0
  36. data/node_modules/eslint/lib/types/rules/ecmascript-6.d.ts +561 -0
  37. data/node_modules/eslint/lib/types/rules/index.d.ts +50 -0
  38. data/node_modules/eslint/lib/types/rules/node-commonjs.d.ts +160 -0
  39. data/node_modules/eslint/lib/types/rules/possible-errors.d.ts +598 -0
  40. data/node_modules/eslint/lib/types/rules/strict-mode.d.ts +38 -0
  41. data/node_modules/eslint/lib/types/rules/stylistic-issues.d.ts +1932 -0
  42. data/node_modules/eslint/lib/types/rules/variables.d.ts +221 -0
  43. data/node_modules/eslint/lib/types/use-at-your-own-risk.d.ts +85 -0
  44. data/node_modules/eslint/package.json +20 -8
  45. data/node_modules/ignore/index.d.ts +1 -1
  46. data/node_modules/ignore/index.js +25 -7
  47. data/node_modules/ignore/legacy.js +34 -14
  48. data/node_modules/ignore/package.json +12 -11
  49. data/node_modules/npm-check-updates/build/index.js +282 -282
  50. data/node_modules/npm-check-updates/build/index.js.map +1 -1
  51. data/node_modules/npm-check-updates/package.json +1 -1
  52. data/package.json +3 -3
  53. metadata +31 -4
  54. data/linters/rubocop-2.7.6.yml +0 -88
  55. data/node_modules/eslint/lib/linter/config-comment-parser.js +0 -169
@@ -0,0 +1,278 @@
1
+ /**
2
+ * @fileoverview The `Config` class
3
+ * @author Nicholas C. Zakas
4
+ */
5
+
6
+ "use strict";
7
+
8
+ //-----------------------------------------------------------------------------
9
+ // Requirements
10
+ //-----------------------------------------------------------------------------
11
+
12
+ const { RuleValidator } = require("./rule-validator");
13
+ const { flatConfigSchema, hasMethod } = require("./flat-config-schema");
14
+ const { ObjectSchema } = require("@eslint/config-array");
15
+
16
+ //-----------------------------------------------------------------------------
17
+ // Helpers
18
+ //-----------------------------------------------------------------------------
19
+
20
+ const ruleValidator = new RuleValidator();
21
+
22
+ const severities = new Map([
23
+ [0, 0],
24
+ [1, 1],
25
+ [2, 2],
26
+ ["off", 0],
27
+ ["warn", 1],
28
+ ["error", 2]
29
+ ]);
30
+
31
+ /**
32
+ * Splits a plugin identifier in the form a/b/c into two parts: a/b and c.
33
+ * @param {string} identifier The identifier to parse.
34
+ * @returns {{objectName: string, pluginName: string}} The parts of the plugin
35
+ * name.
36
+ */
37
+ function splitPluginIdentifier(identifier) {
38
+ const parts = identifier.split("/");
39
+
40
+ return {
41
+ objectName: parts.pop(),
42
+ pluginName: parts.join("/")
43
+ };
44
+ }
45
+
46
+ /**
47
+ * Returns the name of an object in the config by reading its `meta` key.
48
+ * @param {Object} object The object to check.
49
+ * @returns {string?} The name of the object if found or `null` if there
50
+ * is no name.
51
+ */
52
+ function getObjectId(object) {
53
+
54
+ // first check old-style name
55
+ let name = object.name;
56
+
57
+ if (!name) {
58
+
59
+ if (!object.meta) {
60
+ return null;
61
+ }
62
+
63
+ name = object.meta.name;
64
+
65
+ if (!name) {
66
+ return null;
67
+ }
68
+ }
69
+
70
+ // now check for old-style version
71
+ let version = object.version;
72
+
73
+ if (!version) {
74
+ version = object.meta && object.meta.version;
75
+ }
76
+
77
+ // if there's a version then append that
78
+ if (version) {
79
+ return `${name}@${version}`;
80
+ }
81
+
82
+ return name;
83
+ }
84
+
85
+ /**
86
+ * Converts a languageOptions object to a JSON representation.
87
+ * @param {Record<string, any>} languageOptions The options to create a JSON
88
+ * representation of.
89
+ * @param {string} objectKey The key of the object being converted.
90
+ * @returns {Record<string, any>} The JSON representation of the languageOptions.
91
+ * @throws {TypeError} If a function is found in the languageOptions.
92
+ */
93
+ function languageOptionsToJSON(languageOptions, objectKey = "languageOptions") {
94
+
95
+ const result = {};
96
+
97
+ for (const [key, value] of Object.entries(languageOptions)) {
98
+ if (value) {
99
+ if (typeof value === "object") {
100
+ const name = getObjectId(value);
101
+
102
+ if (name && hasMethod(value)) {
103
+ result[key] = name;
104
+ } else {
105
+ result[key] = languageOptionsToJSON(value, key);
106
+ }
107
+ continue;
108
+ }
109
+
110
+ if (typeof value === "function") {
111
+ throw new TypeError(`Cannot serialize key "${key}" in ${objectKey}: Function values are not supported.`);
112
+ }
113
+
114
+ }
115
+
116
+ result[key] = value;
117
+ }
118
+
119
+ return result;
120
+ }
121
+
122
+ /**
123
+ * Normalizes the rules configuration. Ensure that each rule config is
124
+ * an array and that the severity is a number. This function modifies the
125
+ * rulesConfig.
126
+ * @param {Record<string, any>} rulesConfig The rules configuration to normalize.
127
+ * @returns {void}
128
+ */
129
+ function normalizeRulesConfig(rulesConfig) {
130
+
131
+ for (const [ruleId, ruleConfig] of Object.entries(rulesConfig)) {
132
+
133
+ // ensure rule config is an array
134
+ if (!Array.isArray(ruleConfig)) {
135
+ rulesConfig[ruleId] = [ruleConfig];
136
+ }
137
+
138
+ // normalize severity
139
+ rulesConfig[ruleId][0] = severities.get(rulesConfig[ruleId][0]);
140
+ }
141
+
142
+ }
143
+
144
+
145
+ //-----------------------------------------------------------------------------
146
+ // Exports
147
+ //-----------------------------------------------------------------------------
148
+
149
+ /**
150
+ * Represents a normalized configuration object.
151
+ */
152
+ class Config {
153
+
154
+ /**
155
+ * The name to use for the language when serializing to JSON.
156
+ * @type {string|undefined}
157
+ */
158
+ #languageName;
159
+
160
+ /**
161
+ * The name to use for the processor when serializing to JSON.
162
+ * @type {string|undefined}
163
+ */
164
+ #processorName;
165
+
166
+ /**
167
+ * Creates a new instance.
168
+ * @param {Object} config The configuration object.
169
+ */
170
+ constructor(config) {
171
+
172
+ const { plugins, language, languageOptions, processor, ...otherKeys } = config;
173
+
174
+ // Validate config object
175
+ const schema = new ObjectSchema(flatConfigSchema);
176
+
177
+ schema.validate(config);
178
+
179
+ // first, copy all the other keys over
180
+ Object.assign(this, otherKeys);
181
+
182
+ // ensure that a language is specified
183
+ if (!language) {
184
+ throw new TypeError("Key 'language' is required.");
185
+ }
186
+
187
+ // copy the rest over
188
+ this.plugins = plugins;
189
+ this.language = language;
190
+
191
+ if (languageOptions) {
192
+ this.languageOptions = languageOptions;
193
+ }
194
+
195
+ // Check language value
196
+ const { pluginName: languagePluginName, objectName: localLanguageName } = splitPluginIdentifier(language);
197
+
198
+ this.#languageName = language;
199
+
200
+ if (!plugins || !plugins[languagePluginName] || !plugins[languagePluginName].languages || !plugins[languagePluginName].languages[localLanguageName]) {
201
+ throw new TypeError(`Key "language": Could not find "${localLanguageName}" in plugin "${languagePluginName}".`);
202
+ }
203
+
204
+ this.language = plugins[languagePluginName].languages[localLanguageName];
205
+
206
+ // Validate language options
207
+ if (this.languageOptions) {
208
+ try {
209
+ this.language.validateLanguageOptions(this.languageOptions);
210
+ } catch (error) {
211
+ throw new TypeError(`Key "languageOptions": ${error.message}`, { cause: error });
212
+ }
213
+ }
214
+
215
+ // Check processor value
216
+ if (processor) {
217
+ this.processor = processor;
218
+
219
+ if (typeof processor === "string") {
220
+ const { pluginName, objectName: localProcessorName } = splitPluginIdentifier(processor);
221
+
222
+ this.#processorName = processor;
223
+
224
+ if (!plugins || !plugins[pluginName] || !plugins[pluginName].processors || !plugins[pluginName].processors[localProcessorName]) {
225
+ throw new TypeError(`Key "processor": Could not find "${localProcessorName}" in plugin "${pluginName}".`);
226
+ }
227
+
228
+ this.processor = plugins[pluginName].processors[localProcessorName];
229
+ } else if (typeof processor === "object") {
230
+ this.#processorName = getObjectId(processor);
231
+ this.processor = processor;
232
+ } else {
233
+ throw new TypeError("Key 'processor' must be a string or an object.");
234
+ }
235
+ }
236
+
237
+ // Process the rules
238
+ if (this.rules) {
239
+ normalizeRulesConfig(this.rules);
240
+ ruleValidator.validate(this);
241
+ }
242
+ }
243
+
244
+ /**
245
+ * Converts the configuration to a JSON representation.
246
+ * @returns {Record<string, any>} The JSON representation of the configuration.
247
+ * @throws {Error} If the configuration cannot be serialized.
248
+ */
249
+ toJSON() {
250
+
251
+ if (this.processor && !this.#processorName) {
252
+ throw new Error("Could not serialize processor object (missing 'meta' object).");
253
+ }
254
+
255
+ if (!this.#languageName) {
256
+ throw new Error("Could not serialize language object (missing 'meta' object).");
257
+ }
258
+
259
+ return {
260
+ ...this,
261
+ plugins: Object.entries(this.plugins).map(([namespace, plugin]) => {
262
+
263
+ const pluginId = getObjectId(plugin);
264
+
265
+ if (!pluginId) {
266
+ return namespace;
267
+ }
268
+
269
+ return `${namespace}:${pluginId}`;
270
+ }),
271
+ language: this.#languageName,
272
+ languageOptions: languageOptionsToJSON(this.languageOptions),
273
+ processor: this.#processorName
274
+ };
275
+ }
276
+ }
277
+
278
+ module.exports = { Config };
@@ -10,9 +10,9 @@
10
10
  //-----------------------------------------------------------------------------
11
11
 
12
12
  const { ConfigArray, ConfigArraySymbol } = require("@eslint/config-array");
13
- const { flatConfigSchema, hasMethod } = require("./flat-config-schema");
14
- const { RuleValidator } = require("./rule-validator");
13
+ const { flatConfigSchema } = require("./flat-config-schema");
15
14
  const { defaultConfig } = require("./default-config");
15
+ const { Config } = require("./config");
16
16
 
17
17
  //-----------------------------------------------------------------------------
18
18
  // Helpers
@@ -23,62 +23,6 @@ const { defaultConfig } = require("./default-config");
23
23
  */
24
24
  const META_FIELDS = new Set(["name"]);
25
25
 
26
- const ruleValidator = new RuleValidator();
27
-
28
- /**
29
- * Splits a plugin identifier in the form a/b/c into two parts: a/b and c.
30
- * @param {string} identifier The identifier to parse.
31
- * @returns {{objectName: string, pluginName: string}} The parts of the plugin
32
- * name.
33
- */
34
- function splitPluginIdentifier(identifier) {
35
- const parts = identifier.split("/");
36
-
37
- return {
38
- objectName: parts.pop(),
39
- pluginName: parts.join("/")
40
- };
41
- }
42
-
43
- /**
44
- * Returns the name of an object in the config by reading its `meta` key.
45
- * @param {Object} object The object to check.
46
- * @returns {string?} The name of the object if found or `null` if there
47
- * is no name.
48
- */
49
- function getObjectId(object) {
50
-
51
- // first check old-style name
52
- let name = object.name;
53
-
54
- if (!name) {
55
-
56
- if (!object.meta) {
57
- return null;
58
- }
59
-
60
- name = object.meta.name;
61
-
62
- if (!name) {
63
- return null;
64
- }
65
- }
66
-
67
- // now check for old-style version
68
- let version = object.version;
69
-
70
- if (!version) {
71
- version = object.meta && object.meta.version;
72
- }
73
-
74
- // if there's a version then append that
75
- if (version) {
76
- return `${name}@${version}`;
77
- }
78
-
79
- return name;
80
- }
81
-
82
26
  /**
83
27
  * Wraps a config error with details about where the error occurred.
84
28
  * @param {Error} error The original error.
@@ -123,42 +67,6 @@ function wrapConfigErrorWithDetails(error, originalLength, baseLength) {
123
67
  );
124
68
  }
125
69
 
126
- /**
127
- * Converts a languageOptions object to a JSON representation.
128
- * @param {Record<string, any>} languageOptions The options to create a JSON
129
- * representation of.
130
- * @param {string} objectKey The key of the object being converted.
131
- * @returns {Record<string, any>} The JSON representation of the languageOptions.
132
- * @throws {TypeError} If a function is found in the languageOptions.
133
- */
134
- function languageOptionsToJSON(languageOptions, objectKey = "languageOptions") {
135
-
136
- const result = {};
137
-
138
- for (const [key, value] of Object.entries(languageOptions)) {
139
- if (value) {
140
- if (typeof value === "object") {
141
- const name = getObjectId(value);
142
-
143
- if (name && hasMethod(value)) {
144
- result[key] = name;
145
- } else {
146
- result[key] = languageOptionsToJSON(value, key);
147
- }
148
- continue;
149
- }
150
-
151
- if (typeof value === "function") {
152
- throw new TypeError(`Cannot serialize key "${key}" in ${objectKey}: Function values are not supported.`);
153
- }
154
-
155
- }
156
-
157
- result[key] = value;
158
- }
159
-
160
- return result;
161
- }
162
70
 
163
71
  const originalBaseConfig = Symbol("originalBaseConfig");
164
72
  const originalLength = Symbol("originalLength");
@@ -305,116 +213,7 @@ class FlatConfigArray extends ConfigArray {
305
213
  * @throws {TypeError} If the config is invalid.
306
214
  */
307
215
  [ConfigArraySymbol.finalizeConfig](config) {
308
-
309
- const { plugins, language, languageOptions, processor } = config;
310
- let parserName, processorName, languageName;
311
- let invalidParser = false,
312
- invalidProcessor = false,
313
- invalidLanguage = false;
314
-
315
- // Check parser value
316
- if (languageOptions && languageOptions.parser) {
317
- const { parser } = languageOptions;
318
-
319
- if (typeof parser === "object") {
320
- parserName = getObjectId(parser);
321
-
322
- if (!parserName) {
323
- invalidParser = true;
324
- }
325
-
326
- } else {
327
- invalidParser = true;
328
- }
329
- }
330
-
331
- // Check language value
332
- if (language) {
333
- if (typeof language === "string") {
334
- const { pluginName, objectName: localLanguageName } = splitPluginIdentifier(language);
335
-
336
- languageName = language;
337
-
338
- if (!plugins || !plugins[pluginName] || !plugins[pluginName].languages || !plugins[pluginName].languages[localLanguageName]) {
339
- throw new TypeError(`Key "language": Could not find "${localLanguageName}" in plugin "${pluginName}".`);
340
- }
341
-
342
- config.language = plugins[pluginName].languages[localLanguageName];
343
- } else {
344
- invalidLanguage = true;
345
- }
346
-
347
- try {
348
- config.language.validateLanguageOptions(config.languageOptions);
349
- } catch (error) {
350
- throw new TypeError(`Key "languageOptions": ${error.message}`, { cause: error });
351
- }
352
- }
353
-
354
- // Check processor value
355
- if (processor) {
356
- if (typeof processor === "string") {
357
- const { pluginName, objectName: localProcessorName } = splitPluginIdentifier(processor);
358
-
359
- processorName = processor;
360
-
361
- if (!plugins || !plugins[pluginName] || !plugins[pluginName].processors || !plugins[pluginName].processors[localProcessorName]) {
362
- throw new TypeError(`Key "processor": Could not find "${localProcessorName}" in plugin "${pluginName}".`);
363
- }
364
-
365
- config.processor = plugins[pluginName].processors[localProcessorName];
366
- } else if (typeof processor === "object") {
367
- processorName = getObjectId(processor);
368
-
369
- if (!processorName) {
370
- invalidProcessor = true;
371
- }
372
-
373
- } else {
374
- invalidProcessor = true;
375
- }
376
- }
377
-
378
- ruleValidator.validate(config);
379
-
380
- // apply special logic for serialization into JSON
381
- /* eslint-disable object-shorthand -- shorthand would change "this" value */
382
- Object.defineProperty(config, "toJSON", {
383
- value: function() {
384
-
385
- if (invalidParser) {
386
- throw new Error("Could not serialize parser object (missing 'meta' object).");
387
- }
388
-
389
- if (invalidProcessor) {
390
- throw new Error("Could not serialize processor object (missing 'meta' object).");
391
- }
392
-
393
- if (invalidLanguage) {
394
- throw new Error("Caching is not supported when language is an object.");
395
- }
396
-
397
- return {
398
- ...this,
399
- plugins: Object.entries(plugins).map(([namespace, plugin]) => {
400
-
401
- const pluginId = getObjectId(plugin);
402
-
403
- if (!pluginId) {
404
- return namespace;
405
- }
406
-
407
- return `${namespace}:${pluginId}`;
408
- }),
409
- language: languageName,
410
- languageOptions: languageOptionsToJSON(languageOptions),
411
- processor: processorName
412
- };
413
- }
414
- });
415
- /* eslint-enable object-shorthand -- ok to enable now */
416
-
417
- return config;
216
+ return new Config(config);
418
217
  }
419
218
  /* eslint-enable class-methods-use-this -- Desired as instance method */
420
219