ESLint plugin
This project is maintained by iliubinskii
ESLint plugin / prefer-only-export
Requires only export if given AST element is found.
module.exports = {
plugins: ["misc"],
rules: {
"misc/prefer-only-export": [
"error",
{
selector: string | string[]
}
]
}
};
| Option | Description | Default | | :—– | :———- | :—— |
selector |
AST selector | [] |
/*
eslint misc/prefer-only-export: [
error,
{
selector: "Program > ExportNamedDeclaration > ClassDeclaration"
}
]
*/
export class SampleClass {}
export const x = 1;
/*
eslint misc/prefer-only-export: [
error,
{
selector: "Program > ExportNamedDeclaration > ClassDeclaration"
}
]
*/
export class SampleClass {}