/fe-linters

一个包含 prettier,eslint,stylelint 等代码规范校验的配置文件合集

Primary LanguageJavaScriptMIT LicenseMIT

fe-linters

一个包含 prettier,eslint,stylelint 等代码规范校验的配置文件合集

简化 ESLint, StyleLint, commitLint 等工具的使用

功能点

  • ESLint
  • ReactLint
  • StyleLint
  • commitLint

安装

yarn add @sunweibin/linters

使用

eslint rules

项目根目录创建 .eslintrc.js

const { eslint, lintMerge } = require('@sunweibin/linters');

module.exports = lintMerge(eslint, {
  parserOptions: {
    // 使用项目的 babel 配置
    babelOptions: {
      configFile: './babel.config.js',
    },
  },
});

reactlint rules

如果项目使用 React ,项目根目录创建 .eslintrc.js

const { reactlint, lintMerge } = require('@sunweibin/linters');

module.exports = lintMerge(reactlint, {
  parserOptions: {
    // 使用项目的 babel 配置
    babelOptions: {
      configFile: './babel.config.js',
    },
  },
});

stylelint rules

项目根目录创建 .stylelintrc.js

const { stylelint } = require('@sunweibin/linters');

module.exports = stylelint;