A linting configuration controls which rules a linter applies. In an .eslintrc file, the rules object maps rule names to values such as 1 or 0, enabling or disabling checks globally. section 6.3.1
Global settings are useful for project-wide preferences, such as accepting let instead of const. They are less suitable for temporary exceptions: a line comment beginning with eslint-disable-line can suppress a named rule for one statement, such as a debugger statement used during investigation. section 6.3.1
Listing 6.12 Disabling a linter rule in the .eslintrc file in the tools folder
{
"root": true,
"ignorePatterns": ["node_modules", "dist"],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": "./tsconfig.json"
},
"plugins": [
"@typescript-eslint"
],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended"
],
"rules": {
"prefer-const": 0
}
}
The configuration listing shows an ESLint setup for TypeScript and disables prefer-const with a rules entry. section 6.3.1
Suppressing one warning
debugger; // eslint-disable-line no-debugger section 6.3.1
