feat(eslint): add initial no-default-export-components rule#110266
feat(eslint): add initial no-default-export-components rule#110266JoshuaKGoldberg merged 6 commits intomasterfrom
Conversation
1bbce7f to
bea68e2
Compare
e7233f7 to
3f99e7c
Compare
3f99e7c to
aeafbfd
Compare
bea68e2 to
092f72f
Compare
aeafbfd to
56c1f7e
Compare
092f72f to
6bd47c6
Compare
56c1f7e to
5548d74
Compare
a1cc39e to
60329bc
Compare
5548d74 to
7da9723
Compare
|
🚨 Warning: This pull request contains Frontend and Backend changes! It's discouraged to make changes to Sentry's Frontend and Backend in a single pull request. The Frontend and Backend are not atomically deployed. If the changes are interdependent of each other, they must be separated into two pull requests and be made forward or backwards compatible, such that the Backend or Frontend can be safely deployed independently. Have questions? Please ask in the |
static/app/views/nav/secondary/sections/dashboards/dashboardsSecondaryNav.tsx
Outdated
Show resolved
Hide resolved
e8010be to
33aa9f4
Compare
Co-authored-by: Scott Cooper <scttcper@gmail.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
| node.superClass !== null && | ||
| node.superClass.type === AST_NODE_TYPES.Identifier && | ||
| node.superClass.name.includes('Component') | ||
| ); |
There was a problem hiding this comment.
Class component detection misses MemberExpression superclass patterns
Low Severity
The ClassDeclaration branch only checks node.superClass.type === AST_NODE_TYPES.Identifier, so classes using extends React.Component or extends React.PureComponent (which produce a MemberExpression node, not an Identifier) won't be detected as components. The .name.includes('Component') check also matches non-component classes whose superclass name happens to contain "Component" as a substring, which is overly broad in one direction while missing the MemberExpression pattern entirely.
There was a problem hiding this comment.
We don't do that here, this is fine.


Adds a
@sentry/no-default-export-componentsrule that reports onexport defaults of things that seem to be React components.It intentionally ignores any file where:
import('...')s the file, which might indicate using a lazy import of a.defaultMost of the corresponding fixes were in #110263, which this PR was stacked on. A few more violations were added to
mastersince that PR was generated and are now fixed in this PR. This PR also adds detection for class components and fixes those new violations.There are still ~1.2k
export default \w+s instatic/appexcluding mocks. Collecting more of them will mean adding in more logic to the fixers / lint rule / prompts, which I'd like to propose as a followup.Fixes ENG-7006.