You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For a little more background, we were led to your xo and xo-typescript configurations by using npm init @eslint/config from ESLint's Getting Started (and we love it). I stumbled on the rule of disallowing the null type by accident, read your discussion, and fully bought in.
Problem
The problem is, that @typescript-eslint/ban-types will not match value usages, by design. However, the unicorn/no-null rule specifically disallows the use of the null literal:
// will yell
const param: null = null;
// will not yell
const param = null;
Since we want to use type inference as much as possible, the current @typescript-eslint/ban-types rule in this library probably won't catch much for us - we need the value checks.
Suggestion
Don't disable the unicorn/no-null rule since it complements the @typescript-eslint/ban-types rule (one checks literals, one checks types).
Make this behavior the default when using npm init @eslint/config (maybe include eslint-plugin-unicorn?) - I realize this would be a separate PR in a separate repo.
For (1), we currently have the following config in the meantime (reduced to only show the important bits):
Background
I like your position on not using null (in favor of undefined).
This library does two things:
@typescript-eslint/ban-types
.For a little more background, we were led to your
xo
andxo-typescript
configurations by usingnpm init @eslint/config
from ESLint's Getting Started (and we love it). I stumbled on the rule of disallowing the null type by accident, read your discussion, and fully bought in.Problem
The problem is, that
@typescript-eslint/ban-types
will not match value usages, by design. However, theunicorn/no-null
rule specifically disallows the use of the null literal:Since we want to use type inference as much as possible, the current
@typescript-eslint/ban-types
rule in this library probably won't catch much for us - we need the value checks.Suggestion
unicorn/no-null
rule since it complements the@typescript-eslint/ban-types
rule (one checks literals, one checks types).npm init @eslint/config
(maybe includeeslint-plugin-unicorn
?) - I realize this would be a separate PR in a separate repo.For (1), we currently have the following config in the meantime (reduced to only show the important bits):
For (2), you will probably tell us to just use XO directly instead of juggling the
extends
ourselves.WDYT?
The text was updated successfully, but these errors were encountered: