1 # Development Environment
3 ESLint 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.
5 ## Step 1: Install Node.js
7 Go to <https://nodejs.org/> to download and install the latest stable version for your operating system.
9 Most of the installers come with [npm](https://www.npmjs.com/) already installed, but if for some reason it doesn't work on your system, you can install it manually using the instructions on the site.
11 ## Step 2: Fork and checkout your own ESLint repository
13 Go 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.
15 Once you've cloned the repository, run `npm install` to get all the necessary dependencies:
22 You must be connected to the Internet for this step to work. You'll see a lot of utilities being downloaded.
24 ## Step 3: Add the upstream source
26 The *upstream source* is the main ESLint repository that active development happens on. 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.
28 To add the upstream source for ESLint, run the following in your repository:
31 git remote add upstream git@github.com:eslint/eslint.git
34 Now, the remote `upstream` points to the upstream source.
36 ## Step 4: Install the Yeoman Generator
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:
42 Then, you can install the ESLint Yeoman generator:
44 npm install -g generator-eslint
46 Please see the [generator documentation](https://github.com/eslint/generator-eslint) for instructions on how to use it.
48 ## Step 5: Run the tests
50 Running 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:
56 The 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.
58 ## Reference Information
62 Once 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).
66 ESLint has several build scripts that help with various parts of development.
70 The primary script to use is `npm test`, which does several things:
72 1. Lints all JavaScript (including tests) and JSON
73 1. Runs all tests on Node.js
74 1. Checks code coverage targets
75 1. Generates `build/eslint.js` for use in a browser
76 1. Runs a subset of tests in PhantomJS
78 Be sure to run this after making changes and before sending a pull request with your changes.
80 **Note:** The full code coverage report is output into `/coverage`.
84 Runs just the JavaScript and JSON linting on the repository
88 Generates `build/eslint.js`, a version of ESLint for use in the browser
92 Generates JSDoc documentation and places it into `/jsdoc`.
96 This command is used for intensive profiling of ESLint using Chrome Developer Tools. It starts a development server that runs through three profiles:
98 * Large - Runs ESLint on JSHint
99 * Medium - Runs ESLint on jQuery
100 * Small - Runs ESLint on KnockoutJS
102 Your browser should automatically open to the page in question. When that happens:
104 1. Open up developer tools
107 You should start to see profiles for each run show up on the left side. If not, reload the page in the browser. Once all three profiles have completed, they will be available for inspection.