nursery/useBiomeTopLevelTypes
nursery · since 2.6.9
No autofixRecommended
biome.json
{
"linter": {
"rules": {
"nursery": {
"useBiomeTopLevelTypes": "error"
}
}
}
}Require kind sets in Biome JS plugins to be created at the top level of the module.
import { defineRule, nodeKinds } from "@biomejs/runtime/plugin";
export const rule = defineRule({
run(node) {
const CALLS = nodeKinds("JS_CALL_EXPRESSION", "JS_NEW_EXPRESSION");
return CALLS.has(node.parent);
},
});import { nodeKinds } from "@biomejs/runtime/plugin";
const CALLS = nodeKinds("JS_CALL_EXPRESSION", "JS_NEW_EXPRESSION");
const IMPORTS = nodeKinds("JS_IMPORT_CALL_EXPRESSION");
function isCallOrImport(node) {
return CALLS.union(IMPORTS).has(node);
}import { defineRule, nodeKinds } from "@biomejs/runtime/plugin";
const CALLS = nodeKinds("JS_CALL_EXPRESSION", "JS_NEW_EXPRESSION");
const CALLS_AND_IMPORTS = CALLS.union(nodeKinds("JS_IMPORT_CALL_EXPRESSION"));
export const rule = defineRule({
run(node) {
return CALLS_AND_IMPORTS.has(node.parent);
},
});Examples from the Biome documentation.
ESLint does not have this rule.
Oxlint does not have this rule.
nursery/useBiomeTopLevelTypes
nursery · since 2.6.9
{
"linter": {
"rules": {
"nursery": {
"useBiomeTopLevelTypes": "error"
}
}
}
}Require kind sets instead of comparing kind names one by one in Biome JS plugins.
Enforce JSON keys with consistent Unicode representation.
Prefer folder exclusions that prevent Biome from scanning the folder.
Require a reason when using the @deprecated directive.
Require a generic fallback in font-family lists.