diff --git a/docs/developer-guide/contributing/pull-requests.md b/docs/developer-guide/contributing/pull-requests.md index 58fe6f9c02a..f1d62e1e922 100644 --- a/docs/developer-guide/contributing/pull-requests.md +++ b/docs/developer-guide/contributing/pull-requests.md @@ -30,7 +30,7 @@ Details about each step are found below. The first step to sending a pull request is to create a new branch in your ESLint fork. Give the branch a descriptive name that describes what it is you're fixing, such as: -```sh +```shell $ git checkout -b issue1234 ``` @@ -42,7 +42,7 @@ You should do all of your development for the issue in this branch. Make the changes to the code and tests, following the [code conventions](../code-conventions.md) as you go. Once you have finished, commit the changes to your branch: -```sh +```shell $ git add -A $ git commit ``` @@ -91,7 +91,7 @@ The commit message format is important because these messages are used to create Before you send the pull request, be sure to rebase onto the upstream source. This ensures your code is running on the latest available code. -```sh +```shell git fetch upstream git rebase upstream/main ``` @@ -100,7 +100,7 @@ git rebase upstream/main After rebasing, be sure to run all of the tests once again to make sure nothing broke: -```sh +```shell npm test ``` @@ -123,13 +123,13 @@ With your code ready to go, this is a good time to double-check your submission Next, push your changes to your clone: -```sh +```shell git push origin issue1234 ``` If you are unable to push because some references are old, do a forced push instead: -```sh +```shell git push -f origin issue1234 ``` @@ -149,13 +149,13 @@ Once your pull request is sent, it's time for the team to review it. As such, pl If your commit message is in the incorrect format, you'll be asked to update it. You can do so via: -```sh +```shell $ git commit --amend ``` This will open up your editor so you can make changes. After that, you'll need to do a forced push to your branch: -```sh +```shell $ git push origin issue1234 -f ``` @@ -163,7 +163,7 @@ $ git push origin issue1234 -f If we ask you to make code changes, there's no need to close the pull request and create a new one. Just go back to the branch on your fork and make your changes. Then, when you're ready, you can add your changes into the branch: -```sh +```shell $ git add -A $ git commit $ git push origin issue1234 @@ -177,13 +177,13 @@ The commit messages in subsequent commits do not need to be in any specific form If your code is out-of-date, we might ask you to rebase. That means we want you to apply your changes on top of the latest upstream code. Make sure you have set up a [development environment](../development-environment.md) and then you can rebase using these commands: -```sh +```shell $ git fetch upstream $ git rebase upstream/main ``` You might find that there are merge conflicts when you attempt to rebase. Please [resolve the conflicts](https://help.github.com/articles/resolving-merge-conflicts-after-a-git-rebase/) and then do a forced push to your branch: -```sh +```shell $ git push origin issue1234 -f ``` diff --git a/docs/developer-guide/development-environment.md b/docs/developer-guide/development-environment.md index 4828476aac8..5be51bd2c6e 100644 --- a/docs/developer-guide/development-environment.md +++ b/docs/developer-guide/development-environment.md @@ -14,7 +14,7 @@ Go to and click the "Fork" button. Follow the Once you've cloned the repository, run `npm install` to get all the necessary dependencies: -```sh +```shell $ cd eslint $ npm install ``` @@ -27,7 +27,7 @@ The *upstream source* is the main ESLint repository where active development hap To add the upstream source for ESLint, run the following in your repository: -```sh +```shell git remote add upstream git@github.com:eslint/eslint.git ``` @@ -49,7 +49,7 @@ Please see the [generator documentation](https://github.com/eslint/generator-esl 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: -```sh +```shell npm test ``` diff --git a/docs/rules/no-mixed-operators.md b/docs/rules/no-mixed-operators.md index 1dca581e81c..d1eac54945d 100644 --- a/docs/rules/no-mixed-operators.md +++ b/docs/rules/no-mixed-operators.md @@ -20,7 +20,7 @@ var foo = a && b || c || d; will generate -```sh +```shell 1:13 Unexpected mix of '&&' and '||'. (no-mixed-operators) 1:18 Unexpected mix of '&&' and '||'. (no-mixed-operators) ``` @@ -31,7 +31,7 @@ var foo = a && b ? c : d; will generate -```sh +```shell 1:13 Unexpected mix of '&&' and '?:'. (no-mixed-operators) 1:18 Unexpected mix of '&&' and '?:'. (no-mixed-operators) ``` diff --git a/docs/user-guide/command-line-interface.md b/docs/user-guide/command-line-interface.md index d30931bf048..1fc05e027ed 100644 --- a/docs/user-guide/command-line-interface.md +++ b/docs/user-guide/command-line-interface.md @@ -234,7 +234,7 @@ This option has the same effect as `--fix` with one difference: the fixes are no Because the default formatter does not output the fixed code, you'll have to use another one (e.g. `json`) to get the fixes. Here's an example of this pattern: -```sh +```shell getSomeText | eslint --stdin --fix-dry-run --format=json ``` @@ -251,7 +251,7 @@ This option allows you to specify the type of fixes to apply when using either ` You can specify one or more fix type on the command line. Here are some examples: -```sh +```shell eslint --fix --fix-type suggestion . eslint --fix --fix-type suggestion --fix-type problem . eslint --fix --fix-type suggestion,layout . diff --git a/docs/user-guide/getting-started.md b/docs/user-guide/getting-started.md index 1cd016b6647..eb0f34d6579 100644 --- a/docs/user-guide/getting-started.md +++ b/docs/user-guide/getting-started.md @@ -12,7 +12,7 @@ Prerequisites: [Node.js](https://nodejs.org/en/) (`^12.22.0`, `^14.17.0`, or `>= You can install ESLint using npm or yarn: -```sh +```shell npm install eslint --save-dev # or @@ -22,7 +22,7 @@ yarn add eslint --dev You should then set up a configuration file, and the easiest way to do that is: -```sh +```shell $ npm init @eslint/config # or @@ -34,7 +34,7 @@ $ yarn create @eslint/config After that, you can run ESLint on any file or directory like this: -```sh +```shell $ npx eslint yourfile.js # or diff --git a/docs/user-guide/migrating-from-jscs.md b/docs/user-guide/migrating-from-jscs.md index b48e9f9fe07..7c79486e5c0 100644 --- a/docs/user-guide/migrating-from-jscs.md +++ b/docs/user-guide/migrating-from-jscs.md @@ -15,7 +15,7 @@ Before beginning the process of migrating to ESLint, it's helpful to understand To install Polyjuice: -```sh +```shell $ npm install -g polyjuice ``` @@ -23,7 +23,7 @@ Polyjuice works with JSON configuration files, so if you're using a JavaScript o To convert your configuration file, pass in the location of your `.jscs.json` file using the `--jscs` flag: -```sh +```shell $ polyjuice --jscs .jscsrc.json > .eslintrc.json ``` @@ -31,7 +31,7 @@ This creates a `.eslintrc.json` with the equivalent rules from `.jscsrc.json`. If you have multiple `.jscsrc.json` files, you can pass them all and Polyjuice will combine them into one `.eslintrc.json` file: -```sh +```shell $ polyjuice --jscs .jscsrc.json ./foo/.jscsrc.json > .eslintrc.json ``` @@ -41,7 +41,7 @@ $ polyjuice --jscs .jscsrc.json ./foo/.jscsrc.json > .eslintrc.json If you don't want to convert your JSCS configuration directly into an ESLint configuration, then you can use ESLint's built-in wizard to get you started. Just run: -```sh +```shell $ npm init @eslint/config ``` @@ -74,7 +74,7 @@ As an example, suppose that you are using the `airbnb` preset, so your `.jscsrc` In order to get the same functionality in ESLint, you would first need to install the `eslint-config-airbnb` shareable config package: -```sh +```shell $ npm install eslint-config-airbnb-base --save-dev ``` @@ -110,13 +110,13 @@ Both JSCS and ESLint have command line arguments corresponding to many of their JSCS uses the `--fix` option to apply automatic fixes to code: -```sh +```shell $ jscs --fix file.js ``` ESLint has the same option: -```sh +```shell $ eslint --fix file.js ``` @@ -124,13 +124,13 @@ $ eslint --fix file.js The JSCS `--auto-configure` option created a configuration based on what it found in a given file: -```sh +```shell $ jscs --auto-configure file.js ``` In ESLint, there's a similar option when you use `--init`. Just select "Inspect your JavaScript file(s)": -```sh +```shell $ eslint --init ? How would you like to configure ESLint? (Use arrow keys) > Answer questions about your style @@ -142,14 +142,14 @@ $ eslint --init JSCS allows you to specify a configuration file to use on the command line using either `--config` or `-c`, such as: -```sh +```shell $ jscs --config myconfig.json file.js $ jscs -c myconfig.json file.js ``` Both flags are also supported by ESLint: -```sh +```shell $ eslint --config myconfig.json file.js $ eslint -c myconfig.json file.js ``` @@ -158,12 +158,12 @@ $ eslint -c myconfig.json file.js In JSCS, you can pipe code in like this: -```sh +```shell $ cat file.js | jscs ``` In ESLint, you can also pipe in code, but you need to use the `--stdin` flag: -```sh +```shell $ cat file.js | eslint --stdin ```