0.0.1 • Published 3 years ago

eslint-plugin-dalilint v0.0.1

Weekly downloads
-
License
ISC
Repository
-
Last release
3 years ago

eslint-plugin-dalilint

ESLint 插件,定制 ESLint rule,此 Demo 实现在前端工程中禁用 console.warn() 方法

如何开发

安装包

安装 ESLint:

npm i eslint -D

安装 eslint-plugin-dalilint:

npm i eslint-plugin-dalilint -D

使用

将插件添加到需要使用此插件项目的.eslintrc文件的plugins中:

继承插件配置

在插件中会将所有规则都导出,然后可以使用extends来继承插件的配置。

// .eslintrc.js
module.exports = {
  extends: [ 'plugin:dalilint/daliRule' ] // 继承插件导出的配置
}

单独使用插件中的条规则

// .eslintrc.js
module.exports = {
  plugins: [ 'dalilint' ],
  rules: { 
    "dalilint/no-console-warn": "error"
    // 更多插件规则
 }
}

提供的规则

  • no-console-warn: 禁止使用 console.warn()