From 9e99d1095e3e24c46aeec5e4f29a1b04249c954a Mon Sep 17 00:00:00 2001 From: Ben Perlmutter Date: Wed, 30 Nov 2022 20:14:35 -0500 Subject: [PATCH] add examples --- docs/src/user-guide/getting-started.md | 30 ++++++++++++++++++++------ 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/docs/src/user-guide/getting-started.md b/docs/src/user-guide/getting-started.md index 4d7794f7e85..e84e54b47a0 100644 --- a/docs/src/user-guide/getting-started.md +++ b/docs/src/user-guide/getting-started.md @@ -110,18 +110,34 @@ Before you begin, you must have a `package.json` file already. If you don't, mak 1. Add an `.eslintrc` file in one of the [supported configuration file formats](./configuring/configuration-files#configuration-file-formats). - TODO: add example shell commands for this - -1. Add configuration to the `.eslintrc` file. Refer to the [Configuring ESLint documentation](./configuring/) to learn how ot add rules, environments, custom configurations, plugins, and more. - - TODO: show a sample configuration file using .js extension + ```shell + # Create JavaScript configuration file + touch .eslintrc.js + ``` + +1. Add configuration to the `.eslintrc` file. Refer to the [Configuring ESLint documentation](./configuring/) to learn how to add rules, environments, custom configurations, plugins, and more. + + ```js + // .eslintrc.js example + module.exports = { + "env": { + "browser": true, + "es2021": true + }, + "extends": "eslint:recommended", + "parserOptions": { + "ecmaVersion": "latest", + "sourceType": "module" + }, + } + ``` 1. Lint code using the ESLint CLI: ```sh - npm run eslint + npm run eslint project-dir/ file1.js # OR - npx eslint + npx eslint project-dir/ file1.js ```