MCPcopy
hub / github.com/vercel/next.js / ExportNamedDeclaration

Function ExportNamedDeclaration

packages/eslint-plugin-next/src/rules/no-typos.ts:74–107  ·  view source on GitHub ↗
(node)

Source from the content-addressed store, hash-verified

72 }
73 return {
74 ExportNamedDeclaration(node) {
75 const page = context.filename.split('pages', 2)[1]
76 if (!page || path.parse(page).dir.startsWith('/api')) {
77 return
78 }
79
80 const decl = node.declaration
81
82 if (!decl) {
83 return
84 }
85
86 switch (decl.type) {
87 case 'FunctionDeclaration': {
88 checkTypos(node, decl.id.name)
89 break
90 }
91 case 'VariableDeclaration': {
92 decl.declarations.forEach((d) => {
93 if (d.id.type !== 'Identifier') {
94 return
95 }
96 checkTypos(node, d.id.name)
97 })
98 break
99 }
100 case 'ClassDeclaration':
101 // We don't need to check typos in class declarations.
102 break
103 default:
104 decl satisfies never
105 }
106 return
107 },
108 }
109 },
110})

Callers

nothing calls this directly

Calls 5

checkTyposFunction · 0.85
splitMethod · 0.80
startsWithMethod · 0.80
parseMethod · 0.45
forEachMethod · 0.45

Tested by

no test coverage detected