-
Notifications
You must be signed in to change notification settings - Fork 198
export-name: detect export declarations #443
export-name: detect export declarations #443
Conversation
Previously, the `export-name` rule would detect an export assignment like ``` export = Fish; // or export default Fish; ``` but it would not detect an export like ``` export { Fish } ```
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other than a missing test case, LGTM!
@@ -315,6 +315,24 @@ describe('exportNameRule', () : void => { | |||
]); | |||
}); | |||
|
|||
it('when mis-named function is exported in a separate statement', () : void => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good test for the case of complaining. There should also be a corresponding test for the case of the user getting it right, e.g. file.ts
having export { file };
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added in new commit, good catch!
@@ -46,26 +46,43 @@ export class Rule extends Lint.Rules.AbstractRule { | |||
} | |||
} | |||
|
|||
function isExportedDeclaration(element: ts.Statement): boolean { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a suggestion: you may wish to file issues on https://github.com/ajafff/tsutils to add these there, as they seem useful. Not a blocking issue for this pull request at all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You got it: ajafff/tsutils#68 - feel free to comment there if it's not clear or not quite what you expected.
Awesome. Technically, this is a breaking change, as it should start flagging violations it wasn't before. |
Previously, the
export-name
rule would detect an export assignmentlike
but it would not detect an export like
Fixes #444