sonarjs/use-type-alias
eslint-plugin-sonarjs
No autofixRecommended
eslint.config.js
export default [
{
rules: {
"sonarjs/use-type-alias": "error",
},
},
];function foo(x:string|null|number) { // Noncompliant
// ...
}
function bar(x:string|null|number) {
// ...
}
function zoo(): string|null|number {
return null;
}type MyType = string | null | number;
function foo(x: MyType) {
// ...
}
function bar(x: MyType) {
// ...
}
function zoo(): MyType {
return null;
}Examples from the ESLint documentation.
sonarjs/use-type-alias
eslint-plugin-sonarjs
export default [
{
rules: {
"sonarjs/use-type-alias": "error",
},
},
];Oxlint does not have this rule.
Biome does not have this rule.
Loop counters should not be assigned within the loop body
Vi.mock should be declared at module scope
Server hostnames should be verified during SSL/TLS connections