-
-
Notifications
You must be signed in to change notification settings - Fork 716
Labels
A-linterArea - LinterArea - Linter
Description
What version of Oxlint are you using?
1.16.0
What command did you run?
oxlint
What does your .oxlintrc.json config file look like?
What happened?
The satisfies statement below is reported as an unused expression. It is a valid type assertion which is handy to ensure switch statements are exhaustive (e.g. here Typescript reports Type '"baz"' does not satisfy the expected type 'never')
type FooBarBaz = 'foo' | 'bar' | 'baz';
export function satisfiesTest(c: FooBarBaz): string {
switch(c) {
case 'foo':
return 'foo';
case 'bar':
return 'bar';
default:
c satisfies never;
return '';
}
} × eslint(no-unused-expressions): Disallow unused expressions
╭─[src/satisfies.ts:10:13]
9 │ default:
10 │ c satisfies never;
· ──────────────────
11 │ return '';
╰────
help: Consider removing this expression
Note that even though the configuration uses typescript/no-unused-expressions, the error is reported under the no-unused-expressions rule. Even though they're documented under different names, both seem to be pointing to the same rule? Not sure if that's expected, but that is confusing
Metadata
Metadata
Assignees
Labels
A-linterArea - LinterArea - Linter
{ "rules": { "typescript/no-unused-expressions": "error" } }