UNPKG

tslint-to-eslint-config

Version:

Converts your TSLint configuration to the closest reasonable ESLint equivalent.

41 lines 1.8 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.extractGlobPaths = void 0; const minimatch_1 = __importDefault(require("minimatch")); const types_1 = require("../../types"); const utils_1 = require("../../utils"); const extractGlobPaths = async (dependencies, { exclude, include }) => { const [fileGlobErrors, globbedFilePaths] = (0, utils_1.separateErrors)(await Promise.all(include.map(dependencies.globAsync))); if (fileGlobErrors.length !== 0) { return { errors: fileGlobErrors, status: types_1.ResultStatus.Failed, }; } if (globbedFilePaths.join("") === "") { return { errors: [ new Error("--comments found no files. Consider passing no globs to it, to default to all TypeScript files."), ], status: types_1.ResultStatus.Failed, }; } const uniqueGlobbedFilePaths = (0, utils_1.uniqueFromSources)(...globbedFilePaths).filter((filePathGlob) => !(exclude === null || exclude === void 0 ? void 0 : exclude.some((exclusion) => (0, minimatch_1.default)(filePathGlob, exclusion)))); if (uniqueGlobbedFilePaths.join("") === "") { return { errors: [ new Error(`All files passed to --comments were excluded. Consider removing 'exclude' from your TypeScript configuration.`), ], status: types_1.ResultStatus.Failed, }; } return { data: uniqueGlobbedFilePaths, status: types_1.ResultStatus.Succeeded, }; }; exports.extractGlobPaths = extractGlobPaths; //# sourceMappingURL=extractGlobPaths.js.map