Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider using @rushstack/no-new-null for TypeScript #645

Closed
jonahsnider opened this issue Jan 9, 2022 · 3 comments
Closed

Consider using @rushstack/no-new-null for TypeScript #645

jonahsnider opened this issue Jan 9, 2022 · 3 comments

Comments

@jonahsnider
Copy link
Contributor

@rushstack/eslint-plugin exposes a @rushstack/no-new-null rule which may do a better job limiting the use of null in TypeScript than the current behavior.

@sindresorhus
Copy link
Member

How does it do a better job?

@jonahsnider
Copy link
Contributor Author

Their plugin will only error when null is used in a public interface. For example, if you were writing a class that used an external API, then having a private method which used null to describe an external JSON API would be allowed.

@sindresorhus
Copy link
Member

I don't want to allow null in internal contexts either. I think it's better to just use ignore comments when you absolutely have to use null.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants