@nx-plugins/linter
Version:
The Nx Plugin for Linter that contains executors, generators, and utilities to use powerful Eslint capabilities.
35 lines • 1.55 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.eslintVueProject = exports.eslintVueProjectGenerator = void 0;
const tslib_1 = require("tslib");
const devkit_1 = require("@nrwl/devkit");
const linter_1 = require("@nrwl/linter");
const add_linter_1 = require("./lib/add-linter");
const schemaDefaults = {
skipFormat: false,
linter: linter_1.Linter.EsLint,
setParserOptionsProject: false,
unitTestRunner: 'vitest',
};
function normalizeOptions(tree, options) {
const project = (0, devkit_1.getProjects)(tree).get(options.project);
if (!project) {
devkit_1.logger.error(`Cannot find the ${options.project} project. Please double check the project name.`);
throw new Error();
}
return Object.assign(Object.assign(Object.assign({}, schemaDefaults), options), { projectRoot: project.root, projectType: project.projectType });
}
function eslintVueProjectGenerator(tree, schema) {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
const options = normalizeOptions(tree, schema);
const addLint = yield (0, add_linter_1.addLinter)(tree, options);
if (!schema.skipFormat) {
yield (0, devkit_1.formatFiles)(tree);
}
return addLint;
});
}
exports.eslintVueProjectGenerator = eslintVueProjectGenerator;
exports.default = eslintVueProjectGenerator;
exports.eslintVueProject = (0, devkit_1.convertNxGenerator)(eslintVueProjectGenerator);
//# sourceMappingURL=generator.js.map