MCPcopy Create free account
hub / github.com/angular/dev-infra / ruleFn

Function ruleFn

lint-rules/stylelint/no-import.ts:12–35  ·  view source on GitHub ↗
(isEnabled, options)

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected