(isEnabled, options)
| 12 | * be used, because they'll show up in the user's output. |
| 13 | */ |
| 14 | const ruleFn: Rule<boolean, string> = (isEnabled, options) => { |
| 15 | return (root, result) => { |
| 16 | if (!isEnabled) { |
| 17 | return; |
| 18 | } |
| 19 | |
| 20 | const filePattern = options?.filePattern ? new RegExp(options.filePattern) : null; |
| 21 | |
| 22 | if (filePattern && !filePattern?.test(basename(root.source!.input.file!))) { |
| 23 | return; |
| 24 | } |
| 25 | |
| 26 | root.walkComments(comment => { |
| 27 | // Allow comments starting with `!` since they're used to tell minifiers to preserve the comment. |
| 28 | if (!comment.raws.inline && !comment.text.startsWith('!')) { |
| 29 | utils.report({ |
| 30 | result, |
| 31 | ruleName, |
| 32 | message: messages.expected(), |
| 33 | node: comment, |
| 34 | }); |
| 35 | } |
| 36 | }); |
| 37 | }; |
| 38 | }; |
| 39 | |
| 40 | ruleFn.ruleName = ruleName; |
| 41 | ruleFn.messages = messages; |
nothing calls this directly
no outgoing calls
no test coverage detected