eslint-plugin-vueunused
a eslint plugin for detecting unused code in vue single file component
939
| Install | |
|---|---|
npm install eslint-plugin-vueunused |
|
| Latest Version: | 0.5.2 |
| License: | ISC |
| Last Updated: | Apr 19, 2020 |
| Links: | npm |
Maintainer: iwanabethatguy
ENGLISH | 中文
eslint-plugin-vueunused
一个用于检测vue单个文件组件中死代码的eslint插件。
安装
首先你需要安装 ESLint:
$ npm i eslint --save-dev
然后, 安装 eslint-plugin-vueunused
$ npm install eslint-plugin-vueunused --save-dev
注意:
如果您全局安装了ESLint(使用-g标志),则还必须全局安装eslint-plugin-vueunused。
使用方法
将 vueunused 添加至你的 .eslintrc 配置文件中的plugins部分. 你可以省略 eslint-plugin- 前缀:
{
"plugins": [
"vueunused"
]
}
然后继承插件推荐配置即可
{
"extends": ["plugin:vueunused/recommend"],
}
支持的规则
只有一条规则
- vueunused/unused
警告
该插件与eslint-plugin-html不兼容,因为该插件可能会破坏您的scf(.vue)组件模板信息,如果你一定要共用eslint-plugin-html 可以考虑再.eslintrc.js中添加
module.exports = {
...
settings: {
'html/html-extensions': ['.html'] // consider .html and .we files as HTML
}
}
使用该配置指定需要使用eslint-plugin-html的 文件,不要lint.vue即可。
我建议您使用eslint-plugin-vue,本插件用于弥补eslint-plugin-vue某些未完成的功能,例如no-unused-methods,no-unused-variables,等等挂载在this上的属性实际上,您在组件范围内定义的大多数未使用的属性都可以被检测到。
建议
如果您使用VSCode编辑器,我强烈建议您安装ESlint VSCode插件,它可以用更加直观的方式指出单文件中的死代码。
Related Packages
eslint-plugin-test-id
This checks is data-test-id prop is present, on some tags which are useful for e...
10,384
17
Version History
| Version | Released | License |
|---|---|---|
| 0.5.2 | ISC | |
| 0.5.1 | ISC | |
| 0.5.0 | ISC | |
| 0.4.1 | ISC | |
| 0.4.0 | ISC | |
| 0.3.11 | ISC | |
| 0.3.10 | ISC | |
| 0.3.9 | ISC | |
| 0.3.8 | ISC | |
| 0.3.7 | ISC | |
| 0.3.6 | ISC | |
| 0.3.5 | ISC | |
| 0.3.4 | ISC | |
| 0.3.3 | ISC | |
| 0.3.2 | ISC | |
| 0.3.1 | ISC | |
| 0.3.0 | ISC | |
| 0.2.0 | ISC | |
| 0.0.7 | ISC | |
| 0.0.6 | ISC | |
| 0.0.5 | ISC | |
| 0.0.4 | ISC | |
| 0.0.3 | ISC | |
| 0.0.2 | ISC | |
| 0.0.1 | ISC |