Code Monkey home page Code Monkey logo

angular-estree-parser's Introduction

angular-estree-parser

Build Status Coverage Npm Version MIT License

A parser that converts Angular source code into an ESTree-compatible form

Changelog

Install

# using npm
npm install --save angular-estree-parser @angular/compiler

# using yarn
yarn add angular-estree-parser @angular/compiler

Usage

import * as ngEstreeParser from 'angular-estree-parser';

const ast = ngEstreeParser.parseBinding('a | b:c');
//=> { type: "NGPipeExpression", ... }

API

  • parseAction(input: string): AST for (target)="input"
  • parseBinding(input: string): AST for [target]="input"
  • parseInterpolationExpression(input: string): AST for {{input}}
  • parseTemplateBindings(input: string): AST for *directive="input"

Development

# lint
yarn run lint

# build
yarn run build

# test
yarn run test

License

MIT © Ika

angular-estree-parser's People

Contributors

brodybits avatar dependabot[bot] avatar fisker avatar ikatyang avatar renovate-bot avatar renovate[bot] avatar sosukesuzuki avatar thorn0 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

angular-estree-parser's Issues

Bug: Structural directive + no input + as syntax

We have created:

  • a structural directive with no input
  • and are using the assyntax to capture the $implicit value of the template context

The syntax check in html template (vscode) works as expected (no errors):

<button
  *IsEmployee="as isEmployee"
  [disabled]="element.status === 1 || (!isDplEmployee && element.status === 2"
>

But when formatting the html (with prettier) the string NgEstreeParser is pretended to the as statement. Resulting in incorrect syntax:

<button
  *IsEmployee="NgEstreeParser as isEmployee"
  [disabled]="element.status === 1 || (!isDplEmployee && element.status === 2"
>

Expected result:

  • for the formatter to leave the as statement as is

This seems to be linked to the use of a fake prefix.

Not sure if this is the right place to report this, I'd appreciate any pointers where you think this belongs.

Dependency deprecation warning: @types/babel__parser (npm)

On registry https://registry.npmjs.org/, the "latest" version (v7.1.0) of dependency @types/babel__parser has the following deprecation notice:

This is a stub types definition. babel__parser provides its own type definitions, so you do not need this installed.

Marking the latest version of an npm package as deprecated results in the entire package being considered deprecated, so contact the package author you think this is a mistake.

Affected package file(s): package.json

If you don't care about this, you can close this issue and not be warned about @types/babel__parser's deprecation again. If you would like to completely disable all future deprecation warnings then add the following to your config:

"suppressNotifications": ["deprecationWarningIssues"]

Update peerDependencies for @angular/compiler version 8

This seems to work for me in my own fork of Prettier. I would be happy to raise a PR.

I think it would also be ideal to Travis CI testing with @angular/compiler versions 6, 7, and 8.

I would be happy to raise 1 or more PRs.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.