react-native-community/discussions-and-proposals

Replacing TSLint with ESLint in react-native's source?

JoshuaKGoldberg opened this issue ยท 2 comments

Introduction

๐Ÿ‘‹ Hi! I'm one of the maintainers of typescript-eslint and was one of the maintainers of TSLint, which is now deprecated in favor of typescript-eslint. Following up on DefinitelyTyped/DefinitelyTyped#66351 (comment): I see there's a tslint.json file in the react-native repository: https://github.com/facebook/react-native/blob/87dbe44db4f211b3cd5f4ed8fc5ad7ee059ff2ba/packages/react-native/types/tslint.json.

Looks like it's there primary for dtslint: https://github.com/facebook/react-native/blob/87dbe44db4f211b3cd5f4ed8fc5ad7ee059ff2ba/package.json#L35-L36

Would you be open to a PR that migrates from TSLint to ESLint?

Details

TSLint is deprecated and hasn't received updates for the latest versions of TypeScript in several years. We've mostly replaced its rules in dtslint with ESLint equivalents: microsoft/DefinitelyTyped-tools#648. At this point the only rule that isn't explicitly converted over are expect-type (see https://github.com/JoshuaKGoldberg/eslint-plugin-expect-type) and npm-naming (microsoft/DefinitelyTyped-tools#681, and not relevant here?).

Discussion points

I couldn't figure out a good place for this in the core react-native repository. Sorry if this issue template wasn't the right one. ๐Ÿ™‚

We've mostly replaced its rules in dtslint with ESLint equivalents: microsoft/DefinitelyTyped-tools#648. At this point the only rule that isn't explicitly converted over are expect-type (see https://github.com/JoshuaKGoldberg/eslint-plugin-expect-type) and npm-naming (microsoft/DefinitelyTyped-tools#681, and not relevant here?).

dtslint is our only reason for using TSLint I think. Migrating to similar ESLint rules seems reasonable, and I think we already run typescript-eslint as well.

For someone who hasn't been following dtslint as much, can we migrate to ESLint usage, but still preserve functionality like testing typechecking against multiple TS versions?

can we migrate to ESLint usage, but still preserve functionality like testing typechecking against multiple TS versions?

Yes! We're going to have to add that to DefinitelyTyped's usage of dtslint as it is. So I can make a note to send a PR here when it's ready. Thanks!