Skip to content

docs: update getting-started config to match default generated config #19308

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Jan 17, 2025
Next Next commit
Docs: Update getting-started config example to match CLI output (#19283)
Updated the config example to make it almost match with default config
.
  • Loading branch information
devnchill committed Jan 17, 2025
commit e2d010269ce3d0b1eb303c9f3a817353338daf1e
40 changes: 8 additions & 32 deletions docs/src/use/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,43 +51,19 @@ After that, you can run ESLint on any file or directory like this:

**Note:** If you are coming from a version before 9.0.0 please see the [migration guide](configure/migration-guide).

After running `npm init @eslint/config`, you'll have an `eslint.config.js` (or `eslint.config.mjs`) file in your directory. In it, you'll see some rules configured like this:
When you run `npm init @eslint/config` , terminal would provide you different options to create a config file `eslint.config.js` (or `eslint.config.mjs`) as per your need .

```js
// eslint.config.js
export default [
{
rules: {
"no-unused-vars": "error",
"no-undef": "error"
}
}
];
```

The names `"no-unused-vars"` and `"no-undef"` are the names of [rules](../rules) in ESLint. The first value is the error level of the rule and can be one of these values:

* `"off"` or `0` - turn the rule off
* `"warn"` or `1` - turn the rule on as a warning (doesn't affect exit code)
* `"error"` or `2` - turn the rule on as an error (exit code will be 1)

The three error levels allow you fine-grained control over how ESLint applies rules (for more configuration options and details, see the [configuration docs](configure/)).

Your `eslint.config.js` configuration file will also include a recommended configuration, like this:
For example if you select *browser* and choose to install the *dependencies* , you will get a config like the one shown below .

```js
// eslint.config.js
import js from "@eslint/js";
import globals from "globals";
import pluginJs from "@eslint/js";


/** @type {import('eslint').Linter.Config[]} */
export default [
js.configs.recommended,

{
rules: {
"no-unused-vars": "warn",
"no-undef": "warn"
}
}
{languageOptions: { globals: globals.browser }},
pluginJs.configs.recommended,
];
```

Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy