tslint-to-eslint-config
Version:
Converts your TSLint configuration to the closest reasonable ESLint equivalent.
20 lines • 1.04 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.createEnv = void 0;
const createEnv = ({ packages, typescript, }) => {
var _a, _b, _c, _d;
const browser = typescript === undefined ||
((_a = typescript.compilerOptions) === null || _a === void 0 ? void 0 : _a.lib) === undefined ||
typescript.compilerOptions.lib.includes("dom");
const es6 = typescript === undefined ||
!["es3", "es5"].includes((_d = (_c = (_b = typescript.compilerOptions) === null || _b === void 0 ? void 0 : _b.target) === null || _c === void 0 ? void 0 : _c.toLowerCase()) !== null && _d !== void 0 ? _d : "");
const node = packages === undefined ||
[...Object.keys(packages.dependencies), ...Object.keys(packages.devDependencies)].some((dependency) => dependency.toLowerCase() === "@types/node");
return {
...(browser && { browser }),
...(es6 && { es6 }),
...(node && { node }),
};
};
exports.createEnv = createEnv;
//# sourceMappingURL=createEnv.js.map