Skip to content
This repository has been archived by the owner on Mar 25, 2021. It is now read-only.

Add a rule "ensure-named-export" #3785

Closed
ggarek opened this issue Mar 21, 2018 · 1 comment
Closed

Add a rule "ensure-named-export" #3785

ggarek opened this issue Mar 21, 2018 · 1 comment

Comments

@ggarek
Copy link
Contributor

ggarek commented Mar 21, 2018

Rule Proposal

Using ensure-named-export one can assert that a module has named export named over the file name.

Example

// tslint.json
...
    "rules": {
        "ensure-named-export": [true, "camelCase"]
    }
...
// goodModule.ts -> lint OK
function goodModule() {
    return 1;
}

export const goodModule;
// badModule.ts -> lint FAIL
export default function f() {
    return 1;
}

export const a = 2;

function f2() {
    return null;
}

export const f2;

export const c = 1, d = 2;

Implementation

the repo | the rule

@JoshuaKGoldberg
Copy link
Contributor

Good idea! This also happens to exist in tslint-microsoft-contrib as export-name. See #1142 for discussion on bringing those rules into here.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants