New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[no-namespace] Allow module
when no-namespace is turned on
#423
Comments
AFAIK without declare, both module Foo {
export const x = '';
}
namespace Foo {
export const y = '';
}
namespace Bar {
export const x = '';
}
Foo.x;
Foo.y; It's also worth noting that the parser makes no differentiation between the two. I have two questions for you
|
Our current usage of namespace is like this:
We also have a few those in a single file cause that's just how we are organizing it. So we could change that to not use We use That is interesting that both show up the same in the AST |
Hmm so checking out the babel playground it seems like |
You can use ASTExplorer to switch to the actual typescript parser, and see that even at the typescript AST level, there is no differentiation between the two. Using ts-loader doesn't preclude you from also using babel-loader! There's a perf hit ofc, though I would personally use ts-loader as it's guaranteed to work with TS syntax because it uses typescript itself to transpile (unlike babel, which is a custom transpilation implementation). Note: this is the reason that it's not currently supported in babel: babel/babel#8244
|
Repro
Additional Info
Setting up TS with babel-loader, babel doesn't support the
namespace name {}
syntax and suggests using themodule name {}
syntax. But I can't seem to be able to enforce that with theno-namespace
lint rule. I would expect to be able to disallownamespace
but still allowmodule
(without the declare keyword before it too)Versions
@typescript-eslint/eslint-plugin
1.6.0
@typescript-eslint/parser
1.6.0
TypeScript
3.4.1
ESLint
5.16.0
node
8.9.4
npm
6.6.0
The text was updated successfully, but these errors were encountered: