Angular中ng lint与ng lint --format=stylish的区别及格式参数文档咨询
ng lint Formats: Default, stylish, and prose Hey there! Let's break down the differences between these Angular linting format options since the ng lint --help output doesn't spell them out clearly.
1. Default ng lint vs --format=stylish
Here's a quick truth: running plain ng lint is exactly the same as running ng lint --format=stylish! The Angular CLI uses stylish as the default output format for linting results. You can test this yourself by running both commands back-to-back—you’ll see identical output in your terminal.
2. --format=stylish vs --format=prose
The key differences are in how the lint results are structured and presented:
stylishformat: This is a compact, structured view optimized for developers. It groups issues by file, and each entry shows the line/column number, issue severity (warning/error), rule code, and a short description. It’s great for quick scans during development because it’s space-efficient and dense with actionable info.
Example output snippet:src/app/my-component.ts 8:3 warning 'unusedVar' is assigned a value but never used @typescript-eslint/no-unused-vars 14:7 error Missing semicolon @typescript-eslint/semiproseformat: This is a more verbose, natural-language style output. It frames lint issues in plain, paragraph-like text, making it easier to read for folks who aren’t deep in day-to-day coding (or if you need to share results in a more accessible report). Each issue is called out with full context in a conversational way.
Example output snippet:In src/app/my-component.ts: - Line 8, column 3: The variable 'unusedVar' is assigned a value but never used. (Rule: @typescript-eslint/no-unused-vars) - Line 14, column 7: A semicolon is missing here. (Rule: @typescript-eslint/semi)
A quick note: Angular CLI’s linting is built on top of ESLint, so these format options are directly inherited from ESLint’s built-in formatters. That’s why you might not find super detailed docs in the Angular CLI help—most of the context aligns with ESLint’s formatter behavior.
内容的提问来源于stack exchange,提问作者bro33

