Reputation: 5
How to enable eslint in Laravel vendor folder?
The main development takes place within vendor folder. Our project based on Laravel packages. I have enabled and configure eslint in the "root" project and it works fine. Currently work in PHPStorm and use eslint in it.
.eslintrc.json
{
"env": {
"es6": true,
"node": true
},
"extends": [
"eslint:recommended",
"plugin:vue/essential",
"plugin:prettier/recommended"
],
"globals": {
"Atomics": "readonly",
"SharedArrayBuffer": "readonly"
},
"parserOptions": {
"ecmaVersion": 2018,
"sourceType": "module"
},
"plugins": [
"vue",
"prettier"
],
"rules": {
"no-unused-vars": "warn"
}
}
.prettierrc.json
{
"trailingComma": "es5",
"tabWidth": 4,
"semi": false,
"singleQuote": true
}
resources/js/components/App.vue - Fix ESlint Problems:
But in vendor package it doesn't.
vendor\testpackage\uitest01\recources\js\components\TestTwoComponent.vue - Fix ESlint Problems isn't presented:
Any ideas how enable it? Thank you!
Upvotes: 0
Views: 639
Reputation: 93728
In Laravel projects, vendor packages are auto-added to PHP Include paths and thus are treated as libraries. But inspections are not enabled in library files, and linter errors are not reported for them. Try removing your package from Include Path list in Settings | Languages & Frameworks | PHP:
and then un-exclude the vendor/testpackage/uitest01
folder. This should help:
Remove packages as libraries permanently:
In Settings | Languages & Frameworks | PHP | Composer, try disabling Add packages as libraries to avoid auto-adding packages to Include path (you will then need to add the packages you'd like being treated as libraries manually)
Upvotes: 2