immosquare-cleaner 0.1.43 → 0.1.44

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/lib/immosquare-cleaner/version.rb +1 -1
  3. data/node_modules/@eslint/js/package.json +1 -1
  4. data/node_modules/eslint/README.md +1 -1
  5. data/node_modules/eslint/lib/cli.js +4 -3
  6. data/node_modules/eslint/lib/eslint/eslint.js +93 -17
  7. data/node_modules/eslint/lib/languages/js/source-code/source-code.js +1 -1
  8. data/node_modules/eslint/lib/rules/require-await.js +37 -3
  9. data/node_modules/eslint/lib/rules/utils/ast-utils.js +4 -3
  10. data/node_modules/eslint/lib/shared/flags.js +2 -1
  11. data/node_modules/eslint/package.json +17 -8
  12. data/node_modules/jscodeshift/CHANGELOG.md +17 -0
  13. data/node_modules/jscodeshift/CONTRIBUTING.md +7 -6
  14. data/node_modules/jscodeshift/README.md +3 -2
  15. data/node_modules/jscodeshift/dist/Runner.js +15 -15
  16. data/node_modules/jscodeshift/dist/collections/ImportDeclaration.js +113 -0
  17. data/node_modules/jscodeshift/dist/collections/index.js +1 -0
  18. data/node_modules/jscodeshift/dist/src/Runner.js +15 -15
  19. data/node_modules/jscodeshift/dist/src/collections/ImportDeclaration.js +113 -0
  20. data/node_modules/jscodeshift/dist/src/collections/index.js +1 -0
  21. data/node_modules/jscodeshift/package.json +9 -7
  22. data/node_modules/jscodeshift/parser/tsOptions.js +2 -0
  23. data/node_modules/jscodeshift/src/Runner.js +15 -15
  24. data/node_modules/jscodeshift/src/collections/ImportDeclaration.js +113 -0
  25. data/node_modules/jscodeshift/src/collections/index.js +1 -0
  26. data/node_modules/jscodeshift/utils/testUtils.js +1 -2
  27. data/node_modules/jscodeshift/website/README.md +44 -0
  28. data/node_modules/jscodeshift/website/astro.config.mjs +36 -0
  29. data/node_modules/jscodeshift/website/package.json +17 -0
  30. data/node_modules/jscodeshift/website/public/favicon.svg +1 -0
  31. data/node_modules/jscodeshift/website/src/assets/houston.webp +0 -0
  32. data/node_modules/jscodeshift/website/src/content/config.ts +6 -0
  33. data/node_modules/jscodeshift/website/src/content/docs/build/api-reference.mdx +406 -0
  34. data/node_modules/jscodeshift/website/src/content/docs/build/ast-grammar.mdx +3086 -0
  35. data/node_modules/jscodeshift/website/src/content/docs/index.mdx +15 -0
  36. data/node_modules/jscodeshift/website/src/content/docs/overview/introduction.mdx +45 -0
  37. data/node_modules/jscodeshift/website/src/content/docs/run/cli.mdx +161 -0
  38. data/node_modules/jscodeshift/website/src/env.d.ts +2 -0
  39. data/node_modules/jscodeshift/website/tsconfig.json +3 -0
  40. data/node_modules/npm-check-updates/README.md +34 -21
  41. data/node_modules/npm-check-updates/build/index.js +136 -136
  42. data/node_modules/npm-check-updates/build/index.js.map +1 -1
  43. data/node_modules/npm-check-updates/package.json +1 -1
  44. data/package.json +4 -4
  45. metadata +18 -10
  46. data/node_modules/jscodeshift/node_modules/chalk/index.d.ts +0 -415
  47. data/node_modules/jscodeshift/node_modules/chalk/license +0 -9
  48. data/node_modules/jscodeshift/node_modules/chalk/package.json +0 -68
  49. data/node_modules/jscodeshift/node_modules/chalk/readme.md +0 -341
  50. data/node_modules/jscodeshift/node_modules/chalk/source/index.js +0 -229
  51. data/node_modules/jscodeshift/node_modules/chalk/source/templates.js +0 -134
  52. data/node_modules/jscodeshift/node_modules/chalk/source/util.js +0 -39
  53. data/node_modules/jscodeshift/website/index.htm +0 -9
@@ -0,0 +1,36 @@
1
+ import {defineConfig} from 'astro/config';
2
+ import starlight from '@astrojs/starlight';
3
+
4
+ // https://astro.build/config
5
+ export default defineConfig({
6
+ integrations: [
7
+ starlight({
8
+ title: 'jscodeshift',
9
+ social: {
10
+ github: 'https://github.com/facebook/jscodeshift',
11
+ },
12
+ sidebar: [
13
+ {
14
+ label: 'Overview',
15
+ items: [
16
+ // Each item here is one entry in the navigation menu.
17
+ {label: 'Introduction', link: '/overview/introduction/'},
18
+ ],
19
+ },
20
+ {
21
+ label: 'Building',
22
+ items: [
23
+ {label: 'API Reference', link: '/build/api-reference/'},
24
+ {label: 'AST Grammar', link: '/build/ast-grammar/'},
25
+ ],
26
+ },
27
+ {
28
+ label: 'Running',
29
+ items: [
30
+ {label: 'CLI', link: '/run/cli/'},
31
+ ],
32
+ },
33
+ ],
34
+ }),
35
+ ],
36
+ });
@@ -0,0 +1,17 @@
1
+ {
2
+ "name": "docs",
3
+ "type": "module",
4
+ "version": "0.0.1",
5
+ "scripts": {
6
+ "dev": "astro dev",
7
+ "start": "astro dev",
8
+ "build": "astro build",
9
+ "preview": "astro preview",
10
+ "astro": "astro"
11
+ },
12
+ "dependencies": {
13
+ "@astrojs/starlight": "^0.24.4",
14
+ "astro": "^4.10.2",
15
+ "sharp": "^0.32.5"
16
+ }
17
+ }
@@ -0,0 +1 @@
1
+ <svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 287.56 191"><defs><style>.cls-1{fill:#0081fb;}.cls-2{fill:url(#linear-gradient);}.cls-3{fill:url(#linear-gradient-2);}</style><linearGradient id="linear-gradient" x1="62.34" y1="101.45" x2="260.34" y2="91.45" gradientTransform="matrix(1, 0, 0, -1, 0, 192)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#0064e1"/><stop offset="0.4" stop-color="#0064e1"/><stop offset="0.83" stop-color="#0073ee"/><stop offset="1" stop-color="#0082fb"/></linearGradient><linearGradient id="linear-gradient-2" x1="41.42" y1="53" x2="41.42" y2="126" gradientTransform="matrix(1, 0, 0, -1, 0, 192)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#0082fb"/><stop offset="1" stop-color="#0064e0"/></linearGradient></defs><title>facebook-meta</title><path class="cls-1" d="M31.06,126c0,11,2.41,19.41,5.56,24.51A19,19,0,0,0,53.19,160c8.1,0,15.51-2,29.79-21.76,11.44-15.83,24.92-38,34-52l15.36-23.6c10.67-16.39,23-34.61,37.18-47C181.07,5.6,193.54,0,206.09,0c21.07,0,41.14,12.21,56.5,35.11,16.81,25.08,25,56.67,25,89.27,0,19.38-3.82,33.62-10.32,44.87C271,180.13,258.72,191,238.13,191V160c17.63,0,22-16.2,22-34.74,0-26.42-6.16-55.74-19.73-76.69-9.63-14.86-22.11-23.94-35.84-23.94-14.85,0-26.8,11.2-40.23,31.17-7.14,10.61-14.47,23.54-22.7,38.13l-9.06,16c-18.2,32.27-22.81,39.62-31.91,51.75C84.74,183,71.12,191,53.19,191c-21.27,0-34.72-9.21-43-23.09C3.34,156.6,0,141.76,0,124.85Z"/><path class="cls-2" d="M24.49,37.3C38.73,15.35,59.28,0,82.85,0c13.65,0,27.22,4,41.39,15.61,15.5,12.65,32,33.48,52.63,67.81l7.39,12.32c17.84,29.72,28,45,33.93,52.22,7.64,9.26,13,12,19.94,12,17.63,0,22-16.2,22-34.74l27.4-.86c0,19.38-3.82,33.62-10.32,44.87C271,180.13,258.72,191,238.13,191c-12.8,0-24.14-2.78-36.68-14.61-9.64-9.08-20.91-25.21-29.58-39.71L146.08,93.6c-12.94-21.62-24.81-37.74-31.68-45C107,40.71,97.51,31.23,82.35,31.23c-12.27,0-22.69,8.61-31.41,21.78Z"/><path class="cls-3" d="M82.35,31.23c-12.27,0-22.69,8.61-31.41,21.78C38.61,71.62,31.06,99.34,31.06,126c0,11,2.41,19.41,5.56,24.51L10.14,167.91C3.34,156.6,0,141.76,0,124.85,0,94.1,8.44,62.05,24.49,37.3,38.73,15.35,59.28,0,82.85,0Z"/></svg>
@@ -0,0 +1,6 @@
1
+ import {defineCollection} from 'astro:content';
2
+ import {docsSchema} from '@astrojs/starlight/schema';
3
+
4
+ export const collections = {
5
+ docs: defineCollection({schema: docsSchema()}),
6
+ };
@@ -0,0 +1,406 @@
1
+ ---
2
+ title: API Reference
3
+ ---
4
+
5
+ import {Steps, LinkCard, Card, CardGrid} from '@astrojs/starlight/components';
6
+
7
+ `jscodeshift` has around 25 APIs to help developers easily detect and transform any JS/TS code.
8
+
9
+ Generally, creating a codemod involves two main tasks: **detection** and **transformation**.
10
+
11
+ <Steps>
12
+ 1. **Detection**
13
+
14
+ Detecting a specific pattern in a large codebase can be expensive, so this task is often divided into two passes.
15
+
16
+ <Steps>
17
+ 1. **First pass**
18
+
19
+ In the first pass, we perform an initial scope reduction of the AST nodes to significantly reduce the search space and produce a collection of AST nodes to process.
20
+ 2. **Second pass**
21
+
22
+ In the second pass, we process and filter the nodes collection to pinpoint the specific AST nodes that need transformation.
23
+ </Steps>
24
+
25
+ 2. **Transformation**
26
+
27
+ Once we detect the desired nodes, we transform the AST and produce the modified code.
28
+ </Steps>
29
+
30
+ For jscodeshift, we have a set of APIs for each part of the codemod process (initial traversal, filtering, transformation), as detailed below. jscodeshift accepts `—parser` as argument. We can select from the list of parser that are currently supported, all those parsers should be compatible with `estree` spec and have same AST grammar. It's important to know the AST grammar for describing the nodes in the codemod.
31
+
32
+ Refer to the [`jscodeshift` node types](/build/ast-grammar/).
33
+
34
+ ## Building jscodeshift codemods
35
+
36
+ <CardGrid>
37
+ <LinkCard title="Core API" href="#core-api"/>
38
+ <LinkCard title="Node Traversal APIs" href="#node-traversal-apis"/>
39
+ <LinkCard title="Node Transformation APIs" href="#node-transformation-apis"/>
40
+ </CardGrid>
41
+
42
+ ## Core API
43
+
44
+ ### **`jscodeshift`**
45
+
46
+ The main function that returns the jscodeshift instance.
47
+
48
+ **Parameters**: `source` (String): The source code to be transformed.
49
+
50
+ **Example**:
51
+
52
+ ```jsx
53
+ const jscodeshift = require('jscodeshift');
54
+ const sourceCode = `const a = 1;`;
55
+ const j = jscodeshift(sourceCode);
56
+ ```
57
+
58
+ ## Node Traversal APIs
59
+
60
+ Below are APIs that often used in the **initial scope reduction** phase ([source](https://github.com/facebook/jscodeshift/blob/4851fc8a01036868efb4cf9676f3e97836097376/src/collections/Node.js#L139)). The input is usually the whole file, and the output is a collection of nodes.
61
+
62
+ ### **`find`**
63
+
64
+ Finds nodes that match the provided type.
65
+
66
+ **Parameters**: `type` (String or Function): The type of nodes to find.
67
+
68
+ **Example**:
69
+
70
+ ```jsx
71
+ const variableDeclarations = j.find(j.VariableDeclaration);
72
+ ```
73
+
74
+ ### **`closestScope`**
75
+
76
+ Finds the closest enclosing scope of a node. Useful for determining the scope context of variables and functions.
77
+
78
+ **Example**:
79
+
80
+ ```jsx
81
+ const closestScopes = j.find(j.Identifier).closestScope();
82
+ ```
83
+
84
+ ### **`closest`**
85
+
86
+ Finds the nearest parent node that matches the specified type. The child node must be obtained from a previous function call, such as find.
87
+
88
+ **Parameters**:`type` (String or Function): The type of ancestor to find.
89
+
90
+ ```jsx
91
+ const closestFunction = j.find(j.Identifier).closest(j.FunctionDeclaration);
92
+ ```
93
+
94
+ ### **`getVariableDeclarators`**
95
+
96
+ Retrieves variable declarators from the current collection. If the callback function returns a falsy value, the element is not included in the result.
97
+
98
+ **Parameters**:`callback` (Function): A function that returns the name of the variable to find.
99
+
100
+ **Example**:
101
+
102
+ ```jsx
103
+ const variableDeclarators = j.find(j.Identifier).getVariableDeclarators(path => path.value.name);
104
+ ```
105
+
106
+ ### **`findVariableDeclarators` ([source](https://github.com/facebook/jscodeshift/blob/main/src/collections/VariableDeclarator.js))**
107
+
108
+ Finds variable declarators by name.
109
+
110
+ **Parameters**: `name` (String): The name of the variable to find.
111
+
112
+ **Example**:
113
+
114
+ ```jsx
115
+ const variableDeclarators = j.findVariableDeclarators('a');
116
+ ```
117
+
118
+ Below are the APIs that are often used in the second phase, which is the **detailed node filtering** ([source](https://github.com/facebook/jscodeshift/blob/4851fc8a01036868efb4cf9676f3e97836097376/src/Collection.js)). The input of this phase is usually a collection of nodes, and the output, is specific nodes to transform.
119
+
120
+ ### **`filter`**
121
+
122
+ Filters nodes based on a predicate function.
123
+
124
+ **Parameters**: `predicate` (Function): A function to test each element.
125
+
126
+ **Example**:
127
+
128
+ ```jsx
129
+ const constDeclarations = j.find(j.VariableDeclaration)
130
+ .filter(path => path.node.kind === 'const');
131
+ ```
132
+
133
+ ### **`forEach`**
134
+
135
+ Iterates over each node in the collection.
136
+
137
+ **Parameters**: `callback` (Function): A function to call for each node.
138
+
139
+ **Example**:
140
+
141
+ ```jsx
142
+ j.find(j.VariableDeclaration).forEach(path => {
143
+ console.log(path.node);
144
+ });
145
+ ```
146
+
147
+ ### `some`
148
+
149
+ `some` checks if at least one element in the collection passes the test implemented by the provided function.
150
+
151
+ **Parameters:** `callback`: A function that tests each element. The callback function takes three arguments:
152
+
153
+ - `path`: The current element being processed.
154
+ - `index`: The index of the current element.
155
+ - `array`: The array `some` was called upon.
156
+
157
+ **Example:**
158
+
159
+ ```jsx
160
+ const j = require('jscodeshift');
161
+
162
+ const root = j(`const a = 1; const b = 2; const c = 3;`);
163
+
164
+ const hasVariableA = root.find(j.VariableDeclarator).some(path => path.node.id.name === 'a');
165
+ console.log(hasVariableA); // true
166
+
167
+ ```
168
+
169
+ ### `every`
170
+
171
+ `every` checks if all elements in the collection pass the test implemented by the provided function.
172
+
173
+ **Parameters:** `callback`: A function that tests each element. The callback function takes three arguments:
174
+
175
+ - `path`: The current element being processed.
176
+ - `index`: The index of the current element.
177
+ - `array`: The array `every` was called upon.
178
+
179
+ **Example:**
180
+
181
+ ```jsx
182
+ const j = require('jscodeshift');
183
+
184
+ const root = j(`const a = 1; const b = 2; const c = 3;`);
185
+
186
+ const allAreConst = root.find(j.VariableDeclaration).every(path => path.node.kind === 'const');
187
+ console.log(allAreConst); // true
188
+
189
+ ```
190
+
191
+ ### **`map`**
192
+
193
+ Maps each node in the collection to a new value.
194
+
195
+ **Parameters**:`callback` (Function): A function to call for each node.
196
+
197
+ **Example**:
198
+
199
+ ```jsx
200
+ const variableNames = j.find(j.VariableDeclaration)
201
+ .map(path => path.node.declarations.map(decl => decl.id.name));
202
+ ```
203
+
204
+ ### **`size`**
205
+
206
+ Returns the number of nodes in the collection.
207
+
208
+ **Example**:
209
+
210
+ ```jsx
211
+ const numberOfNodes = j.find(j.VariableDeclaration).size();
212
+ ```
213
+
214
+ ### `length`
215
+
216
+ `length` returns the number of elements in the collection.
217
+
218
+ **Example:**
219
+
220
+ ```jsx
221
+ const j = require('jscodeshift');
222
+
223
+ const root = j(`const a = 1; const b = 2; const c = 3;`);
224
+
225
+ const varCount = root.find(j.VariableDeclarator).length;
226
+ console.log(varCount); // 3
227
+
228
+ ```
229
+
230
+ ### **`nodes`**
231
+
232
+ Returns the AST nodes in the collection.
233
+
234
+ **Example**:
235
+
236
+ ```jsx
237
+ const nodes = j.find(j.VariableDeclaration).nodes();
238
+ ```
239
+
240
+ ### **`paths`**
241
+
242
+ Returns the paths of the found nodes.
243
+
244
+ **Example**:
245
+
246
+ ```jsx
247
+ const paths = j.find(j.VariableDeclaration).paths();
248
+ ```
249
+
250
+ ### `getAST`
251
+
252
+ `getAST` returns the root AST node of the collection.
253
+
254
+ **Example:**
255
+
256
+ ```jsx
257
+ const j = require('jscodeshift');
258
+
259
+ const root = j(`const a = 1;`);
260
+
261
+ const ast = root.getAST();
262
+ console.log(ast.type); // File
263
+
264
+ ```
265
+
266
+ ### **`get`**
267
+
268
+ Gets the first node in the collection.
269
+
270
+ **Example**:
271
+
272
+ ```jsx
273
+ const firstVariableDeclaration = j.find(j.VariableDeclaration).get();
274
+ ```
275
+
276
+ ### **`at`**
277
+
278
+ Navigates to a specific path in the AST.
279
+
280
+ **Parameters**: `index` (Number): The index of the path to navigate to.
281
+
282
+ **Example**:
283
+
284
+ ```jsx
285
+ const secondVariableDeclaration = j.find(j.VariableDeclaration).at(1);
286
+ ```
287
+
288
+ ### `getTypes`
289
+
290
+ `getTypes` returns the set of node types present in the collection.
291
+
292
+ **Example:**
293
+
294
+ ```jsx
295
+ const j = require('jscodeshift');
296
+
297
+ const root = j(`const a = 1; const b = 2;`);
298
+
299
+ const types = root.find(j.VariableDeclarator).getTypes();
300
+ console.log(types); // Set { 'VariableDeclarator' }
301
+
302
+ ```
303
+
304
+ ### `isOfType`
305
+
306
+ `isOfType` checks if the node in the collection is of a specific type.
307
+
308
+ **Parameters:** `type`: The type to check against.
309
+
310
+ **Example:**
311
+
312
+ ```jsx
313
+ const j = require('jscodeshift');
314
+
315
+ const root = j(`const a = 1;`);
316
+
317
+ const isVariableDeclarator = root.find(j.VariableDeclarator).at(0).isOfType('VariableDeclarator');
318
+ console.log(isVariableDeclarator); // true
319
+
320
+ ```
321
+
322
+ ## Node Transformation APIs
323
+
324
+ Below are the APIs used in node transformations. ([source](https://github.com/facebook/jscodeshift/blob/4851fc8a01036868efb4cf9676f3e97836097376/src/collections/Node.js#L139))
325
+
326
+ ### **`replaceWith`**
327
+
328
+ Replaces the current node(s) with a new node.
329
+
330
+ **Parameters**: `newNode` (Node or Function): The new node or a function that returns a new node.
331
+
332
+ **Example**:
333
+
334
+ ```jsx
335
+ j.find(j.Identifier)
336
+ .replaceWith(path => j.identifier(path.node.name.toUpperCase()));
337
+ ```
338
+
339
+ ### **`insertBefore`**
340
+
341
+ Inserts a node before the current node.
342
+
343
+ **Parameters**: `newNode` (Node): The node to insert.
344
+
345
+ **Example**:
346
+
347
+ ```jsx
348
+ j.find(j.FunctionDeclaration)
349
+ .insertBefore(j.expressionStatement(j.stringLiteral('Inserted before')));
350
+ ```
351
+
352
+ ### **`insertAfter`**
353
+
354
+ Inserts a node after the current node.
355
+
356
+ **Parameters**: `newNode` (Node): The node to insert.
357
+
358
+ **Example**:
359
+
360
+ ```jsx
361
+ j.find(j.FunctionDeclaration)
362
+ .insertAfter(j.expressionStatement(j.stringLiteral('Inserted after')));
363
+ ```
364
+
365
+ ### **`remove`**
366
+
367
+ Removes the current node(s).
368
+
369
+ **Example**:
370
+
371
+ ```jsx
372
+ j.find(j.VariableDeclaration).remove();
373
+ ```
374
+
375
+ ### `renameTo` ([source](https://github.com/facebook/jscodeshift/blob/main/src/collections/VariableDeclarator.js))
376
+
377
+ `renameTo` renames the nodes in the collection to a new name.
378
+
379
+ **Parameters:** `newName`: The new name to rename to.
380
+
381
+ **Example:**
382
+
383
+ ```jsx
384
+ const j = require('jscodeshift');
385
+
386
+ const root = j(`const a = 1; const b = 2;`);
387
+
388
+ root.find(j.Identifier, { name: 'a' }).renameTo('x');
389
+
390
+ console.log(root.toSource()); // const x = 1; const b = 2;
391
+
392
+ ```
393
+
394
+ These descriptions and examples should give you a clear understanding of how to use each of these jscodeshift APIs.
395
+
396
+ ### **`toSource`**
397
+
398
+ Converts the transformed AST back to source code.
399
+
400
+ **Parameters**: `options` (Object): Optional formatting options.
401
+
402
+ **Example**:
403
+
404
+ ```jsx
405
+ const transformedSource = j.toSource({ quote: 'single' });
406
+ ```