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
Labels
accepting prsGo ahead, send a pull request that resolves this issueenhancement: plugin rule optionNew rule option for an existing eslint-plugin rulegood first issueGood for newcomerslocked due to agePlease open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing.package: eslint-pluginIssues related to @typescript-eslint/eslint-plugin
Description
i like the concept of the checker, but it's a pain in the butt in practice if you use third party libraries with typings and hope to use typescript's inference engine, because it errors like crazy.
Repro
Install one of many popular libraries:
yarn add -D ava# or maybeyarn add io-ts
{"rules": {"@typescript-eslint/prefer-readonly-parameter-types": ["error"] }}
// ava - t is not deeply readonly so it errors// ava's typings don't make this deeply readonly, so it's clear why this would failimporttestfrom"ava";test('Stub',(t)=>{t.is(1,1);});
or maybe
importtfromio-ts;// this fails as well - which is extra frustrating since that library even goes to lengths to make things readonly in its typings!// though I'm guessing it's triggering on the `unknown` values, which isnt feasible to eliminate for this library// https://github.com/gcanti/io-ts/blob/73d92a08c42dca3d874927d92c8e9ad30d0a11f5/src/index.ts#L28constparseValidationError=(error:t.ValidationError)=>{returnerror;}
Expected Result
- that there be configuration options to make the rule more usable for third party typings, some kind of escape hatch that doesn't involve adding an eslint ignore comment over and over again all over my app for inferred types - for example the
unknown
values inio-ts
are essential to its usage, and I trust it, so I'm OK with letting anything fromio-ts
slide - also that there be a little more detail on what exactly was not readonly, since it's sometimes not straightforward to tell from complex types especially from third party libraries what might be wrong, so it's hard for me to make ticket for third parties when it happens
Actual Result
Errors that I can't fix since it's not my typings, besides just ignoring the rule or turning it off
Versions
package | version |
---|---|
@typescript-eslint/eslint-plugin | 2.29.0 |
@typescript-eslint/parser | 2.29.0 |
TypeScript | 3.9.3 |
ESLint | 6.8.0 |
node | 12.16.3 |
npm | 6.14.4 |
Metadata
Metadata
Assignees
Labels
accepting prsGo ahead, send a pull request that resolves this issueenhancement: plugin rule optionNew rule option for an existing eslint-plugin rulegood first issueGood for newcomerslocked due to agePlease open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing.package: eslint-pluginIssues related to @typescript-eslint/eslint-plugin