source: frontend/node_modules/@rushstack/eslint-patch/lib-commonjs/eslint-bulk-suppressions/cli/utils/get-eslint-cli.js

Last change on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 2 weeks ago

Fix frontend appearance

  • Property mode set to 100644
File size: 2.7 KB
Line 
1"use strict";
2// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
3// See LICENSE in the project root for license information.
4var __importDefault = (this && this.__importDefault) || function (mod) {
5 return (mod && mod.__esModule) ? mod : { "default": mod };
6};
7Object.defineProperty(exports, "__esModule", { value: true });
8exports.getEslintPathAndVersion = getEslintPathAndVersion;
9const node_path_1 = __importDefault(require("node:path"));
10const constants_1 = require("../../constants");
11// When this list is updated, update the `eslint-bulk-suppressions-newest-test`
12// and/or the `eslint-bulk-suppressions-newest-test` projects' eslint dependencies.
13const TESTED_VERSIONS = new Set([
14 '8.6.0',
15 '8.7.0',
16 '8.21.0',
17 '8.22.0',
18 '8.23.0',
19 '8.23.1',
20 '8.57.0',
21 '9.25.1',
22 '9.37.0'
23]);
24function getEslintPathAndVersion(packagePath) {
25 // Try to find a local ESLint installation, the one that should be listed as a dev dependency in package.json
26 // and installed in node_modules
27 try {
28 const localEslintApiPath = require.resolve(constants_1.BULK_SUPPRESSIONS_CLI_ESLINT_PACKAGE_NAME, {
29 paths: [packagePath]
30 });
31 const localEslintPath = node_path_1.default.dirname(node_path_1.default.dirname(localEslintApiPath));
32 const { version: localEslintVersion } = require(`${localEslintPath}/package.json`);
33 if (!TESTED_VERSIONS.has(localEslintVersion)) {
34 console.warn('@rushstack/eslint-bulk: Be careful, the installed ESLint version has not been tested with eslint-bulk.');
35 }
36 return [localEslintApiPath, localEslintVersion];
37 }
38 catch (e1) {
39 try {
40 const { dependencies, devDependencies } = require(`${packagePath}/package.json`);
41 if (devDependencies === null || devDependencies === void 0 ? void 0 : devDependencies.eslint) {
42 throw new Error('@rushstack/eslint-bulk: eslint is specified as a dev dependency in package.json, ' +
43 'but eslint-bulk cannot find it in node_modules.');
44 }
45 else if (dependencies === null || dependencies === void 0 ? void 0 : dependencies.eslint) {
46 throw new Error('@rushstack/eslint-bulk: eslint is specified as a dependency in package.json, ' +
47 'but eslint-bulk cannot find it in node_modules.');
48 }
49 else {
50 throw new Error('@rushstack/eslint-bulk: eslint is not specified as a dependency in package.json.');
51 }
52 }
53 catch (e2) {
54 throw new Error("@rushstack/eslint-bulk: This command must be run in the same folder as a project's package.json file.");
55 }
56 }
57}
58//# sourceMappingURL=get-eslint-cli.js.map
Note: See TracBrowser for help on using the repository browser.