Fix most lint warnings

Summary:
I noticed that after the typescript upgrade, I got several weird positives from ESLint (like unused parameters in a type definition, which are obviously always unused, e.g. `type onClick = (e: Event) => void`). After some investigation, it turned out these warnings are generated by eslint, but that those rules should be performaned by typescript/eslint instead. For future reference to which rules this applies:

https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/README.md#extension-rules

Updated the config, and while at it, fixed all warnings in our codebase, except for `react-hooks/exhaustive-deps` warnings, since those require semantic changes.

This reduces the amount of eslint warnings from 86 to 39.

Reviewed By: passy

Differential Revision: D23905630

fbshipit-source-id: 0557708fd9ec6b17840a3c191e7d3baf225bdf23
This commit is contained in:
Michel Weststrate
2020-09-28 01:40:50 -07:00
committed by Facebook GitHub Bot
parent aaabe1cc82
commit ecf4cff7cf
26 changed files with 166 additions and 87 deletions

View File

@@ -87,9 +87,16 @@ module.exports = {
files: ['*.tsx', '*.ts'],
parser: '@typescript-eslint/parser',
rules: {
'no-undef': 0, // taken care of by TypeScript already
'import/no-unresolved': 0, // taken care of by TypeScript already
'prettier/prettier': [2, {...prettierConfig, parser: 'typescript'}],
// following rules are disabled because TS already handles it
'no-undef': 0,
'import/no-unresolved': 0,
// following rules are disabled because they don't handle TS correctly,
// while their @typescript-eslint counterpart does
// for reference: https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/README.md#extension-rules
'no-unused-vars': 0,
'no-redeclare': 0,
'@typescript-eslint/no-redeclare': 1,
'@typescript-eslint/no-unused-vars': [
1,
{