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.
- checksums.yaml +4 -4
- data/lib/immosquare-cleaner/version.rb +1 -1
- data/node_modules/@eslint/js/package.json +1 -1
- data/node_modules/eslint/README.md +1 -1
- data/node_modules/eslint/lib/cli.js +4 -3
- data/node_modules/eslint/lib/eslint/eslint.js +93 -17
- data/node_modules/eslint/lib/languages/js/source-code/source-code.js +1 -1
- data/node_modules/eslint/lib/rules/require-await.js +37 -3
- data/node_modules/eslint/lib/rules/utils/ast-utils.js +4 -3
- data/node_modules/eslint/lib/shared/flags.js +2 -1
- data/node_modules/eslint/package.json +17 -8
- data/node_modules/jscodeshift/CHANGELOG.md +17 -0
- data/node_modules/jscodeshift/CONTRIBUTING.md +7 -6
- data/node_modules/jscodeshift/README.md +3 -2
- data/node_modules/jscodeshift/dist/Runner.js +15 -15
- data/node_modules/jscodeshift/dist/collections/ImportDeclaration.js +113 -0
- data/node_modules/jscodeshift/dist/collections/index.js +1 -0
- data/node_modules/jscodeshift/dist/src/Runner.js +15 -15
- data/node_modules/jscodeshift/dist/src/collections/ImportDeclaration.js +113 -0
- data/node_modules/jscodeshift/dist/src/collections/index.js +1 -0
- data/node_modules/jscodeshift/package.json +9 -7
- data/node_modules/jscodeshift/parser/tsOptions.js +2 -0
- data/node_modules/jscodeshift/src/Runner.js +15 -15
- data/node_modules/jscodeshift/src/collections/ImportDeclaration.js +113 -0
- data/node_modules/jscodeshift/src/collections/index.js +1 -0
- data/node_modules/jscodeshift/utils/testUtils.js +1 -2
- data/node_modules/jscodeshift/website/README.md +44 -0
- data/node_modules/jscodeshift/website/astro.config.mjs +36 -0
- data/node_modules/jscodeshift/website/package.json +17 -0
- data/node_modules/jscodeshift/website/public/favicon.svg +1 -0
- data/node_modules/jscodeshift/website/src/assets/houston.webp +0 -0
- data/node_modules/jscodeshift/website/src/content/config.ts +6 -0
- data/node_modules/jscodeshift/website/src/content/docs/build/api-reference.mdx +406 -0
- data/node_modules/jscodeshift/website/src/content/docs/build/ast-grammar.mdx +3086 -0
- data/node_modules/jscodeshift/website/src/content/docs/index.mdx +15 -0
- data/node_modules/jscodeshift/website/src/content/docs/overview/introduction.mdx +45 -0
- data/node_modules/jscodeshift/website/src/content/docs/run/cli.mdx +161 -0
- data/node_modules/jscodeshift/website/src/env.d.ts +2 -0
- data/node_modules/jscodeshift/website/tsconfig.json +3 -0
- data/node_modules/npm-check-updates/README.md +34 -21
- data/node_modules/npm-check-updates/build/index.js +136 -136
- data/node_modules/npm-check-updates/build/index.js.map +1 -1
- data/node_modules/npm-check-updates/package.json +1 -1
- data/package.json +4 -4
- metadata +18 -10
- data/node_modules/jscodeshift/node_modules/chalk/index.d.ts +0 -415
- data/node_modules/jscodeshift/node_modules/chalk/license +0 -9
- data/node_modules/jscodeshift/node_modules/chalk/package.json +0 -68
- data/node_modules/jscodeshift/node_modules/chalk/readme.md +0 -341
- data/node_modules/jscodeshift/node_modules/chalk/source/index.js +0 -229
- data/node_modules/jscodeshift/node_modules/chalk/source/templates.js +0 -134
- data/node_modules/jscodeshift/node_modules/chalk/source/util.js +0 -39
- data/node_modules/jscodeshift/website/index.htm +0 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 15c52878387f89d1a9881e8d0eebcc04cf95ceecd2bb94340187a3261ea28942
|
4
|
+
data.tar.gz: 0051f3465b6c413221f190494717ffd62a0e244cafb4e7ddffee24fc4dc36a19
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d923d233871a4641ca53fc1f38858f15ba5b63a8aae6bac27e8e2d6d12a106239565c1b0b3b22cfa89309740a67381a63aed836d3db869066afe1f8ba7d5e0c9
|
7
|
+
data.tar.gz: 40e64e1e0a591582a767515b806dc70f0fdc3920f4dc43f13c31e28bed0cbbacc2d95c37bdc711496c592f583f292353842df0553e047a7539aa3baebc12781d
|
@@ -295,7 +295,7 @@ The following companies, organizations, and individuals support ESLint's ongoing
|
|
295
295
|
<!--sponsorsstart-->
|
296
296
|
<h3>Platinum Sponsors</h3>
|
297
297
|
<p><a href="https://automattic.com"><img src="https://images.opencollective.com/automattic/d0ef3e1/logo.png" alt="Automattic" height="128"></a> <a href="https://www.airbnb.com/"><img src="https://images.opencollective.com/airbnb/d327d66/logo.png" alt="Airbnb" height="128"></a></p><h3>Gold Sponsors</h3>
|
298
|
-
<p><a href="#"><img src="https://images.opencollective.com/guest-bf377e88/avatar.png" alt="Eli Schleifer" height="96"></a
|
298
|
+
<p><a href="#"><img src="https://images.opencollective.com/guest-bf377e88/avatar.png" alt="Eli Schleifer" height="96"></a></p><h3>Silver Sponsors</h3>
|
299
299
|
<p><a href="https://www.jetbrains.com/"><img src="https://images.opencollective.com/jetbrains/fe76f99/logo.png" alt="JetBrains" height="64"></a> <a href="https://liftoff.io/"><img src="https://images.opencollective.com/liftoff/5c4fa84/logo.png" alt="Liftoff" height="64"></a> <a href="https://americanexpress.io"><img src="https://avatars.githubusercontent.com/u/3853301?v=4" alt="American Express" height="64"></a> <a href="https://www.workleap.com"><img src="https://avatars.githubusercontent.com/u/53535748?u=d1e55d7661d724bf2281c1bfd33cb8f99fe2465f&v=4" alt="Workleap" height="64"></a></p><h3>Bronze Sponsors</h3>
|
300
300
|
<p><a href="https://www.notion.so"><img src="https://images.opencollective.com/notion/bf3b117/logo.png" alt="notion" height="32"></a> <a href="https://www.crosswordsolver.org/anagram-solver/"><img src="https://images.opencollective.com/anagram-solver/2666271/logo.png" alt="Anagram Solver" height="32"></a> <a href="https://icons8.com/"><img src="https://images.opencollective.com/icons8/7fa1641/logo.png" alt="Icons8" height="32"></a> <a href="https://discord.com"><img src="https://images.opencollective.com/discordapp/f9645d9/logo.png" alt="Discord" height="32"></a> <a href="https://www.ignitionapp.com"><img src="https://avatars.githubusercontent.com/u/5753491?v=4" alt="Ignition" height="32"></a> <a href="https://nx.dev"><img src="https://avatars.githubusercontent.com/u/23692104?v=4" alt="Nx" height="32"></a> <a href="https://herocoders.com"><img src="https://avatars.githubusercontent.com/u/37549774?v=4" alt="HeroCoders" height="32"></a> <a href="https://usenextbase.com"><img src="https://avatars.githubusercontent.com/u/145838380?v=4" alt="Nextbase Starter Kit" height="32"></a></p>
|
301
301
|
<!--sponsorsend-->
|
@@ -340,16 +340,17 @@ const cli = {
|
|
340
340
|
/**
|
341
341
|
* Calculates the command string for the --inspect-config operation.
|
342
342
|
* @param {string} configFile The path to the config file to inspect.
|
343
|
+
* @param {boolean} hasUnstableTSConfigFlag `true` if the `unstable_ts_config` flag is enabled, `false` if it's not.
|
343
344
|
* @returns {Promise<string>} The command string to execute.
|
344
345
|
*/
|
345
|
-
async calculateInspectConfigFlags(configFile) {
|
346
|
+
async calculateInspectConfigFlags(configFile, hasUnstableTSConfigFlag) {
|
346
347
|
|
347
348
|
// find the config file
|
348
349
|
const {
|
349
350
|
configFilePath,
|
350
351
|
basePath,
|
351
352
|
error
|
352
|
-
} = await locateConfigFileToUse({ cwd: process.cwd(), configFile });
|
353
|
+
} = await locateConfigFileToUse({ cwd: process.cwd(), configFile }, hasUnstableTSConfigFlag);
|
353
354
|
|
354
355
|
if (error) {
|
355
356
|
throw error;
|
@@ -454,7 +455,7 @@ const cli = {
|
|
454
455
|
try {
|
455
456
|
const flatOptions = await translateOptions(options, "flat");
|
456
457
|
const spawn = require("cross-spawn");
|
457
|
-
const flags = await cli.calculateInspectConfigFlags(flatOptions.overrideConfigFile);
|
458
|
+
const flags = await cli.calculateInspectConfigFlags(flatOptions.overrideConfigFile, flatOptions.flags ? flatOptions.flags.includes("unstable_ts_config") : false);
|
458
459
|
|
459
460
|
spawn.sync("npx", ["@eslint/config-inspector@latest", ...flags], { encoding: "utf8", stdio: "inherit" });
|
460
461
|
} catch (error) {
|
@@ -63,6 +63,8 @@ const { Retrier } = require("@humanwhocodes/retry");
|
|
63
63
|
/** @typedef {import("../shared/types").RuleConf} RuleConf */
|
64
64
|
/** @typedef {import("../shared/types").Rule} Rule */
|
65
65
|
/** @typedef {ReturnType<ConfigArray.extractConfig>} ExtractedConfig */
|
66
|
+
/** @typedef {import('../cli-engine/cli-engine').CLIEngine} CLIEngine */
|
67
|
+
/** @typedef {import('./legacy-eslint').CLIEngineLintReport} CLIEngineLintReport */
|
66
68
|
|
67
69
|
/**
|
68
70
|
* The options with which to configure the ESLint instance.
|
@@ -86,7 +88,7 @@ const { Retrier } = require("@humanwhocodes/retry");
|
|
86
88
|
* when a string.
|
87
89
|
* @property {Record<string,Plugin>} [plugins] An array of plugin implementations.
|
88
90
|
* @property {boolean} [stats] True enables added statistics on lint results.
|
89
|
-
* @property {boolean} warnIgnored Show warnings when the file list includes ignored files
|
91
|
+
* @property {boolean} [warnIgnored] Show warnings when the file list includes ignored files
|
90
92
|
* @property {boolean} [passOnNoPatterns=false] When set to true, missing patterns cause
|
91
93
|
* the linting operation to short circuit and not report any failures.
|
92
94
|
*/
|
@@ -100,8 +102,18 @@ const FLAT_CONFIG_FILENAMES = [
|
|
100
102
|
"eslint.config.mjs",
|
101
103
|
"eslint.config.cjs"
|
102
104
|
];
|
105
|
+
const FLAT_CONFIG_FILENAMES_WITH_TS = [
|
106
|
+
...FLAT_CONFIG_FILENAMES,
|
107
|
+
"eslint.config.ts",
|
108
|
+
"eslint.config.mts",
|
109
|
+
"eslint.config.cts"
|
110
|
+
];
|
103
111
|
const debug = require("debug")("eslint:eslint");
|
104
112
|
const privateMembers = new WeakMap();
|
113
|
+
|
114
|
+
/**
|
115
|
+
* @type {Map<string, string>}
|
116
|
+
*/
|
105
117
|
const importedConfigFileModificationTime = new Map();
|
106
118
|
const removedFormatters = new Set([
|
107
119
|
"checkstyle",
|
@@ -262,28 +274,59 @@ function compareResultsByFilePath(a, b) {
|
|
262
274
|
* Searches from the current working directory up until finding the
|
263
275
|
* given flat config filename.
|
264
276
|
* @param {string} cwd The current working directory to search from.
|
277
|
+
* @param {boolean} hasUnstableTSConfigFlag `true` if the `unstable_ts_config` flag is enabled, `false` if it's not.
|
265
278
|
* @returns {Promise<string|undefined>} The filename if found or `undefined` if not.
|
266
279
|
*/
|
267
|
-
function findFlatConfigFile(cwd) {
|
280
|
+
function findFlatConfigFile(cwd, hasUnstableTSConfigFlag) {
|
281
|
+
const filenames = hasUnstableTSConfigFlag ? FLAT_CONFIG_FILENAMES_WITH_TS : FLAT_CONFIG_FILENAMES;
|
282
|
+
|
268
283
|
return findUp(
|
269
|
-
|
284
|
+
filenames,
|
270
285
|
{ cwd }
|
271
286
|
);
|
272
287
|
}
|
273
288
|
|
289
|
+
/**
|
290
|
+
* Check if the file is a TypeScript file.
|
291
|
+
* @param {string} filePath The file path to check.
|
292
|
+
* @returns {boolean} `true` if the file is a TypeScript file, `false` if it's not.
|
293
|
+
*/
|
294
|
+
function isFileTS(filePath) {
|
295
|
+
const fileExtension = path.extname(filePath);
|
296
|
+
|
297
|
+
return /^\.[mc]?ts$/u.test(fileExtension);
|
298
|
+
}
|
299
|
+
|
300
|
+
/**
|
301
|
+
* Check if ESLint is running in Bun.
|
302
|
+
* @returns {boolean} `true` if the ESLint is running Bun, `false` if it's not.
|
303
|
+
*/
|
304
|
+
function isRunningInBun() {
|
305
|
+
return !!globalThis.Bun;
|
306
|
+
}
|
307
|
+
|
308
|
+
/**
|
309
|
+
* Check if ESLint is running in Deno.
|
310
|
+
* @returns {boolean} `true` if the ESLint is running in Deno, `false` if it's not.
|
311
|
+
*/
|
312
|
+
function isRunningInDeno() {
|
313
|
+
return !!globalThis.Deno;
|
314
|
+
}
|
315
|
+
|
274
316
|
/**
|
275
317
|
* Load the config array from the given filename.
|
276
318
|
* @param {string} filePath The filename to load from.
|
319
|
+
* @param {boolean} hasUnstableTSConfigFlag `true` if the `unstable_ts_config` flag is enabled, `false` if it's not.
|
277
320
|
* @returns {Promise<any>} The config loaded from the config file.
|
278
321
|
*/
|
279
|
-
async function loadFlatConfigFile(filePath) {
|
322
|
+
async function loadFlatConfigFile(filePath, hasUnstableTSConfigFlag) {
|
280
323
|
debug(`Loading config from ${filePath}`);
|
281
324
|
|
282
325
|
const fileURL = pathToFileURL(filePath);
|
283
326
|
|
284
327
|
debug(`Config file URL is ${fileURL}`);
|
285
328
|
|
286
|
-
const mtime = (await fs.stat(filePath)).mtime.getTime();
|
329
|
+
const mtime = (await fs.stat(filePath)).mtime.getTime().toString();
|
287
330
|
|
288
331
|
/*
|
289
332
|
* Append a query with the config file's modification time (`mtime`) in order
|
@@ -314,7 +357,37 @@ async function loadFlatConfigFile(filePath) {
|
|
314
357
|
delete require.cache[filePath];
|
315
358
|
}
|
316
359
|
|
317
|
-
const
|
360
|
+
const isTS = isFileTS(filePath) && hasUnstableTSConfigFlag;
|
361
|
+
|
362
|
+
const isBun = isRunningInBun();
|
363
|
+
|
364
|
+
const isDeno = isRunningInDeno();
|
365
|
+
|
366
|
+
if (isTS && !isDeno && !isBun) {
|
367
|
+
|
368
|
+
const createJiti = await import("jiti").then(jitiModule => jitiModule.default, () => {
|
369
|
+
throw new Error("The 'jiti' library is required for loading TypeScript configuration files. Make sure to install it.");
|
370
|
+
});
|
371
|
+
|
372
|
+
/*
|
373
|
+
* Disabling `moduleCache` allows us to reload a
|
374
|
+
* config file when the last modified timestamp changes.
|
375
|
+
*/
|
376
|
+
|
377
|
+
const jiti = createJiti(__filename, { moduleCache: false });
|
378
|
+
|
379
|
+
if (typeof jiti?.import !== "function") {
|
380
|
+
throw new Error("You are using an outdated version of the 'jiti' library. Please update to the latest version of 'jiti' to ensure compatibility and access to the latest features.");
|
381
|
+
}
|
382
|
+
|
383
|
+
const config = await jiti.import(fileURL.href);
|
384
|
+
|
385
|
+
importedConfigFileModificationTime.set(filePath, mtime);
|
386
|
+
|
387
|
+
return config?.default ?? config;
|
388
|
+
}
|
389
|
+
|
390
|
+
const config = (await import(fileURL.href)).default;
|
318
391
|
|
319
392
|
importedConfigFileModificationTime.set(filePath, mtime);
|
320
393
|
|
@@ -326,11 +399,12 @@ async function loadFlatConfigFile(filePath) {
|
|
326
399
|
* override config file was passed, and if so, using it; otherwise, as long
|
327
400
|
* as override config file is not explicitly set to `false`, it will search
|
328
401
|
* upwards from the cwd for a file named `eslint.config.js`.
|
329
|
-
* @param {
|
330
|
-
* @
|
402
|
+
* @param {ESLintOptions} options The ESLint instance options.
|
403
|
+
* @param {boolean} hasUnstableTSConfigFlag `true` if the `unstable_ts_config` flag is enabled, `false` if it's not.
|
404
|
+
* @returns {Promise<{configFilePath:string|undefined;basePath:string;error:Error|null}>} Location information for
|
331
405
|
* the config file.
|
332
406
|
*/
|
333
|
-
async function locateConfigFileToUse({ configFile, cwd }) {
|
407
|
+
async function locateConfigFileToUse({ configFile, cwd }, hasUnstableTSConfigFlag) {
|
334
408
|
|
335
409
|
// determine where to load config file from
|
336
410
|
let configFilePath;
|
@@ -342,7 +416,7 @@ async function locateConfigFileToUse({ configFile, cwd }) {
|
|
342
416
|
configFilePath = path.resolve(cwd, configFile);
|
343
417
|
} else if (configFile !== false) {
|
344
418
|
debug("Searching for eslint.config.js");
|
345
|
-
configFilePath = await findFlatConfigFile(cwd);
|
419
|
+
configFilePath = await findFlatConfigFile(cwd, hasUnstableTSConfigFlag);
|
346
420
|
|
347
421
|
if (configFilePath) {
|
348
422
|
basePath = path.resolve(path.dirname(configFilePath));
|
@@ -364,8 +438,8 @@ async function locateConfigFileToUse({ configFile, cwd }) {
|
|
364
438
|
/**
|
365
439
|
* Calculates the config array for this run based on inputs.
|
366
440
|
* @param {ESLint} eslint The instance to create the config array for.
|
367
|
-
* @param {
|
368
|
-
* @returns {FlatConfigArray} The config array for `eslint``.
|
441
|
+
* @param {ESLintOptions} options The ESLint instance options.
|
442
|
+
* @returns {Promise<typeof FlatConfigArray>} The config array for `eslint``.
|
369
443
|
*/
|
370
444
|
async function calculateConfigArray(eslint, {
|
371
445
|
cwd,
|
@@ -383,7 +457,9 @@ async function calculateConfigArray(eslint, {
|
|
383
457
|
return slots.configs;
|
384
458
|
}
|
385
459
|
|
386
|
-
const
|
460
|
+
const hasUnstableTSConfigFlag = eslint.hasFlag("unstable_ts_config");
|
461
|
+
|
462
|
+
const { configFilePath, basePath, error } = await locateConfigFileToUse({ configFile, cwd }, hasUnstableTSConfigFlag);
|
387
463
|
|
388
464
|
// config file is required to calculate config
|
389
465
|
if (error) {
|
@@ -394,7 +470,7 @@ async function calculateConfigArray(eslint, {
|
|
394
470
|
|
395
471
|
// load config file
|
396
472
|
if (configFilePath) {
|
397
|
-
const fileConfig = await loadFlatConfigFile(configFilePath);
|
473
|
+
const fileConfig = await loadFlatConfigFile(configFilePath, hasUnstableTSConfigFlag);
|
398
474
|
|
399
475
|
if (Array.isArray(fileConfig)) {
|
400
476
|
configs.push(...fileConfig);
|
@@ -1144,7 +1220,7 @@ class ESLint {
|
|
1144
1220
|
|
1145
1221
|
/**
|
1146
1222
|
* The main formatter method.
|
1147
|
-
* @param {
|
1223
|
+
* @param {LintResult[]} results The lint results to format.
|
1148
1224
|
* @param {ResultsMeta} resultsMeta Warning count and max threshold.
|
1149
1225
|
* @returns {string} The formatted lint results.
|
1150
1226
|
*/
|
@@ -1190,12 +1266,12 @@ class ESLint {
|
|
1190
1266
|
/**
|
1191
1267
|
* Finds the config file being used by this instance based on the options
|
1192
1268
|
* passed to the constructor.
|
1193
|
-
* @returns {string|undefined} The path to the config file being used or
|
1269
|
+
* @returns {Promise<string|undefined>} The path to the config file being used or
|
1194
1270
|
* `undefined` if no config file is being used.
|
1195
1271
|
*/
|
1196
1272
|
async findConfigFile() {
|
1197
1273
|
const options = privateMembers.get(this).options;
|
1198
|
-
const { configFilePath } = await locateConfigFileToUse(options);
|
1274
|
+
const { configFilePath } = await locateConfigFileToUse(options, this.hasFlag("unstable_ts_config"));
|
1199
1275
|
|
1200
1276
|
return configFilePath;
|
1201
1277
|
}
|
@@ -918,7 +918,7 @@ class SourceCode extends TokenStore {
|
|
918
918
|
}
|
919
919
|
|
920
920
|
/**
|
921
|
-
* Returns the
|
921
|
+
* Returns the location of the given node or token.
|
922
922
|
* @param {ASTNode|Token} nodeOrToken The node or token to get the location of.
|
923
923
|
* @returns {SourceLocation} The location of the node or token.
|
924
924
|
*/
|
@@ -42,8 +42,11 @@ module.exports = {
|
|
42
42
|
schema: [],
|
43
43
|
|
44
44
|
messages: {
|
45
|
-
missingAwait: "{{name}} has no 'await' expression."
|
46
|
-
|
45
|
+
missingAwait: "{{name}} has no 'await' expression.",
|
46
|
+
removeAsync: "Remove 'async'."
|
47
|
+
},
|
48
|
+
|
49
|
+
hasSuggestions: true
|
47
50
|
},
|
48
51
|
|
49
52
|
create(context) {
|
@@ -69,6 +72,33 @@ module.exports = {
|
|
69
72
|
*/
|
70
73
|
function exitFunction(node) {
|
71
74
|
if (!node.generator && node.async && !scopeInfo.hasAwait && !astUtils.isEmptyFunction(node)) {
|
75
|
+
|
76
|
+
/*
|
77
|
+
* If the function belongs to a method definition or
|
78
|
+
* property, then the function's range may not include the
|
79
|
+
* `async` keyword and we should look at the parent instead.
|
80
|
+
*/
|
81
|
+
const nodeWithAsyncKeyword =
|
82
|
+
(node.parent.type === "MethodDefinition" && node.parent.value === node) ||
|
83
|
+
(node.parent.type === "Property" && node.parent.method && node.parent.value === node)
|
84
|
+
? node.parent
|
85
|
+
: node;
|
86
|
+
|
87
|
+
const asyncToken = sourceCode.getFirstToken(nodeWithAsyncKeyword, token => token.value === "async");
|
88
|
+
const asyncRange = [asyncToken.range[0], sourceCode.getTokenAfter(asyncToken, { includeComments: true }).range[0]];
|
89
|
+
|
90
|
+
/*
|
91
|
+
* Removing the `async` keyword can cause parsing errors if the current
|
92
|
+
* statement is relying on automatic semicolon insertion. If ASI is currently
|
93
|
+
* being used, then we should replace the `async` keyword with a semicolon.
|
94
|
+
*/
|
95
|
+
const nextToken = sourceCode.getTokenAfter(asyncToken);
|
96
|
+
const addSemiColon =
|
97
|
+
nextToken.type === "Punctuator" &&
|
98
|
+
(nextToken.value === "[" || nextToken.value === "(") &&
|
99
|
+
(nodeWithAsyncKeyword.type === "MethodDefinition" || astUtils.isStartOfExpressionStatement(nodeWithAsyncKeyword)) &&
|
100
|
+
astUtils.needsPrecedingSemicolon(sourceCode, nodeWithAsyncKeyword);
|
101
|
+
|
72
102
|
context.report({
|
73
103
|
node,
|
74
104
|
loc: astUtils.getFunctionHeadLoc(node, sourceCode),
|
@@ -77,7 +107,11 @@ module.exports = {
|
|
77
107
|
name: capitalizeFirstLetter(
|
78
108
|
astUtils.getFunctionNameWithKind(node)
|
79
109
|
)
|
80
|
-
}
|
110
|
+
},
|
111
|
+
suggest: [{
|
112
|
+
messageId: "removeAsync",
|
113
|
+
fix: fixer => fixer.replaceTextRange(asyncRange, addSemiColon ? ";" : "")
|
114
|
+
}]
|
81
115
|
});
|
82
116
|
}
|
83
117
|
|
@@ -1042,11 +1042,12 @@ function isStartOfExpressionStatement(node) {
|
|
1042
1042
|
|
1043
1043
|
/**
|
1044
1044
|
* Determines whether an opening parenthesis `(`, bracket `[` or backtick ``` ` ``` needs to be preceded by a semicolon.
|
1045
|
-
* This opening parenthesis or bracket should be at the start of an `ExpressionStatement` or at
|
1045
|
+
* This opening parenthesis or bracket should be at the start of an `ExpressionStatement`, a `MethodDefinition` or at
|
1046
|
+
* the start of the body of an `ArrowFunctionExpression`.
|
1046
1047
|
* @type {(sourceCode: SourceCode, node: ASTNode) => boolean}
|
1047
1048
|
* @param {SourceCode} sourceCode The source code object.
|
1048
1049
|
* @param {ASTNode} node A node at the position where an opening parenthesis or bracket will be inserted.
|
1049
|
-
* @returns {boolean} Whether a semicolon is required before the opening parenthesis or
|
1050
|
+
* @returns {boolean} Whether a semicolon is required before the opening parenthesis or bracket.
|
1050
1051
|
*/
|
1051
1052
|
let needsPrecedingSemicolon;
|
1052
1053
|
|
@@ -1106,7 +1107,7 @@ let needsPrecedingSemicolon;
|
|
1106
1107
|
|
1107
1108
|
if (isClosingBraceToken(prevToken)) {
|
1108
1109
|
return (
|
1109
|
-
prevNode.type === "BlockStatement" && prevNode.parent.type === "FunctionExpression" ||
|
1110
|
+
prevNode.type === "BlockStatement" && prevNode.parent.type === "FunctionExpression" && prevNode.parent.parent.type !== "MethodDefinition" ||
|
1110
1111
|
prevNode.type === "ClassBody" && prevNode.parent.type === "ClassExpression" ||
|
1111
1112
|
prevNode.type === "ObjectExpression"
|
1112
1113
|
);
|
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "eslint",
|
3
|
-
"version": "9.
|
3
|
+
"version": "9.9.0",
|
4
4
|
"author": "Nicholas C. Zakas <nicholas+npm@nczconsulting.com>",
|
5
5
|
"description": "An AST-based pattern checker for JavaScript.",
|
6
6
|
"bin": {
|
@@ -70,7 +70,7 @@
|
|
70
70
|
"@eslint-community/regexpp": "^4.11.0",
|
71
71
|
"@eslint/config-array": "^0.17.1",
|
72
72
|
"@eslint/eslintrc": "^3.1.0",
|
73
|
-
"@eslint/js": "9.
|
73
|
+
"@eslint/js": "9.9.0",
|
74
74
|
"@humanwhocodes/module-importer": "^1.0.1",
|
75
75
|
"@humanwhocodes/retry": "^0.3.0",
|
76
76
|
"@nodelib/fs.walk": "^1.2.8",
|
@@ -104,14 +104,14 @@
|
|
104
104
|
"devDependencies": {
|
105
105
|
"@babel/core": "^7.4.3",
|
106
106
|
"@babel/preset-env": "^7.4.3",
|
107
|
-
"@eslint/core": "^0.
|
108
|
-
"@eslint/json": "^0.
|
107
|
+
"@eslint/core": "^0.3.0",
|
108
|
+
"@eslint/json": "^0.3.0",
|
109
109
|
"@types/estree": "^1.0.5",
|
110
110
|
"@types/node": "^20.11.5",
|
111
|
-
"@wdio/browser-runner": "^8.
|
112
|
-
"@wdio/cli": "^8.
|
113
|
-
"@wdio/concise-reporter": "^8.
|
114
|
-
"@wdio/mocha-framework": "^8.
|
111
|
+
"@wdio/browser-runner": "^8.40.1",
|
112
|
+
"@wdio/cli": "^8.40.0",
|
113
|
+
"@wdio/concise-reporter": "^8.39.0",
|
114
|
+
"@wdio/mocha-framework": "^8.40.0",
|
115
115
|
"babel-loader": "^8.0.5",
|
116
116
|
"c8": "^7.12.0",
|
117
117
|
"chai": "^4.0.1",
|
@@ -132,6 +132,7 @@
|
|
132
132
|
"globals": "^15.0.0",
|
133
133
|
"got": "^11.8.3",
|
134
134
|
"gray-matter": "^4.0.3",
|
135
|
+
"jiti": "^1.21.6",
|
135
136
|
"js-yaml": "^4.1.0",
|
136
137
|
"knip": "^5.21.0",
|
137
138
|
"lint-staged": "^11.0.0",
|
@@ -165,6 +166,14 @@
|
|
165
166
|
"webpack-cli": "^4.5.0",
|
166
167
|
"yorkie": "^2.0.0"
|
167
168
|
},
|
169
|
+
"peerDependencies": {
|
170
|
+
"jiti": "*"
|
171
|
+
},
|
172
|
+
"peerDependenciesMeta": {
|
173
|
+
"jiti": {
|
174
|
+
"optional": true
|
175
|
+
}
|
176
|
+
},
|
168
177
|
"keywords": [
|
169
178
|
"ast",
|
170
179
|
"lint",
|
@@ -7,6 +7,23 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
7
7
|
## [Unreleased]
|
8
8
|
<!-- Add new changes here -->
|
9
9
|
|
10
|
+
## [17.0.0] 2024-08-06
|
11
|
+
|
12
|
+
We needed to go [from v0.x to a major release](https://github.com/facebook/jscodeshift/issues/593), and it may as well happen now. jscodeshift has been around for nine years though, so going to v1.0.0 didn't feel quite right. I've instead promoted the minor version number to a major version number, similar to what React did when it went from 0.14 to 15.0.
|
13
|
+
|
14
|
+
### Fixed
|
15
|
+
- Node.js 16 is now explicitly specified as the minimum required version. It was *already* (#607, @trivikr)
|
16
|
+
|
17
|
+
### Added
|
18
|
+
- A new [jscodeshift website](https://jscodeshift.com/) has launched, thanks to the team at [Codemod](https://codemod.com/). (#592, @mohab-sameh with some tweaks by @morinokami)
|
19
|
+
- Added collection functions for import declarations, including finding imports and inserting new imports (#617, @danieldelcore)
|
20
|
+
|
21
|
+
### Changed
|
22
|
+
- Enabled TypeScript `importAttributes` (#585, @benasher44) and `decoratorAutoAccessors` (#594, @syi0808) plugins
|
23
|
+
- Removed or replaced various outdated and unused dependencies (#601, #605, #609, #613, @trivikr)
|
24
|
+
- Started using Corepack to manage Yarn version (#599, @trivikr)
|
25
|
+
|
26
|
+
|
10
27
|
## [0.16.1] 2024-06-25
|
11
28
|
|
12
29
|
### Fixed
|
@@ -12,12 +12,13 @@ the process for contributing will follow standard GitHub protocol.
|
|
12
12
|
## Pull Requests
|
13
13
|
We actively welcome your pull requests.
|
14
14
|
|
15
|
-
1. Fork the repo and create your branch from `
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
15
|
+
1. Fork the repo and create your branch from `main`.
|
16
|
+
1. Run `corepack enable` to set up `yarn` package manager.
|
17
|
+
1. If you've added code that should be tested, add tests.
|
18
|
+
1. If you've changed APIs, update the documentation.
|
19
|
+
1. Ensure the test suite passes.
|
20
|
+
1. Make sure your code lints.
|
21
|
+
1. If you haven't already, complete the Contributor License Agreement ("CLA").
|
21
22
|
|
22
23
|
## Contributor License Agreement ("CLA")
|
23
24
|
In order to accept your pull request, we need you to submit a CLA. You only need
|
@@ -1,4 +1,5 @@
|
|
1
|
-
# jscodeshift [![Support Ukraine](https://img.shields.io/badge/Support-Ukraine-FFD500?style=flat&labelColor=005BBB)](https://opensource.fb.com/support-ukraine) [![Build Status](https://
|
1
|
+
# [jscodeshift](https://jscodeshift.com/) [![Support Ukraine](https://img.shields.io/badge/Support-Ukraine-FFD500?style=flat&labelColor=005BBB)](https://opensource.fb.com/support-ukraine) [![Build Status](https://img.shields.io/github/checks-status/facebook/jscodeshift/main?label=build)](https://github.com/facebook/jscodeshift/actions/workflows/test.yml?query=branch%3Amain)
|
2
|
+
|
2
3
|
|
3
4
|
jscodeshift is a toolkit for running codemods over multiple JavaScript or
|
4
5
|
TypeScript files.
|
@@ -579,7 +580,7 @@ defineInlineTest(transform, /* ... */)
|
|
579
580
|
|
580
581
|
It's recommended that you set up your codemod project to all debugging via the VSCode IDE. When you open your project in VSCode, add the following configuration to your launch.json debugging configuration.
|
581
582
|
|
582
|
-
```
|
583
|
+
```jsonc
|
583
584
|
{
|
584
585
|
// Use IntelliSense to learn about possible attributes.
|
585
586
|
// Hover to view descriptions of existing attributes.
|
@@ -9,7 +9,7 @@
|
|
9
9
|
'use strict';
|
10
10
|
|
11
11
|
const child_process = require('child_process');
|
12
|
-
const
|
12
|
+
const pc = require('picocolors');
|
13
13
|
const fs = require('graceful-fs');
|
14
14
|
const path = require('path');
|
15
15
|
const http = require('http');
|
@@ -47,21 +47,21 @@ const bufferedWrite = (function() {
|
|
47
47
|
|
48
48
|
const log = {
|
49
49
|
ok(msg, verbose) {
|
50
|
-
verbose >= 2 && bufferedWrite(
|
50
|
+
verbose >= 2 && bufferedWrite(pc.bgGreen(pc.white(' OKK ')) + msg);
|
51
51
|
},
|
52
52
|
nochange(msg, verbose) {
|
53
|
-
verbose >= 1 && bufferedWrite(
|
53
|
+
verbose >= 1 && bufferedWrite(pc.bgYellow(pc.white(' NOC ')) + msg);
|
54
54
|
},
|
55
55
|
skip(msg, verbose) {
|
56
|
-
verbose >= 1 && bufferedWrite(
|
56
|
+
verbose >= 1 && bufferedWrite(pc.bgYellow(pc.white(' SKIP ')) + msg);
|
57
57
|
},
|
58
58
|
error(msg, verbose) {
|
59
|
-
verbose >= 0 && bufferedWrite(
|
59
|
+
verbose >= 0 && bufferedWrite(pc.bgRed(pc.white(' ERR ')) + msg);
|
60
60
|
},
|
61
61
|
};
|
62
62
|
|
63
63
|
function report({file, msg}) {
|
64
|
-
bufferedWrite(lineBreak(`${
|
64
|
+
bufferedWrite(lineBreak(`${pc.bgBlue(pc.white(' REP '))}${file} ${msg}`));
|
65
65
|
}
|
66
66
|
|
67
67
|
function concatAll(arrays) {
|
@@ -77,17 +77,17 @@ function concatAll(arrays) {
|
|
77
77
|
function showFileStats(fileStats) {
|
78
78
|
process.stdout.write(
|
79
79
|
'Results: \n'+
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
80
|
+
pc.red(fileStats.error + ' errors\n')+
|
81
|
+
pc.yellow(fileStats.nochange + ' unmodified\n')+
|
82
|
+
pc.yellow(fileStats.skip + ' skipped\n')+
|
83
|
+
pc.green(fileStats.ok + ' ok\n')
|
84
84
|
);
|
85
85
|
}
|
86
86
|
|
87
87
|
function showStats(stats) {
|
88
88
|
const names = Object.keys(stats).sort();
|
89
89
|
if (names.length) {
|
90
|
-
process.stdout.write(
|
90
|
+
process.stdout.write(pc.blue('Stats: \n'));
|
91
91
|
}
|
92
92
|
names.forEach(name => process.stdout.write(name + ': ' + stats[name] + '\n'));
|
93
93
|
}
|
@@ -177,7 +177,7 @@ function run(transformFile, paths, options) {
|
|
177
177
|
let gitIgnorePath = path.join(currDirectory, '.gitignore');
|
178
178
|
ignores.addFromFile(gitIgnorePath);
|
179
179
|
}
|
180
|
-
|
180
|
+
|
181
181
|
if (/^http/.test(transformFile)) {
|
182
182
|
usedRemoteScript = true;
|
183
183
|
return new Promise((resolve, reject) => {
|
@@ -208,7 +208,7 @@ function run(transformFile, paths, options) {
|
|
208
208
|
});
|
209
209
|
} else if (!fs.existsSync(transformFile)) {
|
210
210
|
process.stderr.write(
|
211
|
-
|
211
|
+
pc.bgRed(pc.white('ERROR')) + ' Transform file ' + transformFile + ' does not exist \n'
|
212
212
|
);
|
213
213
|
return;
|
214
214
|
} else {
|
@@ -254,7 +254,7 @@ function run(transformFile, paths, options) {
|
|
254
254
|
}
|
255
255
|
if (options.dry) {
|
256
256
|
process.stdout.write(
|
257
|
-
|
257
|
+
pc.green('Running in dry mode, no files will be written! \n')
|
258
258
|
);
|
259
259
|
}
|
260
260
|
}
|
@@ -305,7 +305,7 @@ function run(transformFile, paths, options) {
|
|
305
305
|
process.stdout.write(
|
306
306
|
'Time elapsed: ' + timeElapsed + 'seconds \n'
|
307
307
|
);
|
308
|
-
|
308
|
+
|
309
309
|
if (options.failOnError && fileCounters.error > 0) {
|
310
310
|
process.exit(1);
|
311
311
|
}
|