diff --git a/docs/user-guide/getting-started.md b/docs/user-guide/getting-started.md index b457ea9405c..5e5caa0cb4b 100644 --- a/docs/user-guide/getting-started.md +++ b/docs/user-guide/getting-started.md @@ -6,31 +6,30 @@ ESLint is a tool for identifying and reporting on patterns found in ECMAScript/J * ESLint uses an AST to evaluate patterns in code. * ESLint is completely pluggable, every single rule is a plugin and you can add more at runtime. -## Getting Started Tutorial - - -*Why ESLint* @0:00, *Installing and using ESLint* @2:20. Full ESLint Course at Pluralsight - ## Installation and Usage Prerequisites: [Node.js](https://nodejs.org/en/) (`^8.10.0`, `^10.13.0`, or `>=11.10.1`) built with SSL support. (If you are using an official Node.js distribution, SSL is always built in.) -You can install ESLint using npm: +You can install ESLint using npm or yarn: ``` -$ npm install eslint --save-dev +npm install eslint --save-dev + +# or + +yarn add eslint --dev ``` You should then set up a configuration file: ``` -$ ./node_modules/.bin/eslint --init +$ npx eslint --init ``` After that, you can run ESLint on any file or directory like this: ``` -$ ./node_modules/.bin/eslint yourfile.js +$ npx eslint yourfile.js ``` It is also possible to install ESLint globally rather than locally (using `npm install eslint --global`). However, this is not recommended, and any plugins or shareable configs that you use must be installed locally in either case. @@ -61,7 +60,9 @@ The three error levels allow you fine-grained control over how ESLint applies ru Your `.eslintrc` configuration file will also include the line: ```json +{ "extends": "eslint:recommended" +} ``` Because of this line, all of the rules marked "(recommended)" on the [rules page](/docs/rules) will be turned on. Alternatively, you can use configurations that others have created by searching for "eslint-config" on [npmjs.com](https://www.npmjs.com/search?q=eslint-config). ESLint will not lint your code unless you extend from a shared configuration or explicitly turn rules on in your configuration.