Tracking de l'application VApp (IHM du jeu)
This commit is contained in:
2
VApp/node_modules/@rushstack/eslint-patch/lib/eslint-bulk-suppressions/cli/prune.d.ts
generated
vendored
Normal file
2
VApp/node_modules/@rushstack/eslint-patch/lib/eslint-bulk-suppressions/cli/prune.d.ts
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
export declare function prune(): void;
|
||||
//# sourceMappingURL=prune.d.ts.map
|
1
VApp/node_modules/@rushstack/eslint-patch/lib/eslint-bulk-suppressions/cli/prune.d.ts.map
generated
vendored
Normal file
1
VApp/node_modules/@rushstack/eslint-patch/lib/eslint-bulk-suppressions/cli/prune.d.ts.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"prune.d.ts","sourceRoot":"","sources":["../../../src/eslint-bulk-suppressions/cli/prune.ts"],"names":[],"mappings":"AAOA,wBAAgB,KAAK,SAsCpB"}
|
35
VApp/node_modules/@rushstack/eslint-patch/lib/eslint-bulk-suppressions/cli/prune.js
generated
vendored
Normal file
35
VApp/node_modules/@rushstack/eslint-patch/lib/eslint-bulk-suppressions/cli/prune.js
generated
vendored
Normal file
@ -0,0 +1,35 @@
|
||||
"use strict";
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
|
||||
// See LICENSE in the project root for license information.
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.prune = void 0;
|
||||
const child_process_1 = require("child_process");
|
||||
const get_eslint_cli_1 = require("./utils/get-eslint-cli");
|
||||
const print_help_1 = require("./utils/print-help");
|
||||
function prune() {
|
||||
const args = process.argv.slice(3);
|
||||
if (args.includes('--help') || args.includes('-h')) {
|
||||
(0, print_help_1.printPruneHelp)();
|
||||
process.exit(0);
|
||||
}
|
||||
if (args.length > 0) {
|
||||
throw new Error(`@rushstack/eslint-bulk: Unknown arguments: ${args.join(' ')}`);
|
||||
}
|
||||
const eslintCLI = (0, get_eslint_cli_1.getEslintCli)(process.cwd());
|
||||
const env = Object.assign(Object.assign({}, process.env), { ESLINT_BULK_PRUNE: 'true' });
|
||||
(0, child_process_1.exec)(`${eslintCLI} . --format=json`, { env }, (error, stdout, stderr) => {
|
||||
// if errorCount != 0, ESLint will process.exit(1) giving the false impression
|
||||
// that the exec failed, even though linting errors are to be expected
|
||||
const eslintOutputWithErrorRegex = /"errorCount":(?!0)\d+/;
|
||||
const isEslintError = error !== null && error.code === 1 && eslintOutputWithErrorRegex.test(stdout);
|
||||
if (error && !isEslintError) {
|
||||
throw new Error(`@rushstack/eslint-bulk execution error: ${error.message}`);
|
||||
}
|
||||
if (stderr) {
|
||||
throw new Error(`@rushstack/eslint-bulk ESLint errors: ${stderr}`);
|
||||
}
|
||||
console.log(`@rushstack/eslint-bulk: Successfully pruned unused suppressions in all .eslint-bulk-suppressions.json files under directory ${process.cwd()}`);
|
||||
});
|
||||
}
|
||||
exports.prune = prune;
|
||||
//# sourceMappingURL=prune.js.map
|
1
VApp/node_modules/@rushstack/eslint-patch/lib/eslint-bulk-suppressions/cli/prune.js.map
generated
vendored
Normal file
1
VApp/node_modules/@rushstack/eslint-patch/lib/eslint-bulk-suppressions/cli/prune.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"prune.js","sourceRoot":"","sources":["../../../src/eslint-bulk-suppressions/cli/prune.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAE3D,iDAAoD;AACpD,2DAAsD;AACtD,mDAAoD;AAEpD,SAAgB,KAAK;IACnB,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAEnC,IAAI,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;QACnD,IAAA,2BAAc,GAAE,CAAC;QACjB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAED,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACpB,MAAM,IAAI,KAAK,CAAC,8CAA8C,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAClF,CAAC;IAED,MAAM,SAAS,GAAG,IAAA,6BAAY,EAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;IAE9C,MAAM,GAAG,mCAA2B,OAAO,CAAC,GAAG,KAAE,iBAAiB,EAAE,MAAM,GAAE,CAAC;IAE7E,IAAA,oBAAI,EACF,GAAG,SAAS,kBAAkB,EAC9B,EAAE,GAAG,EAAE,EACP,CAAC,KAA2B,EAAE,MAAc,EAAE,MAAc,EAAE,EAAE;QAC9D,8EAA8E;QAC9E,sEAAsE;QACtE,MAAM,0BAA0B,GAAG,uBAAuB,CAAC;QAC3D,MAAM,aAAa,GAAG,KAAK,KAAK,IAAI,IAAI,KAAK,CAAC,IAAI,KAAK,CAAC,IAAI,0BAA0B,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAEpG,IAAI,KAAK,IAAI,CAAC,aAAa,EAAE,CAAC;YAC5B,MAAM,IAAI,KAAK,CAAC,2CAA2C,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;QAC9E,CAAC;QAED,IAAI,MAAM,EAAE,CAAC;YACX,MAAM,IAAI,KAAK,CAAC,yCAAyC,MAAM,EAAE,CAAC,CAAC;QACrE,CAAC;QAED,OAAO,CAAC,GAAG,CACT,+HAA+H,OAAO,CAAC,GAAG,EAAE,EAAE,CAC/I,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC;AAtCD,sBAsCC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport { ExecException, exec } from 'child_process';\nimport { getEslintCli } from './utils/get-eslint-cli';\nimport { printPruneHelp } from './utils/print-help';\n\nexport function prune() {\n const args = process.argv.slice(3);\n\n if (args.includes('--help') || args.includes('-h')) {\n printPruneHelp();\n process.exit(0);\n }\n\n if (args.length > 0) {\n throw new Error(`@rushstack/eslint-bulk: Unknown arguments: ${args.join(' ')}`);\n }\n\n const eslintCLI = getEslintCli(process.cwd());\n\n const env: NodeJS.ProcessEnv = { ...process.env, ESLINT_BULK_PRUNE: 'true' };\n\n exec(\n `${eslintCLI} . --format=json`,\n { env },\n (error: ExecException | null, stdout: string, stderr: string) => {\n // if errorCount != 0, ESLint will process.exit(1) giving the false impression\n // that the exec failed, even though linting errors are to be expected\n const eslintOutputWithErrorRegex = /\"errorCount\":(?!0)\\d+/;\n const isEslintError = error !== null && error.code === 1 && eslintOutputWithErrorRegex.test(stdout);\n\n if (error && !isEslintError) {\n throw new Error(`@rushstack/eslint-bulk execution error: ${error.message}`);\n }\n\n if (stderr) {\n throw new Error(`@rushstack/eslint-bulk ESLint errors: ${stderr}`);\n }\n\n console.log(\n `@rushstack/eslint-bulk: Successfully pruned unused suppressions in all .eslint-bulk-suppressions.json files under directory ${process.cwd()}`\n );\n }\n );\n}\n"]}
|
2
VApp/node_modules/@rushstack/eslint-patch/lib/eslint-bulk-suppressions/cli/start.d.ts
generated
vendored
Normal file
2
VApp/node_modules/@rushstack/eslint-patch/lib/eslint-bulk-suppressions/cli/start.d.ts
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
export {};
|
||||
//# sourceMappingURL=start.d.ts.map
|
1
VApp/node_modules/@rushstack/eslint-patch/lib/eslint-bulk-suppressions/cli/start.d.ts.map
generated
vendored
Normal file
1
VApp/node_modules/@rushstack/eslint-patch/lib/eslint-bulk-suppressions/cli/start.d.ts.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"start.d.ts","sourceRoot":"","sources":["../../../src/eslint-bulk-suppressions/cli/start.ts"],"names":[],"mappings":""}
|
50
VApp/node_modules/@rushstack/eslint-patch/lib/eslint-bulk-suppressions/cli/start.js
generated
vendored
Normal file
50
VApp/node_modules/@rushstack/eslint-patch/lib/eslint-bulk-suppressions/cli/start.js
generated
vendored
Normal file
@ -0,0 +1,50 @@
|
||||
"use strict";
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
|
||||
// See LICENSE in the project root for license information.
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const prune_1 = require("./prune");
|
||||
const suppress_1 = require("./suppress");
|
||||
const is_correct_cwd_1 = require("./utils/is-correct-cwd");
|
||||
const print_help_1 = require("./utils/print-help");
|
||||
if (process.argv.includes('-h') || process.argv.includes('-H') || process.argv.includes('--help')) {
|
||||
(0, print_help_1.printHelp)();
|
||||
process.exit(0);
|
||||
}
|
||||
if (process.argv.length < 3) {
|
||||
(0, print_help_1.printHelp)();
|
||||
process.exit(1);
|
||||
}
|
||||
if (!(0, is_correct_cwd_1.isCorrectCwd)(process.cwd())) {
|
||||
console.error('@rushstack/eslint-bulk: Please call this command from the directory that contains .eslintrc.js or .eslintrc.cjs');
|
||||
process.exit(1);
|
||||
}
|
||||
const subcommand = process.argv[2];
|
||||
if (subcommand === 'suppress') {
|
||||
try {
|
||||
(0, suppress_1.suppress)();
|
||||
}
|
||||
catch (e) {
|
||||
if (e instanceof Error) {
|
||||
console.error(e.message);
|
||||
process.exit(1);
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
else if (subcommand === 'prune') {
|
||||
try {
|
||||
(0, prune_1.prune)();
|
||||
}
|
||||
catch (e) {
|
||||
if (e instanceof Error) {
|
||||
console.error(e.message);
|
||||
process.exit(1);
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
else {
|
||||
console.error('@rushstack/eslint-bulk: Unknown subcommand: ' + subcommand);
|
||||
process.exit(1);
|
||||
}
|
||||
//# sourceMappingURL=start.js.map
|
1
VApp/node_modules/@rushstack/eslint-patch/lib/eslint-bulk-suppressions/cli/start.js.map
generated
vendored
Normal file
1
VApp/node_modules/@rushstack/eslint-patch/lib/eslint-bulk-suppressions/cli/start.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"start.js","sourceRoot":"","sources":["../../../src/eslint-bulk-suppressions/cli/start.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;AAE3D,mCAAgC;AAChC,yCAAsC;AACtC,2DAAsD;AACtD,mDAA+C;AAE/C,IAAI,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;IAClG,IAAA,sBAAS,GAAE,CAAC;IACZ,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC;AAED,IAAI,OAAO,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;IAC5B,IAAA,sBAAS,GAAE,CAAC;IACZ,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC;AAED,IAAI,CAAC,IAAA,6BAAY,EAAC,OAAO,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC;IACjC,OAAO,CAAC,KAAK,CACX,iHAAiH,CAClH,CAAC;IACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC;AACD,MAAM,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAEnC,IAAI,UAAU,KAAK,UAAU,EAAE,CAAC;IAC9B,IAAI,CAAC;QACH,IAAA,mBAAQ,GAAE,CAAC;IACb,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,IAAI,CAAC,YAAY,KAAK,EAAE,CAAC;YACvB,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;YACzB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;QACD,MAAM,CAAC,CAAC;IACV,CAAC;AACH,CAAC;KAAM,IAAI,UAAU,KAAK,OAAO,EAAE,CAAC;IAClC,IAAI,CAAC;QACH,IAAA,aAAK,GAAE,CAAC;IACV,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,IAAI,CAAC,YAAY,KAAK,EAAE,CAAC;YACvB,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;YACzB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;QACD,MAAM,CAAC,CAAC;IACV,CAAC;AACH,CAAC;KAAM,CAAC;IACN,OAAO,CAAC,KAAK,CAAC,8CAA8C,GAAG,UAAU,CAAC,CAAC;IAC3E,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport { prune } from './prune';\nimport { suppress } from './suppress';\nimport { isCorrectCwd } from './utils/is-correct-cwd';\nimport { printHelp } from './utils/print-help';\n\nif (process.argv.includes('-h') || process.argv.includes('-H') || process.argv.includes('--help')) {\n printHelp();\n process.exit(0);\n}\n\nif (process.argv.length < 3) {\n printHelp();\n process.exit(1);\n}\n\nif (!isCorrectCwd(process.cwd())) {\n console.error(\n '@rushstack/eslint-bulk: Please call this command from the directory that contains .eslintrc.js or .eslintrc.cjs'\n );\n process.exit(1);\n}\nconst subcommand = process.argv[2];\n\nif (subcommand === 'suppress') {\n try {\n suppress();\n } catch (e) {\n if (e instanceof Error) {\n console.error(e.message);\n process.exit(1);\n }\n throw e;\n }\n} else if (subcommand === 'prune') {\n try {\n prune();\n } catch (e) {\n if (e instanceof Error) {\n console.error(e.message);\n process.exit(1);\n }\n throw e;\n }\n} else {\n console.error('@rushstack/eslint-bulk: Unknown subcommand: ' + subcommand);\n process.exit(1);\n}\n"]}
|
2
VApp/node_modules/@rushstack/eslint-patch/lib/eslint-bulk-suppressions/cli/suppress.d.ts
generated
vendored
Normal file
2
VApp/node_modules/@rushstack/eslint-patch/lib/eslint-bulk-suppressions/cli/suppress.d.ts
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
export declare function suppress(): void;
|
||||
//# sourceMappingURL=suppress.d.ts.map
|
1
VApp/node_modules/@rushstack/eslint-patch/lib/eslint-bulk-suppressions/cli/suppress.d.ts.map
generated
vendored
Normal file
1
VApp/node_modules/@rushstack/eslint-patch/lib/eslint-bulk-suppressions/cli/suppress.d.ts.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"suppress.d.ts","sourceRoot":"","sources":["../../../src/eslint-bulk-suppressions/cli/suppress.ts"],"names":[],"mappings":"AAOA,wBAAgB,QAAQ,SA4FvB"}
|
76
VApp/node_modules/@rushstack/eslint-patch/lib/eslint-bulk-suppressions/cli/suppress.js
generated
vendored
Normal file
76
VApp/node_modules/@rushstack/eslint-patch/lib/eslint-bulk-suppressions/cli/suppress.js
generated
vendored
Normal file
@ -0,0 +1,76 @@
|
||||
"use strict";
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
|
||||
// See LICENSE in the project root for license information.
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.suppress = void 0;
|
||||
const child_process_1 = require("child_process");
|
||||
const get_eslint_cli_1 = require("./utils/get-eslint-cli");
|
||||
const print_help_1 = require("./utils/print-help");
|
||||
function suppress() {
|
||||
const args = process.argv.slice(3);
|
||||
if (args.includes('--help') || args.includes('-h')) {
|
||||
(0, print_help_1.printSuppressHelp)();
|
||||
process.exit(0);
|
||||
}
|
||||
// Use reduce to create an object with all the parsed arguments
|
||||
const parsedArgs = args.reduce((acc, arg, index, arr) => {
|
||||
if (arg === '--rule') {
|
||||
// continue because next arg should be the rule
|
||||
}
|
||||
else if (index > 0 && arr[index - 1] === '--rule' && arr[index + 1]) {
|
||||
acc.rules.push(arg);
|
||||
}
|
||||
else if (arg === '--all') {
|
||||
acc.all = true;
|
||||
}
|
||||
else if (arg.startsWith('--')) {
|
||||
throw new Error(`@rushstack/eslint-bulk: Unknown option: ${arg}`);
|
||||
}
|
||||
else {
|
||||
acc.files.push(arg);
|
||||
}
|
||||
return acc;
|
||||
}, { rules: [], all: false, files: [] });
|
||||
if (parsedArgs.files.length === 0) {
|
||||
throw new Error('@rushstack/eslint-bulk: Files argument is required. Use glob patterns to specify files or use `.` to suppress all files for the specified rules.');
|
||||
}
|
||||
if (parsedArgs.rules.length === 0 && !parsedArgs.all) {
|
||||
throw new Error('@rushstack/eslint-bulk: Please specify at least one rule to suppress. Use --all to suppress all rules.');
|
||||
}
|
||||
const eslintCLI = (0, get_eslint_cli_1.getEslintCli)(process.cwd());
|
||||
// Find the index of the last argument that starts with '--'
|
||||
const lastOptionIndex = args
|
||||
.map((arg, i) => (arg.startsWith('--') ? i : -1))
|
||||
.reduce((lastIndex, currentIndex) => Math.max(lastIndex, currentIndex), -1);
|
||||
// Check if options come before files
|
||||
if (parsedArgs.files.some((file) => args.indexOf(file) < lastOptionIndex)) {
|
||||
throw new Error('@rushstack/eslint-bulk: Unable to parse command line arguments. All options should come before files argument.');
|
||||
}
|
||||
const env = Object.assign({}, process.env);
|
||||
if (parsedArgs.all) {
|
||||
env.ESLINT_BULK_SUPPRESS = '*';
|
||||
}
|
||||
else if (parsedArgs.rules.length > 0) {
|
||||
env.ESLINT_BULK_SUPPRESS = parsedArgs.rules.join(',');
|
||||
}
|
||||
(0, child_process_1.exec)(`${eslintCLI} ${parsedArgs.files.join(' ')} --format=json`, { env }, (error, stdout, stderr) => {
|
||||
// if errorCount != 0, ESLint will process.exit(1) giving the false impression
|
||||
// that the exec failed, even though linting errors are to be expected
|
||||
const eslintOutputWithErrorRegex = /"errorCount":(?!0)\d+/;
|
||||
const isEslintError = error !== null && error.code === 1 && eslintOutputWithErrorRegex.test(stdout);
|
||||
if (error && !isEslintError) {
|
||||
throw new Error(`@rushstack/eslint-bulk execution error: ${error.message}`);
|
||||
}
|
||||
if (stderr) {
|
||||
throw new Error(`@rushstack/eslint-bulk ESLint errors: ${stderr}`);
|
||||
}
|
||||
if (parsedArgs.all) {
|
||||
console.log(`@rushstack/eslint-bulk: Successfully suppressed all rules for file(s) ${parsedArgs.files}`);
|
||||
}
|
||||
else if (parsedArgs.rules.length > 0) {
|
||||
console.log(`@rushstack/eslint-bulk: Successfully suppressed rules ${parsedArgs.rules} for file(s) ${parsedArgs.files}`);
|
||||
}
|
||||
});
|
||||
}
|
||||
exports.suppress = suppress;
|
||||
//# sourceMappingURL=suppress.js.map
|
1
VApp/node_modules/@rushstack/eslint-patch/lib/eslint-bulk-suppressions/cli/suppress.js.map
generated
vendored
Normal file
1
VApp/node_modules/@rushstack/eslint-patch/lib/eslint-bulk-suppressions/cli/suppress.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
2
VApp/node_modules/@rushstack/eslint-patch/lib/eslint-bulk-suppressions/cli/utils/get-eslint-cli.d.ts
generated
vendored
Normal file
2
VApp/node_modules/@rushstack/eslint-patch/lib/eslint-bulk-suppressions/cli/utils/get-eslint-cli.d.ts
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
export declare function getEslintCli(packagePath: string): string;
|
||||
//# sourceMappingURL=get-eslint-cli.d.ts.map
|
1
VApp/node_modules/@rushstack/eslint-patch/lib/eslint-bulk-suppressions/cli/utils/get-eslint-cli.d.ts.map
generated
vendored
Normal file
1
VApp/node_modules/@rushstack/eslint-patch/lib/eslint-bulk-suppressions/cli/utils/get-eslint-cli.d.ts.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"get-eslint-cli.d.ts","sourceRoot":"","sources":["../../../../src/eslint-bulk-suppressions/cli/utils/get-eslint-cli.ts"],"names":[],"mappings":"AAOA,wBAAgB,YAAY,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAqBxD"}
|
30
VApp/node_modules/@rushstack/eslint-patch/lib/eslint-bulk-suppressions/cli/utils/get-eslint-cli.js
generated
vendored
Normal file
30
VApp/node_modules/@rushstack/eslint-patch/lib/eslint-bulk-suppressions/cli/utils/get-eslint-cli.js
generated
vendored
Normal file
@ -0,0 +1,30 @@
|
||||
"use strict";
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
|
||||
// See LICENSE in the project root for license information.
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.getEslintCli = void 0;
|
||||
const path_1 = __importDefault(require("path"));
|
||||
const TESTED_VERSIONS = ['8.6.0', '8.7.0', '8.21.0', '8.22.0', '8.23.0', '8.23.1'];
|
||||
function getEslintCli(packagePath) {
|
||||
// Try to find a local ESLint installation, the one that should be listed as a dev dependency in package.json
|
||||
// and installed in node_modules
|
||||
try {
|
||||
const localEslintApiPath = require.resolve('eslint', { paths: [packagePath] });
|
||||
const localEslintPath = path_1.default.dirname(path_1.default.dirname(localEslintApiPath));
|
||||
const eslintPackageJson = require(path_1.default.join(localEslintPath, 'package.json'));
|
||||
const localEslintVersion = eslintPackageJson.version;
|
||||
const eslintExecutable = path_1.default.join(localEslintPath, 'bin', 'eslint.js');
|
||||
if (!TESTED_VERSIONS.includes(localEslintVersion)) {
|
||||
console.warn('@rushstack/eslint-bulk: Be careful, the installed ESLint version has not been tested with eslint-bulk.');
|
||||
}
|
||||
return `node ${eslintExecutable}`;
|
||||
}
|
||||
catch (e) {
|
||||
throw new Error('@rushstack/eslint-bulk: eslint is specified as a dev dependency in package.json, but eslint-bulk cannot find it in node_modules.');
|
||||
}
|
||||
}
|
||||
exports.getEslintCli = getEslintCli;
|
||||
//# sourceMappingURL=get-eslint-cli.js.map
|
1
VApp/node_modules/@rushstack/eslint-patch/lib/eslint-bulk-suppressions/cli/utils/get-eslint-cli.js.map
generated
vendored
Normal file
1
VApp/node_modules/@rushstack/eslint-patch/lib/eslint-bulk-suppressions/cli/utils/get-eslint-cli.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"get-eslint-cli.js","sourceRoot":"","sources":["../../../../src/eslint-bulk-suppressions/cli/utils/get-eslint-cli.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;AAE3D,gDAAwB;AAExB,MAAM,eAAe,GAAG,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;AAEnF,SAAgB,YAAY,CAAC,WAAmB;IAC9C,6GAA6G;IAC7G,gCAAgC;IAChC,IAAI,CAAC;QACH,MAAM,kBAAkB,GAAG,OAAO,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,KAAK,EAAE,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;QAC/E,MAAM,eAAe,GAAG,cAAI,CAAC,OAAO,CAAC,cAAI,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC,CAAC;QACvE,MAAM,iBAAiB,GAAG,OAAO,CAAC,cAAI,CAAC,IAAI,CAAC,eAAe,EAAE,cAAc,CAAC,CAAC,CAAC;QAC9E,MAAM,kBAAkB,GAAG,iBAAiB,CAAC,OAAO,CAAC;QACrD,MAAM,gBAAgB,GAAG,cAAI,CAAC,IAAI,CAAC,eAAe,EAAE,KAAK,EAAE,WAAW,CAAC,CAAC;QAExE,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,kBAAkB,CAAC,EAAE,CAAC;YAClD,OAAO,CAAC,IAAI,CACV,wGAAwG,CACzG,CAAC;QACJ,CAAC;QACD,OAAO,QAAQ,gBAAgB,EAAE,CAAC;IACpC,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,MAAM,IAAI,KAAK,CACb,kIAAkI,CACnI,CAAC;IACJ,CAAC;AACH,CAAC;AArBD,oCAqBC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport path from 'path';\n\nconst TESTED_VERSIONS = ['8.6.0', '8.7.0', '8.21.0', '8.22.0', '8.23.0', '8.23.1'];\n\nexport function getEslintCli(packagePath: string): string {\n // Try to find a local ESLint installation, the one that should be listed as a dev dependency in package.json\n // and installed in node_modules\n try {\n const localEslintApiPath = require.resolve('eslint', { paths: [packagePath] });\n const localEslintPath = path.dirname(path.dirname(localEslintApiPath));\n const eslintPackageJson = require(path.join(localEslintPath, 'package.json'));\n const localEslintVersion = eslintPackageJson.version;\n const eslintExecutable = path.join(localEslintPath, 'bin', 'eslint.js');\n\n if (!TESTED_VERSIONS.includes(localEslintVersion)) {\n console.warn(\n '@rushstack/eslint-bulk: Be careful, the installed ESLint version has not been tested with eslint-bulk.'\n );\n }\n return `node ${eslintExecutable}`;\n } catch (e) {\n throw new Error(\n '@rushstack/eslint-bulk: eslint is specified as a dev dependency in package.json, but eslint-bulk cannot find it in node_modules.'\n );\n }\n}\n"]}
|
2
VApp/node_modules/@rushstack/eslint-patch/lib/eslint-bulk-suppressions/cli/utils/is-correct-cwd.d.ts
generated
vendored
Normal file
2
VApp/node_modules/@rushstack/eslint-patch/lib/eslint-bulk-suppressions/cli/utils/is-correct-cwd.d.ts
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
export declare function isCorrectCwd(cwd: string): boolean;
|
||||
//# sourceMappingURL=is-correct-cwd.d.ts.map
|
1
VApp/node_modules/@rushstack/eslint-patch/lib/eslint-bulk-suppressions/cli/utils/is-correct-cwd.d.ts.map
generated
vendored
Normal file
1
VApp/node_modules/@rushstack/eslint-patch/lib/eslint-bulk-suppressions/cli/utils/is-correct-cwd.d.ts.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"is-correct-cwd.d.ts","sourceRoot":"","sources":["../../../../src/eslint-bulk-suppressions/cli/utils/is-correct-cwd.ts"],"names":[],"mappings":"AAMA,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAEjD"}
|
15
VApp/node_modules/@rushstack/eslint-patch/lib/eslint-bulk-suppressions/cli/utils/is-correct-cwd.js
generated
vendored
Normal file
15
VApp/node_modules/@rushstack/eslint-patch/lib/eslint-bulk-suppressions/cli/utils/is-correct-cwd.js
generated
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
"use strict";
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
|
||||
// See LICENSE in the project root for license information.
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.isCorrectCwd = void 0;
|
||||
const fs_1 = __importDefault(require("fs"));
|
||||
const path_1 = __importDefault(require("path"));
|
||||
function isCorrectCwd(cwd) {
|
||||
return fs_1.default.existsSync(path_1.default.join(cwd, '.eslintrc.js')) || fs_1.default.existsSync(path_1.default.join(cwd, '.eslintrc.cjs'));
|
||||
}
|
||||
exports.isCorrectCwd = isCorrectCwd;
|
||||
//# sourceMappingURL=is-correct-cwd.js.map
|
1
VApp/node_modules/@rushstack/eslint-patch/lib/eslint-bulk-suppressions/cli/utils/is-correct-cwd.js.map
generated
vendored
Normal file
1
VApp/node_modules/@rushstack/eslint-patch/lib/eslint-bulk-suppressions/cli/utils/is-correct-cwd.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"is-correct-cwd.js","sourceRoot":"","sources":["../../../../src/eslint-bulk-suppressions/cli/utils/is-correct-cwd.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;AAE3D,4CAAoB;AACpB,gDAAwB;AAExB,SAAgB,YAAY,CAAC,GAAW;IACtC,OAAO,YAAE,CAAC,UAAU,CAAC,cAAI,CAAC,IAAI,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC,IAAI,YAAE,CAAC,UAAU,CAAC,cAAI,CAAC,IAAI,CAAC,GAAG,EAAE,eAAe,CAAC,CAAC,CAAC;AACzG,CAAC;AAFD,oCAEC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport fs from 'fs';\nimport path from 'path';\n\nexport function isCorrectCwd(cwd: string): boolean {\n return fs.existsSync(path.join(cwd, '.eslintrc.js')) || fs.existsSync(path.join(cwd, '.eslintrc.cjs'));\n}\n"]}
|
4
VApp/node_modules/@rushstack/eslint-patch/lib/eslint-bulk-suppressions/cli/utils/print-help.d.ts
generated
vendored
Normal file
4
VApp/node_modules/@rushstack/eslint-patch/lib/eslint-bulk-suppressions/cli/utils/print-help.d.ts
generated
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
export declare function printPruneHelp(): void;
|
||||
export declare function printHelp(): void;
|
||||
export declare function printSuppressHelp(): void;
|
||||
//# sourceMappingURL=print-help.d.ts.map
|
1
VApp/node_modules/@rushstack/eslint-patch/lib/eslint-bulk-suppressions/cli/utils/print-help.d.ts.map
generated
vendored
Normal file
1
VApp/node_modules/@rushstack/eslint-patch/lib/eslint-bulk-suppressions/cli/utils/print-help.d.ts.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"print-help.d.ts","sourceRoot":"","sources":["../../../../src/eslint-bulk-suppressions/cli/utils/print-help.ts"],"names":[],"mappings":"AAKA,wBAAgB,cAAc,SAa7B;AAED,wBAAgB,SAAS,SA8BxB;AAED,wBAAgB,iBAAiB,SA6BhC"}
|
82
VApp/node_modules/@rushstack/eslint-patch/lib/eslint-bulk-suppressions/cli/utils/print-help.js
generated
vendored
Normal file
82
VApp/node_modules/@rushstack/eslint-patch/lib/eslint-bulk-suppressions/cli/utils/print-help.js
generated
vendored
Normal file
@ -0,0 +1,82 @@
|
||||
"use strict";
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
|
||||
// See LICENSE in the project root for license information.
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.printSuppressHelp = exports.printHelp = exports.printPruneHelp = void 0;
|
||||
const wrap_words_to_lines_1 = require("./wrap-words-to-lines");
|
||||
function printPruneHelp() {
|
||||
const help = `eslint-bulk prune
|
||||
|
||||
Usage:
|
||||
|
||||
eslint-bulk prune
|
||||
|
||||
This command is a thin wrapper around ESLint that communicates with @rushstack/eslint-patch to delete all unused suppression entries in all .eslint-bulk-suppressions.json files under the current working directory.`;
|
||||
const wrapped = (0, wrap_words_to_lines_1.wrapWordsToLines)(help);
|
||||
for (const line of wrapped) {
|
||||
console.log(line);
|
||||
}
|
||||
}
|
||||
exports.printPruneHelp = printPruneHelp;
|
||||
function printHelp() {
|
||||
const help = `eslint-bulk <command>
|
||||
|
||||
Usage:
|
||||
|
||||
eslint-bulk suppress --rule RULENAME1 [--rule RULENAME2...] PATH1 [PATH2...]
|
||||
eslint-bulk suppress --all PATH1 [PATH2...]
|
||||
eslint-bulk suppress --help
|
||||
|
||||
eslint-bulk prune
|
||||
eslint-bulk prune --help
|
||||
|
||||
eslint-bulk --help
|
||||
|
||||
This command line tool is a thin wrapper around ESLint that communicates with @rushstack/eslint-patch to suppress or prune unused suppressions in the local .eslint-bulk-suppressions.json file.
|
||||
|
||||
Commands:
|
||||
eslint-bulk suppress [options] <path...>
|
||||
Use this command to generate a new .eslint-bulk-suppressions.json file or add suppression entries to the existing file. Specify the files and rules you want to suppress.
|
||||
Please run "eslint-bulk suppress --help" to learn more.
|
||||
|
||||
eslint-bulk prune
|
||||
Use this command to delete all unused suppression entries in all .eslint-bulk-suppressions.json files under the current working directory.
|
||||
Please run "eslint-bulk prune --help" to learn more.
|
||||
`;
|
||||
const wrapped = (0, wrap_words_to_lines_1.wrapWordsToLines)(help);
|
||||
for (const line of wrapped) {
|
||||
console.log(line);
|
||||
}
|
||||
}
|
||||
exports.printHelp = printHelp;
|
||||
function printSuppressHelp() {
|
||||
const help = `eslint-bulk suppress [options] <path...>
|
||||
|
||||
Usage:
|
||||
|
||||
eslint-bulk suppress --rule RULENAME1 [--rule RULENAME2...] PATH1 [PATH2...]
|
||||
eslint-bulk suppress --all PATH1 [PATH2...]
|
||||
eslint-bulk suppress --help
|
||||
|
||||
This command is a thin wrapper around ESLint that communicates with @rushstack/eslint-patch to either generate a new .eslint-bulk-suppressions.json file or add suppression entries to the existing file. Specify the files and rules you want to suppress.
|
||||
|
||||
Argument:
|
||||
<path...>
|
||||
Glob patterns for paths to suppress, same as eslint files argument. Should be relative to the project root.
|
||||
|
||||
Options:
|
||||
-h, -H, --help
|
||||
Display this help message.
|
||||
|
||||
-R, --rule
|
||||
The full name of the ESLint rule you want to bulk-suppress. Specify multiple rules with --rule NAME1 --rule RULENAME2.
|
||||
|
||||
-A, --all
|
||||
Bulk-suppress all rules in the specified file patterns.`;
|
||||
const wrapped = (0, wrap_words_to_lines_1.wrapWordsToLines)(help);
|
||||
for (const line of wrapped) {
|
||||
console.log(line);
|
||||
}
|
||||
}
|
||||
exports.printSuppressHelp = printSuppressHelp;
|
||||
//# sourceMappingURL=print-help.js.map
|
1
VApp/node_modules/@rushstack/eslint-patch/lib/eslint-bulk-suppressions/cli/utils/print-help.js.map
generated
vendored
Normal file
1
VApp/node_modules/@rushstack/eslint-patch/lib/eslint-bulk-suppressions/cli/utils/print-help.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"print-help.js","sourceRoot":"","sources":["../../../../src/eslint-bulk-suppressions/cli/utils/print-help.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAE3D,+DAAyD;AAEzD,SAAgB,cAAc;IAC5B,MAAM,IAAI,GAAG;;;;;;sNAMuM,CAAC;IAErN,MAAM,OAAO,GAAG,IAAA,sCAAgB,EAAC,IAAI,CAAC,CAAC;IACvC,KAAK,MAAM,IAAI,IAAI,OAAO,EAAE,CAAC;QAC3B,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACpB,CAAC;AACH,CAAC;AAbD,wCAaC;AAED,SAAgB,SAAS;IACvB,MAAM,IAAI,GAAG;;;;;;;;;;;;;;;;;;;;;;;CAuBd,CAAC;IAEA,MAAM,OAAO,GAAG,IAAA,sCAAgB,EAAC,IAAI,CAAC,CAAC;IACvC,KAAK,MAAM,IAAI,IAAI,OAAO,EAAE,CAAC;QAC3B,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACpB,CAAC;AACH,CAAC;AA9BD,8BA8BC;AAED,SAAgB,iBAAiB;IAC/B,MAAM,IAAI,GAAG;;;;;;;;;;;;;;;;;;;;;;4DAsB6C,CAAC;IAE3D,MAAM,OAAO,GAAG,IAAA,sCAAgB,EAAC,IAAI,CAAC,CAAC;IACvC,KAAK,MAAM,IAAI,IAAI,OAAO,EAAE,CAAC;QAC3B,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACpB,CAAC;AACH,CAAC;AA7BD,8CA6BC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport { wrapWordsToLines } from './wrap-words-to-lines';\n\nexport function printPruneHelp() {\n const help = `eslint-bulk prune\n\nUsage:\n\neslint-bulk prune\n\nThis command is a thin wrapper around ESLint that communicates with @rushstack/eslint-patch to delete all unused suppression entries in all .eslint-bulk-suppressions.json files under the current working directory.`;\n\n const wrapped = wrapWordsToLines(help);\n for (const line of wrapped) {\n console.log(line);\n }\n}\n\nexport function printHelp() {\n const help = `eslint-bulk <command>\n\nUsage:\n\neslint-bulk suppress --rule RULENAME1 [--rule RULENAME2...] PATH1 [PATH2...]\neslint-bulk suppress --all PATH1 [PATH2...]\neslint-bulk suppress --help\n\neslint-bulk prune\neslint-bulk prune --help\n\neslint-bulk --help\n\nThis command line tool is a thin wrapper around ESLint that communicates with @rushstack/eslint-patch to suppress or prune unused suppressions in the local .eslint-bulk-suppressions.json file.\n\nCommands:\n eslint-bulk suppress [options] <path...>\n Use this command to generate a new .eslint-bulk-suppressions.json file or add suppression entries to the existing file. Specify the files and rules you want to suppress.\n Please run \"eslint-bulk suppress --help\" to learn more.\n\n eslint-bulk prune\n Use this command to delete all unused suppression entries in all .eslint-bulk-suppressions.json files under the current working directory.\n Please run \"eslint-bulk prune --help\" to learn more.\n`;\n\n const wrapped = wrapWordsToLines(help);\n for (const line of wrapped) {\n console.log(line);\n }\n}\n\nexport function printSuppressHelp() {\n const help = `eslint-bulk suppress [options] <path...>\n\nUsage:\n\neslint-bulk suppress --rule RULENAME1 [--rule RULENAME2...] PATH1 [PATH2...]\neslint-bulk suppress --all PATH1 [PATH2...]\neslint-bulk suppress --help\n\nThis command is a thin wrapper around ESLint that communicates with @rushstack/eslint-patch to either generate a new .eslint-bulk-suppressions.json file or add suppression entries to the existing file. Specify the files and rules you want to suppress.\n\nArgument:\n <path...>\n Glob patterns for paths to suppress, same as eslint files argument. Should be relative to the project root.\n\nOptions:\n -h, -H, --help\n Display this help message.\n\n -R, --rule\n The full name of the ESLint rule you want to bulk-suppress. Specify multiple rules with --rule NAME1 --rule RULENAME2.\n\n -A, --all\n Bulk-suppress all rules in the specified file patterns.`;\n\n const wrapped = wrapWordsToLines(help);\n for (const line of wrapped) {\n console.log(line);\n }\n}\n"]}
|
26
VApp/node_modules/@rushstack/eslint-patch/lib/eslint-bulk-suppressions/cli/utils/wrap-words-to-lines.d.ts
generated
vendored
Normal file
26
VApp/node_modules/@rushstack/eslint-patch/lib/eslint-bulk-suppressions/cli/utils/wrap-words-to-lines.d.ts
generated
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
/**
|
||||
* Applies word wrapping and returns an array of lines.
|
||||
*
|
||||
* @param text - The text to wrap
|
||||
* @param maxLineLength - The maximum length of a line, defaults to the console width
|
||||
* @param indent - The number of spaces to indent the wrapped lines, defaults to 0
|
||||
*/
|
||||
export declare function wrapWordsToLines(text: string, maxLineLength?: number, indent?: number): string[];
|
||||
/**
|
||||
* Applies word wrapping and returns an array of lines.
|
||||
*
|
||||
* @param text - The text to wrap
|
||||
* @param maxLineLength - The maximum length of a line, defaults to the console width
|
||||
* @param linePrefix - The string to prefix each line with, defaults to ''
|
||||
*/
|
||||
export declare function wrapWordsToLines(text: string, maxLineLength?: number, linePrefix?: string): string[];
|
||||
/**
|
||||
* Applies word wrapping and returns an array of lines.
|
||||
*
|
||||
* @param text - The text to wrap
|
||||
* @param maxLineLength - The maximum length of a line, defaults to the console width
|
||||
* @param indentOrLinePrefix - The number of spaces to indent the wrapped lines or the string to prefix
|
||||
* each line with, defaults to no prefix
|
||||
*/
|
||||
export declare function wrapWordsToLines(text: string, maxLineLength?: number, indentOrLinePrefix?: number | string): string[];
|
||||
//# sourceMappingURL=wrap-words-to-lines.d.ts.map
|
1
VApp/node_modules/@rushstack/eslint-patch/lib/eslint-bulk-suppressions/cli/utils/wrap-words-to-lines.d.ts.map
generated
vendored
Normal file
1
VApp/node_modules/@rushstack/eslint-patch/lib/eslint-bulk-suppressions/cli/utils/wrap-words-to-lines.d.ts.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"wrap-words-to-lines.d.ts","sourceRoot":"","sources":["../../../../src/eslint-bulk-suppressions/cli/utils/wrap-words-to-lines.ts"],"names":[],"mappings":"AAWA;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,aAAa,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;AAClG;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,aAAa,CAAC,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;AACtG;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,MAAM,EACZ,aAAa,CAAC,EAAE,MAAM,EACtB,kBAAkB,CAAC,EAAE,MAAM,GAAG,MAAM,GACnC,MAAM,EAAE,CAAC"}
|
69
VApp/node_modules/@rushstack/eslint-patch/lib/eslint-bulk-suppressions/cli/utils/wrap-words-to-lines.js
generated
vendored
Normal file
69
VApp/node_modules/@rushstack/eslint-patch/lib/eslint-bulk-suppressions/cli/utils/wrap-words-to-lines.js
generated
vendored
Normal file
@ -0,0 +1,69 @@
|
||||
"use strict";
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
|
||||
// See LICENSE in the project root for license information.
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.wrapWordsToLines = void 0;
|
||||
function wrapWordsToLines(text, maxLineLength, indentOrLinePrefix) {
|
||||
var _a;
|
||||
let linePrefix;
|
||||
switch (typeof indentOrLinePrefix) {
|
||||
case 'number':
|
||||
linePrefix = ' '.repeat(indentOrLinePrefix);
|
||||
break;
|
||||
case 'string':
|
||||
linePrefix = indentOrLinePrefix;
|
||||
break;
|
||||
default:
|
||||
linePrefix = '';
|
||||
break;
|
||||
}
|
||||
const linePrefixLength = linePrefix.length;
|
||||
if (!maxLineLength) {
|
||||
maxLineLength = process.stdout.getWindowSize()[0];
|
||||
}
|
||||
// Apply word wrapping and the provided line prefix, while also respecting existing newlines
|
||||
// and prefix spaces that may exist in the text string already.
|
||||
const lines = text.split(/\r?\n/);
|
||||
const wrappedLines = [];
|
||||
for (const line of lines) {
|
||||
if (line.length + linePrefixLength <= maxLineLength) {
|
||||
wrappedLines.push(linePrefix + line);
|
||||
}
|
||||
else {
|
||||
const lineAdditionalPrefix = ((_a = line.match(/^\s*/)) === null || _a === void 0 ? void 0 : _a[0]) || '';
|
||||
const whitespaceRegexp = /\s+/g;
|
||||
let currentWhitespaceMatch = null;
|
||||
let previousWhitespaceMatch;
|
||||
let currentLineStartIndex = lineAdditionalPrefix.length;
|
||||
let previousBreakRanOver = false;
|
||||
while ((currentWhitespaceMatch = whitespaceRegexp.exec(line)) !== null) {
|
||||
if (currentWhitespaceMatch.index + linePrefixLength - currentLineStartIndex > maxLineLength) {
|
||||
let whitespaceToSplitAt;
|
||||
if (!previousWhitespaceMatch ||
|
||||
// Handle the case where there are two words longer than the maxLineLength in a row
|
||||
previousBreakRanOver) {
|
||||
whitespaceToSplitAt = currentWhitespaceMatch;
|
||||
}
|
||||
else {
|
||||
whitespaceToSplitAt = previousWhitespaceMatch;
|
||||
}
|
||||
wrappedLines.push(linePrefix +
|
||||
lineAdditionalPrefix +
|
||||
line.substring(currentLineStartIndex, whitespaceToSplitAt.index));
|
||||
previousBreakRanOver = whitespaceToSplitAt.index - currentLineStartIndex > maxLineLength;
|
||||
currentLineStartIndex = whitespaceToSplitAt.index + whitespaceToSplitAt[0].length;
|
||||
}
|
||||
else {
|
||||
previousBreakRanOver = false;
|
||||
}
|
||||
previousWhitespaceMatch = currentWhitespaceMatch;
|
||||
}
|
||||
if (currentLineStartIndex < line.length) {
|
||||
wrappedLines.push(linePrefix + lineAdditionalPrefix + line.substring(currentLineStartIndex));
|
||||
}
|
||||
}
|
||||
}
|
||||
return wrappedLines;
|
||||
}
|
||||
exports.wrapWordsToLines = wrapWordsToLines;
|
||||
//# sourceMappingURL=wrap-words-to-lines.js.map
|
1
VApp/node_modules/@rushstack/eslint-patch/lib/eslint-bulk-suppressions/cli/utils/wrap-words-to-lines.js.map
generated
vendored
Normal file
1
VApp/node_modules/@rushstack/eslint-patch/lib/eslint-bulk-suppressions/cli/utils/wrap-words-to-lines.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user