]> git.proxmox.com Git - pve-eslint.git/blame - eslint/docs/src/developer-guide/development-environment.md
build: add missing dh-nodejs to build-dependencies
[pve-eslint.git] / eslint / docs / src / developer-guide / development-environment.md
CommitLineData
8f9d1d4d
DC
1---
2title: Development Environment
3layout: doc
4eleventyNavigation:
5 key: set up a development environment
6 parent: developer guide
7 title: Set Up a Development Environment
8 order: 2
9
10---
eb39fafa
DC
11
12ESLint 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.
13
14## Step 1: Install Node.js
15
16Go to <https://nodejs.org/> to download and install the latest stable version for your operating system.
17
6f036462 18Most 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
19
20## Step 2: Fork and checkout your own ESLint repository
21
22Go 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.
23
24Once you've cloned the repository, run `npm install` to get all the necessary dependencies:
25
8f9d1d4d
DC
26```shell
27cd eslint
28npm install
eb39fafa
DC
29```
30
31You must be connected to the Internet for this step to work. You'll see a lot of utilities being downloaded.
32
33## Step 3: Add the upstream source
34
6f036462 35The *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
36
37To add the upstream source for ESLint, run the following in your repository:
38
8f9d1d4d 39```shell
eb39fafa
DC
40git remote add upstream git@github.com:eslint/eslint.git
41```
42
43Now, the remote `upstream` points to the upstream source.
44
45## Step 4: Install the Yeoman Generator
46
47[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:
48
8f9d1d4d
DC
49```shell
50npm install -g yo
51```
eb39fafa
DC
52
53Then, you can install the ESLint Yeoman generator:
54
8f9d1d4d
DC
55```shell
56npm install -g generator-eslint
57```
eb39fafa
DC
58
59Please see the [generator documentation](https://github.com/eslint/generator-eslint) for instructions on how to use it.
60
61## Step 5: Run the tests
62
63Running 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:
64
8f9d1d4d 65```shell
eb39fafa
DC
66npm test
67```
68
69The 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.
70
71## Reference Information
72
73### Workflow
74
8f9d1d4d 75Once 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).
eb39fafa
DC
76
77### Build Scripts
78
79ESLint has several build scripts that help with various parts of development.
80
81#### npm test
82
83The primary script to use is `npm test`, which does several things:
84
851. Lints all JavaScript (including tests) and JSON
861. Runs all tests on Node.js
871. Checks code coverage targets
881. Generates `build/eslint.js` for use in a browser
891. Runs a subset of tests in PhantomJS
90
91Be sure to run this after making changes and before sending a pull request with your changes.
92
93**Note:** The full code coverage report is output into `/coverage`.
94
95#### npm run lint
96
609c276f 97Runs just the JavaScript and JSON linting on the repository.
eb39fafa
DC
98
99#### npm run webpack
100
609c276f 101Generates `build/eslint.js`, a version of ESLint for use in the browser.