Gathering detailed insights and metrics for @angular-eslint/builder
Gathering detailed insights and metrics for @angular-eslint/builder
Gathering detailed insights and metrics for @angular-eslint/builder
Gathering detailed insights and metrics for @angular-eslint/builder
@angular-devkit/build-webpack
Webpack Builder for Architect
@angular-eslint/utils
Please see https://github.com/angular-eslint/angular-eslint for full usage instructions and guidance.
@angular-eslint/template-parser
Angular Template parser for ESLint
@angular-eslint/eslint-plugin
ESLint plugin for Angular applications, following https://angular.dev/style-guide
✨ Monorepo for all the tooling related to using ESLint with Angular
npm install @angular-eslint/builder
81.6
Supply Chain
61.5
Quality
94.3
Maintenance
100
Vulnerability
98.6
License
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
1,646 Stars
1,471 Commits
224 Forks
27 Watching
19 Branches
95 Contributors
Updated on 27 Nov 2024
Minified
Minified + Gzipped
TypeScript (99.78%)
JavaScript (0.22%)
Cumulative downloads
Total Downloads
Last day
-2.4%
232,188
Compared to previous day
Last week
2.3%
1,233,221
Compared to previous week
Last month
6.3%
5,168,332
Compared to previous month
Last year
19.1%
54,380,718
Compared to previous year
2
2
Monorepo for all the tooling which enables ESLint to lint Angular projects
This project is made possible thanks to the continued hard work going into https://github.com/typescript-eslint/typescript-eslint, and brilliant work on the original TSLint rule implementations in https://github.com/mgechev/codelyzer.
eslint-disable
comments in Angular templatesFollow the local environment and workspace setup guide in order to install the Angular CLI
Create a new Angular CLI workspace in the normal way, optionally using any of the supported command line arguments and following the interactive prompts:
1ng new # --maybe --some --other --flags --here
@angular-eslint/schematics
.1ng add @angular-eslint/schematics
...and that's it!
As well as installing all relevant dependencies, the ng add
command will automatically detect that you have a workspace with a single project in it, which does not have a linter configured yet. It can therefore go ahead and wire everything up for you!
You will also see that it added the following in your angular.json:
1 "cli": { 2 "schematicCollections": ["@angular-eslint/schematics"] 3 }
Read the section on Using ESLint by default when generating new Projects within your Workspace to understand why this is useful.
As of v12, we aligned the major version of @angular-eslint
with Angular (and Angular CLI).
Therefore, as an example (because these versions may or may not exist yet when you read this):
@angular-eslint
packages at 16.x.x
and @angular/cli@16.x.x
are compatible@angular-eslint
packages at 17.x.x
and @angular/cli@17.x.x
are compatible@angular-eslint
packages at 18.x.x
and @angular/cli@18.x.x
are compatibleNOTE: the exact minor and patch versions of each library represented here by
x
's do not need to match each other, just the first (major) number
For an understanding of Angular CLI version support prior to v12, please see ./docs/ANGULAR_VERSION_SUPPORT.md
Please do not open issues related to unsupported versions of the Angular CLI.
See the specified peerDependency in any of our packages, such as the eslint-plugin
: https://github.com/angular-eslint/angular-eslint/blob/main/packages/eslint-plugin/package.json
Nx leans on some, but not all of the packages from this project.
Specifically:
.eslintrc.json
or eslint.config.js
files in a way that makes sense for Nx workspaces.We strongly recommend that you do not try and hand-craft setups with angular-eslint and Nx. It is easy to get things wrong.
Issues specific to Nx's support of Angular + ESLint should be filed on the Nx repo: https://github.com/nrwl/nx
Please follow the links below for the packages you care about.
angular-eslint
- This is the core package that exposes most of the other packages below for the common use case of using angular-eslint
with Angular CLI workspaces. It exposes all the tooling you need to work with ESLint v9 and typescript-eslint
v8 with flat config in v18 of angular-eslint
onwards. For versions of angular-eslint
older than v18, or workspaces still using ESLint v8 and typescript-eslint
v7 or the legacy eslintrc config format, you will use a combination of the packages below directly.
@angular-eslint/builder
- An Angular CLI Builder which is used to execute ESLint on your Angular projects using standard commands such as ng lint
@angular-eslint/eslint-plugin
- An ESLint-specific plugin that contains rules which are specific to Angular projects. It can be combined with any other ESLint plugins in the normal way.
@angular-eslint/eslint-plugin-template
- An ESLint-specific plugin which, when used in conjunction with @angular-eslint/template-parser
, allows for Angular template-specific linting rules to run.
@angular-eslint/schematics
- Schematics which are used to add and update configuration files which are relevant for running ESLint on an Angular workspace.
@angular-eslint/template-parser
- An ESLint-specific parser which leverages the @angular/compiler
to allow for custom ESLint rules to be written which assert things about your Angular templates.
@angular-eslint/test-utils
- Utilities which are helpful when testing custom ESLint rules for Angular workspaces.
@angular-eslint/utils
- Utilities which are helpful when writing custom ESLint rules for Angular workspaces.
All of the packages are published with the same version number to make it easier to coordinate both releases and installations.
We publish a canary release on every successful merge to the main
branch, so you never need to wait for a new stable version to make use of any updates.
The latest version under the latest
tag is:
The latest version under the canary
tag (latest commit to the main
branch) is:
(Note: The only exception to the automated publishes described above is when we are in the final phases of creating the next major version of the libraries - e.g. going from 1.x.x
to 2.x.x
. During these periods, we manually publish pre-releases until we are happy with it and promote it to latest
.)
NOTE: If you are looking for instructions on how to migrate a project which uses TSLint, please see the bottom of the README.
If you want to add ESLint configuration (either a eslint.config.js
file for flat config, or a .eslintrc.json
file for eslintrc (angular-eslint
will figure this out for you automatically) and an applicable "lint"
target in your angular.json
) to an existing Angular CLI project which does not yet have a linter set up, you can invoke the following schematic:
1ng g @angular-eslint/schematics:add-eslint-to-project {{YOUR_PROJECT_NAME_GOES_HERE}}
If you only have a single project in your Angular CLI workspace, the project name argument is optional
Regardless of whether or not you added @angular-eslint
to a brand new workspace, or you added it in order to convert a project within an existing workspace, it is likely that from now on you want any subsequent projects that you generate in your workspace to also use ESLint.
In order to achieve this, @angular-eslint
provides a set of custom generator schematics which sit on top of the default ones that the Angular CLI provides. They provide all the standard Angular CLI options, but just handle adding ESLint related configuration for you in each case.
You can always invoke them directly by specifying the collection name as part of the generate command:
1# To generate a new Angular app in the workspace using ESLint 2ng g @angular-eslint/schematics:application 3# To generate a new Angular library in the workspace using ESLint 4ng g @angular-eslint/schematics:library
Or, alternatively, if you don't want to have to remember to set that collection prefix in front of the :
every time, you can set the schematicCollections
in your angular.json
to start with @angular-eslint/schematics
.
You can either do that by hand by adjusting the JSON, or by running the following Angular CLI command:
1ng config cli.schematicCollections "[\"@angular-eslint/schematics\"]"
The final result in your angular.json
will be something like this:
1 "cli": { 2 "schematicCollections": ["@angular-eslint/schematics"] 3 }
Now your generate commands can just be:
1# To generate a new Angular app in the workspace using ESLint (thanks to the schematicCollections set above) 2ng g app 3# To generate a new Angular library in the workspace using ESLint (thanks to the schematicCollections set above) 4ng g lib
In version 9 of ESLint, they changed their default configuration format to the so called "flat config" style using exclusively a eslint.config.js
file as the only way of configuring a project: https://eslint.org/blog/2024/04/eslint-v9.0.0-released/
The legacy so called "eslintrc" style is now deprecated, but still fully supported, and so when it comes to configuring ESLint for your Angular projects you have two options and associated guides:
Please see here for our philosophy on using a linter to enforce code formatting concerns: ./docs/FORMATTING_RULES.md
TL;DR - We will not be maintaining code formatting rules in this project, but you are very welcome to create them yourself using our tooling such as @angular-eslint/utils
and @angular-eslint/test-utils
.
We strongly recommend using v3 of the vscode-eslint extension. At the time of writing (May 2024), this is in prerelease. You can enable it by opening up the extension profile page within VSCode and clicking on the "switch to prerelease" button (if your currently installed version is older than v3).
The extension will now be smart enough to pick up from your configuration files what files you care about linting (from both flat configs and eslintrc (as long as you follow the guidance of using overrides outline in this repo)).
The only configuration option you need to care about is if you are using ESLint v9 and still using eslintrc configuration files (because flat config is the default in ESLint v9). In this case you need to set in your .vscode/settings.json
:
1// ... more config 2"eslint.useFlatConfig": false, 3// ... more config
For full information about the extension see: https://github.com/microsoft/vscode-eslint
NOTE: This is only applicable when you are using eslintrc configs. For flat config, no custom --ext
option is needed.
If you're using this without the Angular CLI Builder (and eslintrc configs), don't forget to include .html
as one of the file extensions when running the eslint CLI, otherwise templates will not be linted, e.g.:
1eslint --ext .ts,.html .
As you have hopefully understood from the above section on ESLint configuration what we are dealing with here is a set of tools that were not designed and optimized for this specific use-case.
In software development we are permanently faced with trade-offs. In this case you can think about it this way:
On the one hand...
By using ESLint with Angular (both its TypeScript source code, and its HTML templates), we gain access to a truly massive ecosystem of existing rules, plugins and IDE extensions that we can instantly leverage on our projects.
On the other...
The tooling will never be as fast or memory efficient, or as easy to configure, as something which was purpose built for a narrower use-case and which, well, does less...
TSLint was more in the latter camp - it was purpose built for linting TypeScript source code (note, not HTML), and so it was (depending on the codebase) faster and more efficient at doing it - but it was hugely lacking in community support, features, plugins, rules etc...
As of v15, we generate the fastest possible lint config for you out of the box (rather than the most flexible lint config), but it is possible that you will need to leverage rules which require type information, and this requires extra consideration.
Please read this dedicated guide to fully understand lint performance and how it is impacted by rules requiring type information: ./docs/RULES_REQUIRING_TYPE_INFORMATION.md
eslint-disable
comments in Angular templatesIf you want to be able to use eslint-disable
comments in your Angular templates you just need to ensure you are using:
@angular
CLI tooling packages version 11.2.8
or higher@angular-eslint
tooling packages version 2.1.0
or higherMake sure you are using valid HTML comments, i.e. <!-- this syntax -->
, not the kind of comments you use in TypeScript code.
Please see here for the legacy information around converting from Codelyzer and TSLint prior to version 16: ./docs/MIGRATING_FROM_TSLINT.md
No vulnerabilities found.
Reason
security policy file detected
Details
Reason
30 commit(s) and 17 issue activity found in the last 90 days -- score normalized to 10
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
2 existing vulnerabilities detected
Details
Reason
Found 2/8 approved changesets -- score normalized to 2
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
project is not fuzzed
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2024-11-25
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More