react-native-community / discussions-and-proposals

Discussions and proposals related to the main React Native project
https://reactnative.dev
1.69k stars 127 forks source link

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

Open JoshuaKGoldberg opened 1 year ago

JoshuaKGoldberg commented 1 year ago

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 https://github.com/DefinitelyTyped/DefinitelyTyped/pull/66351#issuecomment-1714372336: 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: https://github.com/microsoft/DefinitelyTyped-tools/issues/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 (https://github.com/microsoft/DefinitelyTyped-tools/pull/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. 🙂

NickGerleman commented 1 year ago

We've mostly replaced its rules in dtslint with ESLint equivalents: https://github.com/microsoft/DefinitelyTyped-tools/issues/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 (https://github.com/microsoft/DefinitelyTyped-tools/pull/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?

JoshuaKGoldberg commented 1 year ago

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!