Enable no-explicit-any throughout production code#3353
Conversation
| /** | ||
| * A command function is a completely untyped command. | ||
| */ | ||
| // eslint-disable-next-line @typescript-eslint/no-explicit-any |
There was a problem hiding this comment.
I couldn't find a good way around this so ended up just ignoring the eslint error. Admittedly I didn't try super hard, but I didn't want to end up with a solution that was unnecessarily complex either.
There was a problem hiding this comment.
I agree that this is the best solution, this is the same error that I ran into yesterday on the CachedOperation, where seemingly ...args: unknown[] isn't well supported.
| * | ||
| * @param callback The callback to call when the event is triggered. | ||
| */ | ||
| // eslint-disable-next-line @typescript-eslint/no-explicit-any |
There was a problem hiding this comment.
We could rewrite this function to avoid any but I'm hesitant because I don't fully understand what it's doing and it's copied verbatim from another source. We could alternatively rewrite this.
| selectedTable: tableName, | ||
| }, | ||
| origResultsPaths: undefined as any, // FIXME: Not used for interpreted, refactor so this is not needed | ||
| origResultsPaths: undefined as unknown as ResultsPaths, // FIXME: Not used for interpreted, refactor so this is not needed |
There was a problem hiding this comment.
This whole situation in ResultsApp.tsx is a bit unfortunate. There are a few arguments where we pass undefined or other "fake" values. I briefly looked at trying to do the refactoring that this comment asks for but I found this area of code very confusing. For now I think doing as unknown as ResultsPaths gets the same effect and isn't any worse than as any. 🤷🏼
| module.exports = { | ||
| overrides: [ | ||
| { | ||
| files: ["*"], | ||
| rules: { | ||
| "@typescript-eslint/no-explicit-any": "off", | ||
| }, | ||
| }, | ||
| ], | ||
| }; |
There was a problem hiding this comment.
Our other overrides are in the root .eslintrc.js file itself. Would it make sense to also move this there?
There was a problem hiding this comment.
Oh good point, you can have multiple overrides for different sets of file paths in the same .eslintrc.js file. Somehow I missed that 🙈 . I'll add them there instead of in separate files.
| /** | ||
| * A command function is a completely untyped command. | ||
| */ | ||
| // eslint-disable-next-line @typescript-eslint/no-explicit-any |
There was a problem hiding this comment.
I agree that this is the best solution, this is the same error that I ran into yesterday on the CachedOperation, where seemingly ...args: unknown[] isn't well supported.
| module.exports = { | ||
| overrides: [ | ||
| { | ||
| files: ["*"], | ||
| rules: { | ||
| "@typescript-eslint/no-explicit-any": "off", | ||
| }, | ||
| }, | ||
| ], | ||
| }; |
There was a problem hiding this comment.
It would be better to add this to the existing override since doing it here results in two different configs being merged.
This PR contains:
@typescript-eslint/no-explicit-anyon all production code (i.e. not tests or build code)anywhere I couldn't find a good solution so I've marked then as ignoredChecklist
ready-for-doc-reviewlabel there.