0.5.2 • Published 5 years ago

eslint-plugin-vueunused v0.5.2

Weekly downloads
18
License
ISC
Repository
-
Last release
5 years ago

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"],
}

支持的规则

只有一条规则 1. 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插件,它可以用更加直观的方式指出单文件中的死代码。

0.5.2

5 years ago

0.5.1

5 years ago

0.5.0

5 years ago

0.4.1

5 years ago

0.4.0

5 years ago

0.3.11

5 years ago

0.3.9

5 years ago

0.3.10

5 years ago

0.3.6

5 years ago

0.3.5

5 years ago

0.3.8

5 years ago

0.3.7

5 years ago

0.3.4

5 years ago

0.3.3

5 years ago

0.3.2

5 years ago

0.3.1

6 years ago

0.3.0

6 years ago

0.2.0

6 years ago

0.0.7

6 years ago

0.0.5

6 years ago

0.0.6

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago