/lint-ensure-named-export-rule

Lint rule to ensure named export presence

Primary LanguageTypeScriptApache License 2.0Apache-2.0

ensure-named-export-rule

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.

Lint tools support

  • tslint rule
  • eslint rule

How it works in a few words

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.

Configuration example

"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)

Dependencies

Case conversion is done with change-case ❤️