UNPKG

@angular-eslint/schematics

Version:
25 lines (23 loc) 1 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const schematics_1 = require("@angular-devkit/schematics"); const utils_1 = require("../utils"); function addESLintToProject(schema) { return (tree) => { const projectName = (0, utils_1.determineTargetProjectName)(tree, schema.project); if (!projectName) { throw new Error('\n' + ` Error: You must specify a project to add ESLint to because you have multiple projects in your angular.json E.g. npx ng g @angular-eslint/schematics:add-eslint-to-project {{YOUR_PROJECT_NAME_GOES_HERE}} `.trim()); } return (0, schematics_1.chain)([ // Set the lint builder and config in angular.json (0, utils_1.addESLintTargetToProject)(projectName, 'lint'), // Create the ESLint config file for the project (0, utils_1.createESLintConfigForProject)(projectName), ]); }; } exports.default = addESLintToProject;