1.0.7 • Published 2 years ago

@pluve/eslint-config-sumire v1.0.7

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

如何使用

此规则是 Eslint的推荐规则,还额外集成了 拼写检测工具prettier等工具,在项目中,只需要引入此工具,就能得到完整的Eslint检测功能(prettier)需要添加自定义配置

npm install @pluve/eslint-config-sumire --save-dev

执行此命令即可得到规则支持

规则覆盖

在需要进行Eslint配置文件覆盖的时候,需要进行配置文件的继承,在项目根目录下,新建.eslintrc.js文件,并在extends中添加配置

module.exports = {
  ...
  extends: ["@pluve/eslint-config-sumire"],
  rules: {
   // you rules
  },
};

即可得到单独的配置支持,默认规则是全局的配置,即不针对任何框架处理,如果需要对React.js进行单独集成处理,你应该引入

module.exports = {
  ...
  extends: ["@pluve/eslint-config-sumire/react"],
  rules: {
   // you rules
  },
};

即可得到对应的react规则支持,同理,Vue.js也对应"@pluve/eslint-config-sumire/vue"配置

单独配置

拼写检测集成了单独的配置文件,你需要在根目录新建pluve.eslint.config.js文件,插件会自动读取文件配置,配置详情如下

module.exports = {
  spellcheck = {
    skipWords: [], // 拼写检测跳过的单词
    minLength: 3, // 检测最小长度
    moduleList: [], // 忽略的依赖库名称
    skipIfMatch: [], // 正则配置跳过
    comments: false, // 是否检测注释
    strings: false, // 是否检测字符串
    identifiers: false, // 是否检测定义的变量及函数
    templates: false, // 是否检测模板字符串
  },
}

TIP

规则内已经集成 prettiereslint-plugin-vueeslint-plugin-react-hookseslint-plugin-react@typescript-eslint/eslint-plugin等配置,无需安装其他依赖