UNPKG

tslint-to-eslint-config

Version:

Converts your TSLint configuration to the closest reasonable ESLint equivalent.

40 lines 1.28 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.mergeIndent = void 0; const ESLINT_INDENT_DEFAULT = 4; const mergeIndent = (existingOptions, newOptions) => { if (existingOptions === undefined && newOptions === undefined) { return []; } // Resolve indent size let indentSize = ESLINT_INDENT_DEFAULT; // default for (const options of [existingOptions, newOptions]) { if (options === undefined || options.length === 0 || options[0] === ESLINT_INDENT_DEFAULT // ignore default ) { continue; } indentSize = options[0]; } // Resolve object option let objectOption = null; for (const options of [existingOptions, newOptions]) { if (options === undefined || options.length < 2 || options[1] === undefined) { continue; } objectOption = { ...(objectOption || {}), ...options[1], }; } if (indentSize === ESLINT_INDENT_DEFAULT && objectOption === null) { return []; } else if (objectOption === null) { return [indentSize]; } return [indentSize, objectOption]; }; exports.mergeIndent = mergeIndent; //# sourceMappingURL=indent.js.map