DEV Community

Discussion on: Migrating and configuring Eslint with Angular 11

Collapse
 
singhshubham97 profile image
singhshubham97

I have two questions:
1)The Html plugins mentioned here (those prettier ones) are giving parse errors.
2)Do we have other plugins for using ESLINT for HTML templates in angular

Collapse
 
gsarciotto profile image
Giovanni Sarciotto

1) What does the error says?

2) There are pure HTML plugins for eslint, however I dont think they would play nice with the features of angular (template binding, etc)

Collapse
 
singhshubham97 profile image
singhshubham97 • Edited

The parse error in index.html
dev-to-uploads.s3.amazonaws.com/i/...

Thread Thread
 
gsarciotto profile image
Giovanni Sarciotto

Alright, I managed to solve the problem in my machine. It seems like prettier isn't able to decide which parser to use for some reason. Add the following in your .prettierrc:

"overrides": [
        {
            "files": "*.component.html",
            "options": {
                "parser": "angular"
            }
        },
        {
            "files": "*.html",
            "options": {
                "parser": "html"
            }
        }
    ]
Enter fullscreen mode Exit fullscreen mode

If this fixes your problem, please tell me so that I can update the article!

Thread Thread
 
singhshubham97 profile image
singhshubham97

Thanks Giovanni for the help!! Its working in my machine