Skip to content

Commit 871db19

Browse files
committed
Allow export default
1 parent ec81f48 commit 871db19

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

src/rules/component/__tests__/index.test.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ describe('component rule', () => {
2323
code: 'export default function IndexPage(){return <Row><Col></Col></Row>}',
2424
filename: 'src/app/page.tsx',
2525
},
26+
{
27+
code: 'export default function Hello(){return <Row><Col></Col></Row>}',
28+
filename: 'src/components/Hello.tsx',
29+
},
2630
{
2731
code: 'export default function IndexPage(){return <Row><Col></Col></Row>}',
2832
filename: 'src/app/aaa/bb/cc/page.tsx',

src/rules/component/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,9 @@ export const component = createRule({
8282
const isTargetComponent = (name: string) => name === targetComponentName
8383

8484
return {
85+
ExportDefaultDeclaration(defaultExport) {
86+
ok = true
87+
},
8588
ExportNamedDeclaration(namedExport) {
8689
if (ok) return
8790

0 commit comments

Comments
 (0)