@12core/eslint-config-12core 中文文档教程
eslint-config-12core
一个可共享的 eslint 配置。
Usage
npm i @12core/eslint-config-12core eslint --save-dev
然后在您的目录的根目录中创建一个 .eslintrc.json
文件:
{
"extends": "@12core/eslint-config-12core"
}
然后在您想要 lint 的任何代码上运行 eslint
eslint --ext .js esm/
:将 linting步骤作为测试脚本的一部分。
What
@12core/eslint-config-12core
将 standard + standard-jsx 与适用于 little-core-labs 所有人的额外配置捆绑在一起。
因为我们控制了可共享的配置,通常依赖于对等的 eslint 插件实际上被包含为瞬态依赖,所以这个配置的使用更加方便(只有 2 个依赖,而不是 5+)。
Contributing
如果您想更改规则,请提交 PR 并与 rational 进行一些讨论。
Editor plugins
你应该使用编辑器插件,这样你就可以在工作时看到警告,并利用自动格式化:
VSCode
Sublime
- SublimeLinter
- SublimeLinter-eslint
- StandardFormat (can be customized to run eslint --fix)
Your favorite editor
......请注意你的 PR!
React
如果您想使用标准的 React 插件,请按照以下步骤操作:使用以下
Install deps
npm i @12core/eslint-config-12core eslint babel-eslint eslint-config-standard-react --save-dev
Create eslint config
内容创建一个 .eslintrc.json
。
{
"parser": "babel-eslint",
"extends": ["@12core/eslint-config-12core", "standard-react"]
}
Run eslint
eslint --ext .js esm/
eslint-config-12core
A shareable eslint config for 12core projects.
Usage
npm i @12core/eslint-config-12core eslint --save-dev
Then create an .eslintrc.json
file in the root of your directory:
{
"extends": "@12core/eslint-config-12core"
}
Then run eslint on whatever code you want to lint:
eslint --ext .js esm/
Make the linting step part of your testing script.
What
@12core/eslint-config-12core
bundles standard + standard-jsx with additional consutomizations that work for all of us at little-core-labs.
Because we control the shareable config, the normally peer-dependent eslint plugins are actually included as transient dependencies, so that usage of this config is a lot more convenient (only 2 deps, instead if 5+).
Contributing
If you would like to make rule changes, please submit a PR with some discussion with rational.
Editor plugins
You should use an editor plugin so that you can see the warnings while working, and take advantage of auto formatting:
VSCode
Sublime
- SublimeLinter
- SublimeLinter-eslint
- StandardFormat (can be customized to run eslint --fix)
Your favorite editor
… please PR notes you have!
React
If you want to use the standard react plugin, follow these steps:
Install deps
npm i @12core/eslint-config-12core eslint babel-eslint eslint-config-standard-react --save-dev
Create eslint config
Create a .eslintrc.json
with the following.
{
"parser": "babel-eslint",
"extends": ["@12core/eslint-config-12core", "standard-react"]
}
Run eslint
eslint --ext .js esm/