BenoitZugmeyer / eslint-plugin-html

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

unable to run eslin on .js.erb files #80

Closed sekmo closed 6 years ago

sekmo commented 6 years ago

Hi! I can't manage to make it work with .js.erb files... (eslint@4.9) Here is my configuration:

{
  "extends": "airbnb",
  "rules": {
    "func-names": ["error", "never"],
    "no-var": 0,
    "vars-on-top": 0
  },
  "plugins": ["html"],
  "settings": {
    "html/html-extensions": [".erb", ".js.erb", ".js"],
  },
  "overrides": [
    {
      "files": ["app/**/*.js.erb", "app/**/*.js"]
    }
  ]
}
BenoitZugmeyer commented 6 years ago

Hi, what's the symptom? are they ignored, or is there an error message?

If you are runing eslint on a directory containing .erb files, please make sure to use the --ext option as stated in the README:

eslint --ext .erb,.js src

Unrelated, but you shouldn't add the .js extension in "html/html-extensions" else it will break ESLint on JS files as it will considerate those files as HTML files.

sekmo commented 6 years ago

While it works when running eslint --ext .js.erb,.js ., the .js.erb files are ignored when running eslint . There is no way to force the file extension in .eslintrc? (I need to run eslint with no parameters)

BenoitZugmeyer commented 6 years ago

Sorry, there isn't. I saw you already find https://github.com/eslint/eslint/issues/7324 , and I'm pretty sure that ESLint:

It's even stated in the documentation: "Currently the sole method for telling ESLint which file extensions to lint is by specifying a comma separated list of extensions using the --ext command line option".