Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork2.8k
Closed
Description
Before You File a Bug Report Please Confirm You Have Done The Following...
- I have tried restarting my IDE and the issue persists.
- I have updated to the latest version of the packages.
- I havesearched for related issues and found none that matched my issue.
- I haveread the FAQ and my problem is not listed.
Issue Description
The default options for the@typescript-eslint/consistent-type-assertions rule are:
defaultOptions:[{assertionStyle:'as',objectLiteralTypeAssertions:'allow',},],
If a user wishes to override just theobjectLiteralTypeAssertions option to'never', but retain the defaultassertionStyle option'as', the expectation is that they could omit theassertionStyle option from their config, e.g.
"@typescript-eslint/consistent-type-assertions":["error",{objectLiteralTypeAssertions:'never',},],
Default rule options should be deeply merged with any user-supplied config, so the expected merged result would be:
{assertionStyle:'as',objectLiteralTypeAssertions:'never',},
However this results in the following error:
❯ eslintOops! Something went wrong! :(ESLint: 9.16.0Error: Key "rules": Key "@typescript-eslint/consistent-type-assertions": Value {"objectLiteralTypeAssertions":"never"} should NOT have additional properties. Unexpected property "objectLiteralTypeAssertions". Expected properties: "assertionStyle". Value {"objectLiteralTypeAssertions":"never"} should have required property 'assertionStyle'. Value {"objectLiteralTypeAssertions":"never"} should match exactly one schema in oneOf.It would seem that the user-supplied config is completely replacing the default options instead of being merged?
Reproduction Repository Link
https://github.com/scottohara/ts-eslint-consistent-type-assertions
Repro Steps
- clone the repo
npm installeslint
Versions
| package | version |
|---|---|
typescript-eslint | 8.17.0 |
TypeScript | 5.7.2 |
ESLint | 9.16.0 |
node | 22.11.0 |