]> git.proxmox.com Git - pve-eslint.git/blame - eslint/docs/developer-guide/development-environment.md
import 8.4.0 source
[pve-eslint.git] / eslint / docs / developer-guide / development-environment.md
CommitLineData
eb39fafa
DC
1# Development Environment
2
3ESLint has a very lightweight development environment that makes updating code fast and easy. This is a step-by-step guide to setting up a local development environment that will let you contribute back to the project.
4
5## Step 1: Install Node.js
6
7Go to <https://nodejs.org/> to download and install the latest stable version for your operating system.
8
6f036462 9Most of the installers already come with [npm](https://www.npmjs.com/) but if for some reason npm doesn't work on your system, you can install it manually using the instructions on the site.
eb39fafa
DC
10
11## Step 2: Fork and checkout your own ESLint repository
12
13Go to <https://github.com/eslint/eslint> and click the "Fork" button. Follow the [GitHub documentation](https://help.github.com/articles/fork-a-repo) for forking and cloning.
14
15Once you've cloned the repository, run `npm install` to get all the necessary dependencies:
16
34eeec05 17```sh
eb39fafa
DC
18$ cd eslint
19$ npm install
20```
21
22You must be connected to the Internet for this step to work. You'll see a lot of utilities being downloaded.
23
24## Step 3: Add the upstream source
25
6f036462 26The *upstream source* is the main ESLint repository where active development happens. While you won't have push access to upstream, you will have pull access, allowing you to pull in the latest code whenever you want.
eb39fafa
DC
27
28To add the upstream source for ESLint, run the following in your repository:
29
34eeec05 30```sh
eb39fafa
DC
31git remote add upstream git@github.com:eslint/eslint.git
32```
33
34Now, the remote `upstream` points to the upstream source.
35
36## Step 4: Install the Yeoman Generator
37
38[Yeoman](http://yeoman.io) is a scaffold generator that ESLint uses to help streamline development of new rules. If you don't already have Yeoman installed, you can install it via npm:
39
40 npm install -g yo
41
42Then, you can install the ESLint Yeoman generator:
43
44 npm install -g generator-eslint
45
46Please see the [generator documentation](https://github.com/eslint/generator-eslint) for instructions on how to use it.
47
48## Step 5: Run the tests
49
50Running the tests is the best way to ensure you have correctly set up your development environment. Make sure you're in the `eslint` directory and run:
51
34eeec05 52```sh
eb39fafa
DC
53npm test
54```
55
56The testing takes a few minutes to complete. If any tests fail, that likely means one or more parts of the environment setup didn't complete correctly. The upstream tests always pass.
57
58## Reference Information
59
60### Workflow
61
62Once you have your development environment installed, you can make and submit changes to the ESLint source files. Doing this successfully requires careful adherence to our [pull-request submission workflow](contributing/pull-requests.md).
63
64### Build Scripts
65
66ESLint has several build scripts that help with various parts of development.
67
68#### npm test
69
70The primary script to use is `npm test`, which does several things:
71
721. Lints all JavaScript (including tests) and JSON
731. Runs all tests on Node.js
741. Checks code coverage targets
751. Generates `build/eslint.js` for use in a browser
761. Runs a subset of tests in PhantomJS
77
78Be sure to run this after making changes and before sending a pull request with your changes.
79
80**Note:** The full code coverage report is output into `/coverage`.
81
82#### npm run lint
83
609c276f 84Runs just the JavaScript and JSON linting on the repository.
eb39fafa
DC
85
86#### npm run webpack
87
609c276f 88Generates `build/eslint.js`, a version of ESLint for use in the browser.