Migrate to ESLint 

Created by: felixfbecker
Closes #2461
Very excited about this one as ESLint has support for a bunch of new rules that we can now check for that often came up in code reviews, e.g. referencing this.state
inside setState()
and many more.
I recreated our TSLint config in https://github.com/sourcegraph/eslint-config and made https://github.com/sourcegraph/tslint-config/tree/eslint contain only the few TSLint rules ESLint doesn't have.
Migratingwas more work than expected but it's a huge improvement to our codebase, e.g. finally refactored all usages of async-unsafe componentWillReceiveProps()
to componentDidUpdate()
, removing unused state properties, ...
Also like the better configurability of ESLint - configuring rules for glob patterns or overriding severity in comments.
I also noticed we were not typechecking our code in CI! So this fixes it.
cc @JoshuaKGoldberg
Merge request reports
Activity
Created by: codecov[bot]
Codecov Report
Merging #5072 into master will increase coverage by
0.04%
. The diff coverage is54.14%
.@@ Coverage Diff @@ ## master #5072 +/- ## ========================================== + Coverage 46.27% 46.32% +0.04% ========================================== Files 732 731 -1 Lines 44909 44872 -37 Branches 2613 2602 -11 ========================================== + Hits 20782 20787 +5 + Misses 22115 22072 -43 - Partials 2012 2013 +1
Impacted Files Coverage Δ shared/src/commandPalette/CommandList.tsx 21.18% <ø> (ø)
browser/src/libs/options/OptionsHeader.tsx 100% <ø> (ø)
shared/src/api/client/services/decoration.ts 63.63% <ø> (ø)
browser/src/libs/options/ServerURLForm.tsx 89.74% <ø> (ø)
shared/src/api/extension/api/types.ts 90% <ø> (ø)
shared/src/util/errors.ts 63.63% <ø> (ø)
shared/src/components/RepoLink.tsx 100% <ø> (ø)
...rowser/src/libs/code_intelligence/test_helpers.tsx 80% <ø> (ø)
shared/src/panel/views/contributions.ts 100% <ø> (ø)
...nsions/extension/RegistryExtensionOverviewPage.tsx 74.07% <ø> (ø)
... and 108 more Created by: felixfbecker
It would be great to get a timely review from someone frontend (currently @chrismwendt or @sqs) since this very prone to merge conflicts. At the same time I could have messed up a refactor somewhere. :)
Created by: JoshuaKGoldberg
Heh, the GitHub editor keeps freezing up my Chrome tab because of how many files there are (have you considered splitting out source file changes where possible?).
But, this brings up a super cool idea: would it have been convenient to have a tool that converts
tslint:disable
comments toeslint-disable
equivalents?Created by: felixfbecker
Do we no longer disallow submodule imports?
We didn't allow submodule imports with TSLint because a package's
index.ts
should export the public API. Importing from deep files is importing internals - if we do that then we cannot confidently evolve our packages anymore. This has been a problem with internal packages in the past.Is ?(x) valid glob syntax? See lsif/server/package.json
Yep, see https://github.com/isaacs/node-glob#glob-primer. What do you mean with "See lsif/server/package.json"?