0.3.0 • Published 4 months ago

@ghlandy/eslint-config-prettier v0.3.0

Weekly downloads
-
License
MIT
Repository
github
Last release
4 months ago

@ghlandy/eslint-config-prettier

使用

pnpm i -D @ghlandy/eslint-config-prettier eslint@8 prettier@2
pnpm i -D eslint-config-prettier@8 eslint-plugin-prettier@4

在 eslint 配置文件 (.eslintrc.cjs.eslintrc.js) 中引入使用

module.exports = {
  // ... 其他配置
  extends: [
    'eslint:recommended'
    // ... 其他配置
    '@ghlandy/eslint-config-prettier', // 放在最后
  ],
  // ... 其他配置
};

配置详细

module.exports = {
  extends: ['plugin:prettier/recommended'],
  rules: {
    'prettier/prettier': 'warn',
  },
};

plugin:prettier/recommended 的实际作用如下:

module.exports = {
  extends: ['prettier'],
  plugins: ['prettier'],
  rules: {
    'prettier/prettier': 'error',
    'arrow-body-style': 'off',
    'prefer-arrow-callback': 'off',
  },
};

设置规则 prettier/prettier': 'warn',另外去设置保存自动 prettier 格式化或者 pre-commit 钩子去格式化即可

更多阅读

License

MIT

0.3.0

4 months ago

0.2.0

4 months ago

0.1.1

6 months ago

0.1.0

10 months ago