BenoitZugmeyer / eslint-plugin-html

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

Didn't do anything #43

Closed rottmann closed 7 years ago

rottmann commented 7 years ago

What i am doing wrong?

node 6.4.0

package.json

{
  "name": "eslint-test",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "lint": "eslint src"
  },
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "eslint": "^3.12.2",
    "eslint-plugin-html": "^1.7.0"
  }
}

.eslintrc / .eslintrc.json

{
  "plugins": [
    "html"
  ],
  "settings": {
    "html/indent": "10",
    "html/report-bad-indent": 1
  }
}

src/test.vue

<script>
x = x
</script>

$ npm run lint

Result:

> eslint-test@1.0.0 lint /home/rottmann/test/eslint-test
> eslint src

No error, nothing else.

BenoitZugmeyer commented 7 years ago

When running eslint on a directory, it will lint only the .js files. You have to specify extra extensions to lint other file types: eslint --ext .vue src. See documentation.

rottmann commented 7 years ago

Thanks! Did not see the wood for the trees :evergreen_tree: :evergreen_tree: :evergreen_tree:

martynchamberlin commented 7 years ago

This helped immensely. I wonder if it'd be worthwhile adding this to this repo's README? I know that people should know this but the fact is a lot of people don't. Me and my colleagues were stumped on this. :)

rottmann commented 7 years ago

It is not a plugin problem, it is a "user didn't read the eslint documentation"-Problem ;-) Shame on me.

BenoitZugmeyer commented 7 years ago

Sure, but it seems you're not alone, and adding a small paragraph in the README won't hurt anyone!