(context)
| 61 | // Main rule export |
| 62 | module.exports = { |
| 63 | create(context) { |
| 64 | const { errors, legacyErrors } = getErrorsInDoc(); |
| 65 | return { |
| 66 | ExpressionStatement(node) { |
| 67 | if (!isDefiningError(node)) return; |
| 68 | |
| 69 | const code = node.expression.arguments?.[0]?.value; |
| 70 | if (!code) return; |
| 71 | |
| 72 | if (legacyErrors.has(code)) { |
| 73 | context.report({ |
| 74 | node, |
| 75 | message: `"${code}" is marked as legacy, yet it is used in lib/.`, |
| 76 | }); |
| 77 | } else if (!errors.has(code)) { |
| 78 | context.report({ |
| 79 | node, |
| 80 | message: `"${code}" is not documented in doc/api/errors.md`, |
| 81 | }); |
| 82 | } |
| 83 | }, |
| 84 | }; |
| 85 | }, |
| 86 | }; |
nothing calls this directly
no test coverage detected
searching dependent graphs…