angular-estree-parser is a utility library designed to convert specific Angular template syntax constructs (such as actions, bindings, interpolation expressions, and template bindings) into an Abstract Syntax Tree (AST) that conforms to the ESTree specification. This makes it a critical component for tools like code formatters (e.g., Prettier), linters, and other static analysis tools operating within the Angular ecosystem. The library is currently stable at version 15.4.3 and maintains a reactive release cadence, frequently updating to support new major and minor versions of @angular/compiler as they are released. Its core differentiator lies in its deep integration with @angular/compiler's internal parsing mechanisms, ensuring accuracy and alignment with Angular's evolving syntax, while providing an ESTree-compatible output that is widely understood by the JavaScript tooling ecosystem. Users must explicitly install the appropriate @angular/compiler peer dependency to match their Angular project's version.
npm install angular-estree-parserVerified import paths — ran on the pinned version, not inferred.
Demonstrates how to parse various Angular template expressions (binding, action, interpolation) into ESTree-compatible ASTs using the library's core functions.
Ensure `@angular/compiler` is updated to a compatible version (e.g., `>=21.0.7` for `angular-estree-parser` v15). Run `npm install @angular/compiler@latest` or `yarn upgrade @angular/compiler`.
Always install both packages: `npm install angular-estree-parser @angular/compiler` or `yarn add angular-estree-parser @angular/compiler`.
Upgrade your Node.js environment to version 20 or newer. Tools like `nvm` or `volta` can help manage Node.js versions efficiently.
Update to `angular-estree-parser` version `15.4.3` or later to ensure correct module resolution and compatibility across environments.
Install `@angular/compiler` using `npm install @angular/compiler` or `yarn add @angular/compiler`. Ensure the version satisfies the `angular-estree-parser` peer dependency range.
Ensure you are using `import * as ngEstreeParser from 'angular-estree-parser';` or specific named imports like `import { parseBinding } from 'angular-estree-parser';` in an ESM-compatible environment.Upgrade your Node.js installation to version 20 or higher. Use `nvm install 20` and `nvm use 20` or similar version management tools.