Reputation: 61
In my TypeScript project I am using the node modules "typescript" and "ts-standard". As IDE I am using Visual Studio Code with the "StandardJS - JavaScript Standard Style" extension. In its settings "Engine" is set to "ts-standard".
To disable a certain ESLint rule for one line I could write /* eslint-disable-next-line padded-blocks */
right above that line.
To disable a certain ESLint rule for one file I could write /* eslint-disable padded-blocks */
at the top of the file.
How do I disable a certain ESLint rule for the whole project/package/workspace?
Upvotes: 6
Views: 6858
Reputation: 9701
Standard.js, and consequently ts-standard, does not allow configuration of rules out-of-the-box:
I disagree with rule X, can you change it?
No. [...]
– Standard.js
🚫 Please change X rule
This project has no control over the rules implemented, as such this project cannot change any of the rules that have been configured. If you want to discuss the rules, please visit the rules configuration repo
eslint-config-standard-with-typescript
.🧙 Why
This utility was designed to be the
standard
equivalent for typescript. Underneath the hood, this utility uses the samestandard-engine
and combines that engine with the officialeslint-config-standard-with-typescript
ruleset.
– ts-standard
The documentation above, however, does detail how you could get the ability to configure the rules:
You can also choose to just use
eslint
with theeslint-config-standard-with-typescript
shareable config instead and achieve the same results as this project. Butts-standard
saves you from having to manually install all the extra dependencies and may reduce configuration overhead.
– ts-standard
So what you must do is:
ts-standard
.eslint-config-standard-with-typescript
, along with its peer dependencies:
eslint-config-standard-with-typescript
, in an ESLint configuration file. An example, in an .eslintrc.js
:module.exports = {
extends: 'standard-with-typescript',
parserOptions: {
project: './tsconfig.json'
}
}
At this point, you can now specify your own rules in the ESLint configuration file, with the rules
key. An example, continuing from the previous:
module.exports = {
extends: 'standard-with-typescript',
parserOptions: {
project: './tsconfig.json'
},
rules: {
'padded-blocks': 'off'
}
}
Upvotes: 1