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

Function ruleFn

tools/stylelint/no-import.ts:10–33  ·  view source on GitHub ↗
(isEnabled, options)

Source from the content-addressed store, hash-verified

8
9/** Stylelint plugin that doesn't allow `@import` to be used. */
10const ruleFn: Rule<boolean, string> = (isEnabled, options) => {
11 return (root, result) => {
12 if (!isEnabled) {
13 return;
14 }
15
16 const excludePattern = options?.exclude ? new RegExp(options.exclude) : null;
17
18 if (excludePattern?.test(basename(root.source!.input.file!))) {
19 return;
20 }
21
22 root.walkAtRules(rule => {
23 if (rule.name === 'import') {
24 utils.report({
25 result,
26 ruleName,
27 message: messages.expected(),
28 node: rule,
29 });
30 }
31 });
32 };
33};
34
35ruleFn.ruleName = ruleName;
36ruleFn.messages = messages;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected