(node, name)
| 52 | |
| 53 | create(context) { |
| 54 | function checkTypos(node, name) { |
| 55 | if (NEXT_EXPORT_FUNCTIONS.includes(name)) { |
| 56 | return |
| 57 | } |
| 58 | |
| 59 | const potentialTypos = NEXT_EXPORT_FUNCTIONS.map((o) => ({ |
| 60 | option: o, |
| 61 | distance: minDistance(o, name), |
| 62 | })) |
| 63 | .filter(({ distance }) => distance <= THRESHOLD && distance > 0) |
| 64 | .sort((a, b) => a.distance - b.distance) |
| 65 | |
| 66 | if (potentialTypos.length) { |
| 67 | context.report({ |
| 68 | node, |
| 69 | message: `${name} may be a typo. Did you mean ${potentialTypos[0].option}?`, |
| 70 | }) |
| 71 | } |
| 72 | } |
| 73 | return { |
| 74 | ExportNamedDeclaration(node) { |
| 75 | const page = context.filename.split('pages', 2)[1] |
no test coverage detected