@ableco/coding-standards-javascript 中文文档教程
@ableco/coding-standards-javascript
使用 https://github.com/ableco/eslint-config
How does it work?
@ableco/coding-standards-javascript
的 Able 自动 linting 要求您运行 npx coding-standards-javascript
在项目的根目录中复制 ESLint 和 Prettier 配置文件。
它还会安装 @arkweid/lefthook
来复制一个 lefthook.yml
文件来运行 ESLint 和 Prettier 基于 < code>@ableco/eslint-config 配置在预提交阶段。
如果这些配置文件中的任何一个已经存在,则应手动更新它们以反映 @ableco/coding-standards-javascript
提供的内容(例如,如果一个项目已经有一个ESLint 配置文件)。
Installation
Using yarn:
yarn add @ableco/coding-standards-javascript --dev
Using npm:
npm install @ableco/coding-standards-javascript --save-dev
Usage
运行npx coding-standards -javascript
并按照说明进行操作。
它将尝试复制以下文件:
.eslintrc.js
.prettierrc.json
(or.prettierrc.js
or.prettierrc
, in that order)lefthook.yml
如果这些文件中的任何一个已经存在,它将在控制台输出中显示这些文件的内容,并让您手动复制和粘贴这些配置。
For husky
users
如果您的项目已经使用 husky,我们建议您通过运行以下命令卸载它:
npm uninstall husky
删除之前由 husky 添加的任何 git 钩子。
Contributing
欢迎在 GitHub 上访问错误报告和请求请求,网址为 https://github.com/ableco/coding-standards-javascript。
@ableco/coding-standards-javascript
Automated linting for Able using https://github.com/ableco/eslint-config
How does it work?
@ableco/coding-standards-javascript
requires you to run npx coding-standards-javascript
in your project's root directory to copy ESLint and Prettier configuration files.
It also installs @arkweid/lefthook
to copy a lefthook.yml
file to run ESLint and Prettier based on @ableco/eslint-config
configuration in a pre-commit stage.
In case any of these configuration files already exists, they should be updated manually to reflect the contents of the ones provided by @ableco/coding-standards-javascript
(for example, in case a project already has an ESLint configuration file).
Installation
Using yarn:
yarn add @ableco/coding-standards-javascript --dev
Using npm:
npm install @ableco/coding-standards-javascript --save-dev
Usage
Run npx coding-standards-javascript
and follow the instructions.
It will try to copy the following files:
.eslintrc.js
.prettierrc.json
(or.prettierrc.js
or.prettierrc
, in that order)lefthook.yml
In case any of these files already exists, it will shows the content of those files in the console's output and let you copy and paste those configurations manually.
For husky
users
In case your project already uses husky we recommend you to uninstall it by running:
npm uninstall husky
To remove any git hook previously added by husky.
Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/ableco/coding-standards-javascript.