Problem
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 same standard-engine
and combines that engine with the official eslint-config-standard-with-typescript
ruleset.
– ts-standard
Solution
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 the eslint-config-standard-with-typescript
shareable config instead and achieve the same results as this project. But ts-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:
- Uninstall
ts-standard
.
- Install
eslint-config-standard-with-typescript
, along with its peer dependencies:
- Configure ESLint, extending the configuration provided by
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'
}
}