BenoitZugmeyer / eslint-plugin-html

An ESLint plugin to extract and lint scripts from HTML files.
ISC License
430 stars 51 forks source link

error Unexpected token < #2

Closed peponi closed 9 years ago

peponi commented 9 years ago

Hello

and thx for you plugin I have tried to use it but I got this error

/home/peponi/Code/private_projects/FirefoxOS/Wallet_WebApp/app/index.html
  1:1  error  Unexpected token <

seems the htmlparser2 won't work or so

may be you can tell me what I'm doing wrong

here is my gulp task

gulp.task('eslint', function () {
    return gulp.src(['app/js/**/*.js','app/index.html'])
        .pipe(eslint({
            plugins: ["html"]
        }))
        .pipe(eslint.format())
        .pipe(eslint.failOnError());
});

.eslintrc

...
  vm: true
  xtag: true
  ViewModel: true
plugins: 
  - html
rules: 
  block-scoped-var: true
  camelcase: true
...

and package.json

  "devDependencies": {
    "eslint-plugin-html": "^1.0.0",
    "gulp": "^3.8.11",
    "gulp-eslint": "^0.9.0"
  },
BenoitZugmeyer commented 9 years ago

Thanks for the bug report. I was aware of this issue. Sadly, for now, ESLint only apply plugin preprocessors (the function to translate HTML content into pure JS content in the eslint-plugin-html case) when linting a file, not a string (see the processFile function). As gulp-eslint does not use the processFile function but a lower level function, preprocessors are not applied.

I (or you) should open an issue either on ESLint or gulp-eslint project to try to solve this.

peponi commented 9 years ago

Hello Benoit

thanks for you answer, would be nice if you write a note about this in your README.md

cheers