@bmatei/eslint-builder-angular
Advanced tools
Comparing version 1.0.3 to 1.1.0
{ | ||
"name": "@bmatei/eslint-builder-angular", | ||
"version": "1.0.3", | ||
"version": "1.1.0", | ||
"description": "ESLint builder for Angular.", | ||
@@ -46,21 +46,21 @@ "keywords": [ | ||
"@angular-devkit/core": "9.1.0", | ||
"@bmatei/eslint-config": "1.0.21", | ||
"@semantic-release/changelog": "5.0.0", | ||
"@bmatei/eslint-config": "1.0.22", | ||
"@semantic-release/changelog": "5.0.1", | ||
"@semantic-release/git": "9.0.0", | ||
"@types/eslint": "6.1.8", | ||
"@types/eslint": "6.1.9", | ||
"@types/jest": "25.1.4", | ||
"@types/node": "13.9.3", | ||
"@typescript-eslint/eslint-plugin": "2.25.0", | ||
"@typescript-eslint/parser": "2.25.0", | ||
"@types/node": "13.9.8", | ||
"@typescript-eslint/eslint-plugin": "2.26.0", | ||
"@typescript-eslint/parser": "2.26.0", | ||
"copyfiles": "2.2.0", | ||
"eslint": "6.8.0", | ||
"husky": "4.2.3", | ||
"jest": "25.2.2", | ||
"lint-staged": "10.0.9", | ||
"jest": "25.2.4", | ||
"lint-staged": "10.1.1", | ||
"prettier": "2.0.2", | ||
"rimraf": "3.0.2", | ||
"semantic-release": "17.0.4", | ||
"ts-jest": "25.2.1", | ||
"ts-jest": "25.3.0", | ||
"typescript": "3.8.3" | ||
} | ||
} |
# ESLint builder for Angular | ||
Run [ESLint](https://eslint.org/) from Angular CLI. | ||
Please note that this builder runs ESLint using the CLI engine and not by creating the TS program directly. It's still pretty experimental. | ||
## Install | ||
@@ -5,0 +7,0 @@ 1. Install ESLint: `npm install eslint --save-dev` |
@@ -6,31 +6,16 @@ "use strict"; | ||
const load_project_eslint_1 = require("./load-project-eslint"); | ||
const should_print_info_1 = require("./should-print-info"); | ||
const get_should_log_1 = require("./get-should-log"); | ||
const print_output_1 = require("./print-output"); | ||
const print_input_1 = require("./print-input"); | ||
const normalize_root_path_1 = require("./normalize-root-path"); | ||
function builder(options, context) { | ||
return tslib_1.__awaiter(this, void 0, void 0, function* () { | ||
const systemRoot = context.workspaceRoot; | ||
process.chdir(context.currentDirectory); | ||
const projectName = (context.target && context.target.project) || '<???>'; | ||
const printInfo = should_print_info_1.shouldPrintInfo(options); | ||
let status = `Running ESLint for project ${JSON.stringify(projectName)}...`; | ||
context.reportStatus(status); | ||
if (printInfo) { | ||
context.logger.info(status); | ||
} | ||
const normalizedOptions = normalize_root_path_1.normalizeRootPath(options, context); | ||
const shouldLog = get_should_log_1.getShouldLog(normalizedOptions); | ||
print_input_1.printInput(shouldLog, context); | ||
const projectEslint = yield load_project_eslint_1.loadProjectEslint(); | ||
options.cwd = systemRoot; | ||
const report = lint_1.lint(projectEslint, options); | ||
if (printInfo) { | ||
context.logger.info(report.output); | ||
if (report.hasWarnings) { | ||
context.logger.warn('ESLint found warnings in the listed files.'); | ||
} | ||
if (report.hasErrors) { | ||
context.logger.error('ESLint found errors in the listed files.'); | ||
} | ||
if (report.isSuccess) { | ||
context.logger.info('All files passed linting with ESLint.'); | ||
} | ||
} | ||
const report = lint_1.lint(projectEslint, normalizedOptions); | ||
print_output_1.printOutput(shouldLog, report, context); | ||
return { | ||
success: options.force ? true : report.isSuccess | ||
success: report.isSuccess | ||
}; | ||
@@ -37,0 +22,0 @@ }); |
@@ -10,9 +10,5 @@ import { json } from '@angular-devkit/core'; | ||
} | ||
export declare enum Severity { | ||
WARN = 1, | ||
ERROR = 2 | ||
} | ||
export interface WarningsErrorsFlags { | ||
export interface ReportFlags { | ||
hasWarnings: boolean; | ||
hasErrors: boolean; | ||
} |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var Severity; | ||
(function (Severity) { | ||
Severity[Severity["WARN"] = 1] = "WARN"; | ||
Severity[Severity["ERROR"] = 2] = "ERROR"; | ||
})(Severity = exports.Severity || (exports.Severity = {})); | ||
//# sourceMappingURL=builder.model.js.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const get_warning_errors_flags_1 = require("./get-warning-errors-flags"); | ||
const tslib_1 = require("tslib"); | ||
const eslint = tslib_1.__importStar(require("eslint")); | ||
const get_report_flags_1 = require("./get-report-flags"); | ||
function lint(projectEslint, options) { | ||
@@ -8,6 +10,9 @@ const cliEngine = new projectEslint.CLIEngine(options); | ||
const report = cliEngine.executeOnFiles(options.files); | ||
const warningErrorsFlags = get_warning_errors_flags_1.getWarningErrorsFlags(report); | ||
return Object.assign(Object.assign({ output: formatter(report.results) }, warningErrorsFlags), { isSuccess: !warningErrorsFlags.hasWarnings && !warningErrorsFlags.hasErrors }); | ||
const reportFlags = get_report_flags_1.getReportFlags(report, options); | ||
if (options.fix) { | ||
eslint.CLIEngine.outputFixes(report); | ||
} | ||
return Object.assign(Object.assign({ output: formatter(report.results) }, reportFlags), { isSuccess: options.force === true || (!reportFlags.hasWarnings && !reportFlags.hasErrors) }); | ||
} | ||
exports.lint = lint; | ||
//# sourceMappingURL=lint.js.map |
@@ -62,2 +62,6 @@ { | ||
}, | ||
"tsConfig": { | ||
"type": "string", | ||
"description": "Path to TypeScript configuration." | ||
}, | ||
"useEslintrc": { | ||
@@ -64,0 +68,0 @@ "type": "boolean", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
18165
34
250
42