MCPcopy Create free account
hub / github.com/angular/components / ruleFn

Function ruleFn

tools/stylelint/single-line-comment-only.ts:14–38  ·  view source on GitHub ↗
(isEnabled, options)

Source from the content-addressed store, hash-verified

12 * be used, because they'll show up in the user's output.
13 */
14const 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
40ruleFn.ruleName = ruleName;
41ruleFn.messages = messages;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected