# How to disable an ESLint rule

> Learn how to disable an ESLint rule for a whole file, a single block or line, or globally in your package.json, with examples for no-console and no-debugger.

Author: Flavio Copes | Published: 2019-12-16 | Updated: 2021-02-23 | Canonical: https://flaviocopes.com/how-to-disable-eslint-rule/

What can you do to disable one [ESLint](https://flaviocopes.com/eslint/) rule that is perhaps set automatically by your tooling?

Consider the case where your tooling set the [`no-debugger`](https://eslint.org/docs/rules/no-debugger) and [`no-console`](https://eslint.org/docs/rules/no-console) rules.

There might be a valid reason for production code, but in development mode, having the ability to access the [browser debugger](https://flaviocopes.com/javascript-debugging/) and the [Console API](https://flaviocopes.com/console-api/) is essential.

You can disable one or more specific ESLint rules for a whole file by adding on a few lines:

```js
/* eslint-disable no-debugger, no-console */
console.log('test')
```

or you can just do so in a block, re-enabling it afterwards:

```js
/* eslint-disable no-debugger, no-console */
console.log('test')
/* eslint-enable no-alert, no-console */
```

Or you can disable the rule on a specific line:

```js
console.log('test') // eslint-disable-line no-console
```

```js
debugger // eslint-disable-line no-debugger
```

```js
alert('test') // eslint-disable-line no-alert
```

Another way is to disable it globally for the project.

In `package.json` you can find the `eslintConfig` rule, which might have some content already, like this:

```json
  "eslintConfig": {
    "extends": [
      "react-app",
      "react-app/jest"
    ]
  },
```

Here you can disable the rules you want to disable:

```json
  "eslintConfig": {
    "extends": [
      "react-app",
      "react-app/jest"
    ],
    "rules": {
      "no-unused-vars": "off"
    }
  },
```
