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
fix(typescript-estree): support declare
and export
modifiers for nested namespace declaration
#7410
Conversation
Thanks for the PR, @sosukesuzuki! typescript-eslint is a 100% community driven project, and we are incredibly grateful that you are contributing to that community. The core maintainers work on this in their personal time, so please understand that it may not be possible for them to review your work immediately. Thanks again! 🙏 Please, if you or your company is finding typescript-eslint valuable, help us sustain the project by sponsoring it transparently on https://opencollective.com/typescript-eslint. |
✅ Deploy Preview for typescript-eslint ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
@@ -2901,6 +2903,7 @@ export class Converter { | |||
node.body.name | |||
) { | |||
node = node.body; | |||
isDeclare ||= hasModifier(SyntaxKind.DeclareKeyword, node); |
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.
I'm not sure if this is needed. It may be enough to check once at the top level?
declare namespace foo.bar { }
declare namespace foo.bar { }
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #7410 +/- ##
==========================================
- Coverage 87.42% 87.34% -0.09%
==========================================
Files 381 381
Lines 13324 13336 +12
Branches 3939 3943 +4
==========================================
- Hits 11649 11648 -1
- Misses 1297 1308 +11
- Partials 378 380 +2
Flags with carried forward coverage won't be shown. Click here to find out more.
|
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 for looking into this!
looks like the logic isn't right still
end: { column: 28, line: 1 }, | ||
}, | ||
}, | ||
declare: false, |
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.
this should be true
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 |
Oof yeah it looks like our handling is pretty shoddy overall: declare namespace foo1 { } // ✅ declare: true
declare module foo2 { } // ✅ declare: true
declare namespace foo3.bar { } // ❌ declare: false
declare module foo4.def { } // ✅ declare: true
export declare namespace foo5 { } // ✅ export: "true"
// ✅ declare: true
export declare module foo6 { } // ✅ export: "true"
// ✅ declare: true
export declare namespace foo7.bar { } // ❌ export: "false"
// ❌ declare: false
export declare module foo8.def { } // ✅ export: "true"
// ✅ declare: true
declare global { } // ✅ declare: true
// ✅ global: true
export declare global { } // ✅ export: "true"
// ✅ declare: true
// ✅ global: true If possible - can we add cases for and fix all of this at once? |
declare namespace foo.bar { }
declare
and export
modifiers for nested namespace declaration
Hmm, codecov is also failing in the part that should have been tested. Am I wrong..? |
nah our codecov setup just isn't able to collect coverage across packages right now, sadly. |
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 fixing this - this fix LGTM!
declare
and export
modifiers for nested namespace declarationdeclare
and export
modifiers for nested namespace declaration
PR Checklist
typescript-estree
does not supportdeclare namespace foo.bar {}
#7409Overview
Support following syntax: