0.1.2 • Published 5 years ago
eslint-plugin-vue-webpack-src-import v0.1.2
eslint-plugin-vue-webpack-src-import
Vue CLI defines at sign (@) as an alias to src/, allowing for src-relative imports.
This plugin standardizes relative imports to use this alias when possible.
Fixes importing from ../../components/MyComponent.vue to @/components/MyComponent.vue.
Installation
You'll first need to install ESLint:
$ npm i eslint --save-devNext, install eslint-plugin-vue-webpack-src-import:
$ npm install eslint-plugin-vue-webpack-src-import --save-devUsage
Add vue-webpack-src-import to the plugins section of your .eslintrc configuration file. You can omit the eslint-plugin- prefix:
{
"plugins": [
"vue-webpack-src-import"
]
}Then configure the rules you want to use under the rules section.
{
"rules": {
"vue-webpack-src-import/only-src-relative-imports": "error"
}
}Supported Rules
only-src-relative-imports
Detects and fixes relative import that are not relative to '@/'