A rule defines a custom check that will run against changes. These enables identifying behaviours that are buggy within the context of a given codebase as well as style violations.
For example, a user might prefer namespace imports and would like to receive comments whenever this convention is violated:
.recurse.yaml
file in the root of the projectcustom_rules:
- name: "avoid-relative-imports"
applicable_files:
- ".ts"
- ".tsx"
description: "Avoid relative imports using '../' pattern. Use absolute imports or module aliases instead."
- name: "another-rule"
applicable_files:
- "src/"
- "tests/"
description: "Another description"
...
name
→ Name of the ruleapplicable_files
→ list of glob patterns. If a change are made on files that match any of the patterns, the custom localizer will scan those files against the rule
description
→ This is the actual description of the rule that will be passed to the localizer.