eslint

eslint 扩展

eslint 扩展:standard,airbnb,eslint-config-alloy等。

eslint 扩展做了

  • 在原有的 eslint 的基础上配置些 config(具体规则参数,全局变量,运行环境等)
  • 自定义些自己的 rule,以满足需求

eslint 自身配置已经无法满足业务需求。如

  • eslint-plugin-vue
  • eslint-plugin-react
  • eslint-plugin-jest

一般特殊场景的自定义规则都使用 eslint-plugin-* 的命名,使用时可以方便的写成

1
2
3
4
5
6
7
{
plugins: [
'vue',
'react',
'jest'
]
}

eslint-config-* 同理,不过配置时需要写成

1
2
3
{
extends: 'standard'
}

社区有些比较热门的代码规范,比如standardjs、airbnb。

Prettier

统一代码风格的利器。


相关资料
我是如何在公司项目中使用ESLint来提升代码质量的
开发 eslint 规则
使用ESLint+Prettier来统一前端代码风格
深入理解 ESLint
ESLint 在中大型团队的应用实践
ESLint进阶指南
ESLint + Prettier 规范前端代码
ESLint和Prettier的混合使用
从零构建前端 ESLint 工作流(2020 手把手版)

作者

Fallen-down

发布于

2020-08-04

更新于

2020-09-07

许可协议

You need to set install_url to use ShareThis. Please set it in _config.yml.
You forgot to set the business or currency_code for Paypal. Please set it in _config.yml.

评论

You forgot to set the shortname for Disqus. Please set it in _config.yml.
You need to set client_id and slot_id to show this AD unit. Please set it in _config.yml.