| 1 | // Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
|
|---|
| 2 | // See LICENSE in the project root for license information.
|
|---|
| 3 | import { eslintFolder, eslintPackageVersion } from '../_patch-base';
|
|---|
| 4 | import { findAndConsoleLogPatchPathCli, getPathToLinterJS, ensurePathToGeneratedPatch } from './path-utils';
|
|---|
| 5 | import { patchClass, extendVerifyFunction } from './bulk-suppressions-patch';
|
|---|
| 6 | import { generatePatchedLinterJsFileIfDoesNotExist } from './generate-patched-file';
|
|---|
| 7 | import { ESLINT_BULK_DETECT_ENV_VAR_NAME, ESLINT_BULK_PATCH_PATH_ENV_VAR_NAME } from './constants';
|
|---|
| 8 | if (!eslintFolder) {
|
|---|
| 9 | console.error('@rushstack/eslint-patch/eslint-bulk-suppressions: Could not find ESLint installation to patch.');
|
|---|
| 10 | process.exit(1);
|
|---|
| 11 | }
|
|---|
| 12 | const eslintBulkDetectEnvVarValue = process.env[ESLINT_BULK_DETECT_ENV_VAR_NAME];
|
|---|
| 13 | if (eslintBulkDetectEnvVarValue === 'true' || eslintBulkDetectEnvVarValue === '1') {
|
|---|
| 14 | findAndConsoleLogPatchPathCli();
|
|---|
| 15 | process.exit(0);
|
|---|
| 16 | }
|
|---|
| 17 | const pathToLinterJS = getPathToLinterJS();
|
|---|
| 18 | process.env[ESLINT_BULK_PATCH_PATH_ENV_VAR_NAME] = require.resolve('./bulk-suppressions-patch');
|
|---|
| 19 | const pathToGeneratedPatch = ensurePathToGeneratedPatch();
|
|---|
| 20 | generatePatchedLinterJsFileIfDoesNotExist(pathToLinterJS, pathToGeneratedPatch, eslintPackageVersion);
|
|---|
| 21 | const { Linter: LinterPatch } = require(pathToGeneratedPatch);
|
|---|
| 22 | LinterPatch.prototype.verify = extendVerifyFunction(LinterPatch.prototype.verify);
|
|---|
| 23 | const { Linter } = require(pathToLinterJS);
|
|---|
| 24 | patchClass(Linter, LinterPatch);
|
|---|
| 25 | //# sourceMappingURL=index.js.map |
|---|