Developer Guide
This guide is intended for those who wish to:
该指南的目的是为那些希望:
- Contribute code to ESLint
- 贡献代码到ESLint
- Create their own rules for ESLint
- 为ESLint创建自己的规则
In order to work with ESLint as a developer, it’s recommended that:
为了作为一个开发者参与到ESLint项目中,推荐:
- You know JavaScript, since ESLint is written in JavaScript.
- 你熟悉JavaScript,因为ESLint是用Javascript写的。
- You have some familiarity with Node.js, since ESLint runs on it.
- 你对Node.js有一定的了解,因为ESLint运行Node.js上。
- You’re comfortable with command-line programs.
- 你熟悉命令行编程。
- You understand unit tests and why they’re important.
- 你了解单元测试,知道他们的重要性。
If that sounds like you, then continue reading to get started.
如果上面说的都符合你,那么继续阅读。
Section 1: Get the Source Code
Before you can get started, you’ll need to get a copy of the ESLint source code. This section explains how to do that and a little about the source code structure.
在你开始之前,你需要获取ESLint的源码。本节解释如何获取源码和源码结构。
Section 2: Set up a Development Environment
Developing for ESLint is a bit different than running it on the command line. This section shows you how to set up a development environment and get you ready to write code.
ESLint开发与在命令行上运行有些不同。本节将向你展示如何设置开发环境,并且让你准备好写代码。
Section 3: Run the Unit Tests
There are a lot of unit tests included with ESLint to make sure that we’re keeping on top of code quality. This section explains how to run the unit tests.
ESLint中有很多单元测试来确保我们保持高质量的代码。本节解释如何运行单元测试。
Section 4: Working with Rules
You’re finally ready to start working with rules. You may want to fix an existing rule or create a new one. This section explains how to do all of that.
你终于开始使用该规则了。你可能想要修复一个现有规则或创建一个新的。本节解释如何做到这些。
Section 5: Working with Plugins
You’ve developed library-specific rules for ESLint and you want to share it with the community. You can publish an ESLint plugin on npm.
你为ESLint开发了特定的规则,想分享到社区。你在npm上发布一个ESLint插件。
Section 6: Working with Custom Parsers
If you aren’t going to use the default parser of ESLint, this section explains about using custom parsers.
如果您不打算使用ESLint的默认解析器,本节将解释如何使用自定义解析器。
Section 7: Node.js API
If you’re interested in writing a tool that uses ESLint, then you can use the Node.js API to get programmatic access to functionality.
如果你很感兴趣使用ESLint写一个工具,你可以使用 Node.js API。
Section 8: Contributing
Once you’ve made changes that you want to share with the community, the next step is to submit those changes back via a pull request.
一旦你做出了与社区共享的更改,下一步就是通过发送 pull 请求提交这些更改。