5

I have a template file on my project and while running the eslint I am facing various issues because of it. Some of those are -

error Parsing error: Unexpected token !

error Parsing error: Unexpected token <

To overcome from that I tried to use eslint-plugin-ejs with no help. I have visited below SO links as well -

Turning off eslint rule for a specific file

ESLint Parsing error: Unexpected token

Mysterious ESLint Parsing Error

and many more but again with no luck. Now I just want this file to be excluded from eslint but couldn't find the way to do that. Any help would be greatly appreciated.

Jeet
  • 5,569
  • 8
  • 43
  • 75

1 Answers1

2

As the documentation says.

You can use of inline configuration /*eslint-disable*/ and /*eslint-enable*/.


enter image description here


@EDIT to what you've said in comment, there are two solutions

1 You can use of the property excludedFiles, I've found an example in the documentation :

enter image description here


2 You can handle the HTML and EJS files in a particular way as described here

3 You can also use the .eslintignore file as described at Ignoring Files and Directories

Kickaha
  • 3,680
  • 6
  • 38
  • 57
Orelsanpls
  • 22,456
  • 6
  • 42
  • 69
  • The problem is `/**/` comments doesn't work in html or ejs file. so this option is not viable. – Jeet Nov 30 '17 at 14:26
  • @Jeet I've done an edit, with two soluce answering your problem – Orelsanpls Nov 30 '17 at 14:35
  • 1
    2nd options doesn't work still because there is no script tag in the file or no javascript processing. It is a plain ejs file, however the 1st options looks like it is working since I don't get the error anymore. Thank you very much for the help. – Jeet Nov 30 '17 at 14:46
  • 1
    @GrégoryNEUT I'm honestly curious. Is "soluce" a real word, or did you mean "solutions"? – Michael Dorst Nov 14 '19 at 17:18
  • @MichaelDorst Indeed I mean *solutions*. Sorry about my english mistakes. – Orelsanpls Nov 15 '19 at 08:23
  • 1
    Of all the solutions, the `.eslintignore` one, number 3 in the list, worked well for me. – dangowans Nov 20 '19 at 20:25