diff --git a/README.md b/README.md index 4103213..f171dbe 100644 --- a/README.md +++ b/README.md @@ -4,20 +4,42 @@ [![Build Status](https://api.travis-ci.org/WordPress-Coding-Standards/eslint-config-wordpress.svg?branch=master)](https://travis-ci.org/WordPress-Coding-Standards/eslint-config-wordpress) [![bitHound Overall Score](https://www.bithound.io/github/WordPress-Coding-Standards/eslint-config-wordpress/badges/score.svg)](https://www.bithound.io/github/WordPress-Coding-Standards/eslint-config-wordpress) [![NPM version](http://img.shields.io/npm/v/eslint-config-wordpress.svg)](https://www.npmjs.org/package/eslint-config-wordpress) +## Requirements + +### npm + +If you do not have npm installed on your computer, [follow the instructions here](https://www.npmjs.com/get-npm). + +Next you will need to have npm set up for your JavaScript project. If you do not see a `package.json` file in your project's directory, run `npm init` within that directory and follow the prompts to create one. You do not need to answer all the questions if you do not plan to be publishing your project to npm, so accepting the defaults is usually fine. You can also edit the configuration later by editing your `package.json` file. + +### eslint + +After that you will need to have eslint installed for your project. If it is not installed already, run the following command: + +```console +$ npm install --save-dev eslint +``` + ## Installation +If the requirements are satisfied, you can install this plugin as follows: + ```console -$ npm install eslint-config-wordpress +$ npm install --save-dev eslint-config-wordpress ``` -## Usage +## Configuration + +To use this plugin, you must have an eslint configuration file for your project. [There are several different formats for this config file](https://eslint.org/docs/user-guide/configuring#configuration-file-formats). In your config file you will need to find or create a section called "extends" and add "wordpress" to that section. -Add this to your `.eslintrc.json` file: +For example, if you are using the JSON file `.eslintrc.json`, it should look something like this: ```json -"extends": "wordpress" +{ + "extends": "wordpress" +} ``` -If you are using YAML or JavaScript for your [ESLint configuration file format](http://eslint.org/docs/user-guide/configuring#configuration-file-formats) ensure you use the correct syntax for the language used. +There may be other sections in your config file as well. [Read more about configuring eslint here](https://eslint.org/docs/user-guide/configuring). ## [License](LICENSE)