paleite / eslint-plugin-diff

Run ESLint on your changes only
https://npm.im/eslint-plugin-diff
MIT License
173 stars 13 forks source link

[DOCS] Usage with eslint-plugin-vue #4

Closed DaVarga closed 3 years ago

DaVarga commented 3 years ago

When using this plugin with the eslint-plugin-vue I noticed that only js files are linted. I had to change the config a bit so that the files are still checked by the linter. Somehow it seems not to be enough to have a * in the files option, otherwise only files with the js extension will get into this plugin.

I don't know why this happens because files: ["*"], should catch everything - afaik. I had success with the following setting.

"plugins": [
    "diff"
],
"overrides": [
    {
        "files": ["*.js", "*.vue"],
        "processor": "diff/staged"
    }
],

@paleite Maybe this is worth mentioning in the readme or do you have an idea how to make this plugin work out of the box with eslint-plugin-vue or simmilar plugins?

paleite commented 3 years ago

What args are you using? Do you have a repo I could look at?

Whenever I've encountered this type of issue with ESLint it's been because I forgot to pass --ext vue.

Would be interesting to investigate!

paleite commented 3 years ago

Closing this due to inactivity; please let me know if the issue persists.

hejialianghe commented 1 month ago

遇到了相同的问题。 "lint-staged": { "*.{js,ts,vue}": [ "eslint --ext .js,.vue,.ts" ] } 没效果,必须eslint配置 "plugins": [ "diff" ], "overrides": [ { "files": ["*.js", "*.vue"], "processor": "diff/staged" } ],