typescript:S7763 conflicts with named default exports

  • What language is this for?
    • TypeScript
  • Which rule?
    • typescript:S7763
  • Why do you believe it’s a false-positive/false-negative?
    • For named exports, this rule makes sense. For default exports, however, it seems like it would contradict the spirit of typescript:S7726. It would remove the name provided by the default import, obscuring the intent of the default export name. IDE’s that update default names wouldn’t be able to make the update here, giving the user no indication that a change to the default import name should propagate.
  • Are you using
    • SonarQube Cloud?
  • How can we reproduce the problem? Give us a self-contained snippet of code (formatted text, no screenshots)
// If user changes default name in ./foo.ts to 'newName',
// export will change to { newName as foo }, appearing in diffs
import foo from './foo';
export { foo };

// If user changes default name in ./foo.ts to 'newName',
// nothing changes in this file, even though 'foo' should change to 'newName'
import { default } from './foo';
export { default as foo };

Hi @landisdesign,

this is a very good point. I created a ticket to add an exception to the rule.

Thanks!

1 Like

Thank you very much!

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.