-
Notifications
You must be signed in to change notification settings - Fork 61
New: Add rule no-namespace #21
Conversation
|
Hi @dannyfritz, could you please reference this PR from #5 |
|
thinking about splitting this into two separate rules by removing the allowLegacyExternalModule, will work on this tonight... |
# Conflicts: # docs/rules/no-namespace.md # lib/rules/no-namespace.js # tests/lib/rules/no-namespace.js
|
Ok, this is ready for review |
JamesHenry
left a comment
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.
Thanks so much for this, @weirdpattern!
The implementation is looking really good, just some docs changes to get this over the line.
docs/rules/no-namespace.md
Outdated
| @@ -0,0 +1,95 @@ | |||
| # Disallows the use of `internal modules` and `namespaces`. | |||
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.
Could we please call them "custom TypeScript modules" just to be 100% clear in differentiating them from ES2015 modules. "Internal" feels too vague here.
docs/rules/no-namespace.md
Outdated
| @@ -0,0 +1,95 @@ | |||
| # Disallows the use of `internal modules` and `namespaces`. | |||
|
|
|||
| Internal modules (`module foo {}`) and namespaces (`namespace foo {}`) are considered outdated | |||
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.
Again "custom TypeScript modules"
docs/rules/no-namespace.md
Outdated
| Internal modules (`module foo {}`) and namespaces (`namespace foo {}`) are considered outdated | ||
| ways to organize TypeScript code. ES2015 module syntax is now preferred. | ||
|
|
||
| This rule still allows the use of external modules (`declare module 'foo' {}`). |
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.
the use of "TypeScript module declarations to describe external APIs"
|
|
||
| This rule aims to standardise the way TypeScript modules are declared. | ||
|
|
||
| ## Options |
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.
It does not feel right to have a rule called "no-" and then have the exceptions enabled by default.
Please change the defaults for both exceptions to false.
lib/rules/no-namespace.js
Outdated
| } | ||
|
|
||
| /** | ||
| * Determines if node is either a declaration. |
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.
"either a declaration"....or?
tests/lib/rules/no-namespace.js
Outdated
| @@ -0,0 +1,117 @@ | |||
| /** | |||
| * @fileoverview Disallows the use of internal modules and namespaces. | |||
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.
Again please could we amend the use of "internal vs external" in this file to something more TypeScript specific. I do not feel it is clear enough what internal and external denote.
|
will work on these later today! |
|
@JamesHenry this is ready, thanks! |
|
Thanks a lot! |
This includes
New rule no-namespace
Corresponding test
Corresponding documentation
Update to README.md to include the new rule