Patterns can be shared with others by publishing them to a Git repository. This allows you to reuse patterns across different repositories, or to use patterns created by others (including the Grit standard library).
Publishing a Grit pattern is as simple as pushing it to a Git repository. The repository can be public or private, but currently only GitHub is supported. If you want to run your pattern through the Grit web app, private pattern repositories must be configured under the same GitHub app installation as all repositories which depend on them.
As long as the repository has
.grit directory (in the root) with at least one pattern defined, it will be recognized as a pattern repository.
Once a pattern repository is published, you can reference patterns from it in your own repository simply be prefixing the pattern name with the repository name and a hash. Patterns are always pulled from the default branch of the repository.
You can set an enforcement level - for example,
level: error or
level: warn - to override the default enforcement setting for the pattern.
version: 0.0.1 patterns: - name: github.com/getgrit/js#no_dead_code level: info
As a reminder, the file name for
.grit patterns is not important. You should import patterns by the name of the pattern, not the file name.