liveBook · Manning

Linting

As explained in Pro Angular 16

A linter is a static-analysis tool that examines source code for programming errors, style violations, and other rule-defined issues.

Linting uses static analysis to inspect source code against coding conventions and rules. It identifies legal TypeScript or JavaScript that may still cause production problems, such as debugger statements or inconsistent Angular selectors. section 9.3.3 section 9.7

A practical linting workflow includes:

  • Fix violations before committing changes to version control, or integrate linting into broader team processes. section 9.3.3

Catching a debugger statement and selector violation

Adding `debugger` to `app.component.ts` produces a `no-debugger` error because it can halt deployed code. Changing the component selector from `app-root` to `approot` produces an Angular selector error because component selectors should use the `app` prefix and kebab-case. The application may build despite the style violation, but the selector must also match the HTML for the application to run as expected.

How Pro Angular 16 covers it

How deep it goes
Explains installation, execution, diagnostics, suppressions, and rule configuration without detailing linter internals.
Examples
Demonstrates `debugger`, Angular selector casing, `ng lint` output, suppression comments, and `.eslintrc.json` rules.
What it assumes
Assumes an Angular project and source files, while defining linting and demonstrating its rules from basic usage.
What you can do after
Diagnose with `ng lint`, interpret rule violations, and configure or narrowly suppress unavoidable findings.
How it connects
Connects ESLint with Angular, TypeScript, JavaScript, source-code conventions, builds, and version control.

Also explained in

Compare how 8 books explain linting →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Pro Angular 16. The section links point to the parts of the book it draws on.