There is a rule to disallow default exports no-default-export
.
This rule makes it, so to say, one step further.
ℹ️ Using ensure-named-export-rule
one can assert that a module has named export named over the file name.
- tslint rule
- eslint rule
A file, named mySuperModule.js
, must have an export, also named mySuperModule
.
The rule supports an option to specify case conversion. Using which one can say:
A file, named mySuperModule.js
, must a have an export, named my_super_module
or MySuperModule
etc.
"rules": {
"ensure-named-export": [true, "pascalCase"]
}
"rules": {
"ensure-named-export": [true, "camelCase"]
}
Supported cases by this rule: "camelCase", "constantCase", "pascalCase", "snakeCase"
❓(Why not all from the change-case
? Because the rest of them seem to have no sense in this context)
Case conversion is done with change-case ❤️