Getting Started
eslint-plugin-repo is easiest to adopt when you treat it as a preset-first repository policy layer, not a giant bundle of rules you enable all at once.
Install the plugin:
npm install --save-dev eslint-plugin-repo
Then enable it in your Flat Config:
import repoPlugin from "eslint-plugin-repo";
export default [repoPlugin.configs.recommended];
:::tip Recommended rollout
Start with repoPlugin.configs.recommended, validate the baseline, then add the single provider preset that matches the host for the repository you are linting.
:::
Quick start pathβ
- Install
eslint-plugin-repo. - Enable
repoPlugin.configs.recommended. - Add one provider preset (
github,gitlab,bitbucket, orcodeberg). - Run linting and clean up the baseline.
- Consider
repoPlugin.configs.strictonly after the initial migration settles.
Helpful references while you do this:
Layer presets intentionallyβ
Use presets as a progression rather than enabling everything at once:
import repoPlugin from "eslint-plugin-repo";
export default [
repoPlugin.configs.recommended,
repoPlugin.configs.github,
// Add `repoPlugin.configs.strict` once the baseline is stable.
];
Start with one provider preset (github, gitlab, bitbucket, or codeberg) that matches your repository host.
Preset selection guideβ
| Situation | Suggested config |
|---|---|
| You want a low-friction baseline | repoPlugin.configs.recommended |
| Your repository is hosted on GitHub | repoPlugin.configs.recommended + repoPlugin.configs.github |
| Your repository is hosted on GitLab | repoPlugin.configs.recommended + repoPlugin.configs.gitlab |
| Your repository is hosted on Bitbucket | repoPlugin.configs.recommended + repoPlugin.configs.bitbucket |
| Your repository is hosted on Codeberg / Forgejo | repoPlugin.configs.recommended + repoPlugin.configs.codeberg |
| Your baseline is already stable and you want stronger enforcement | Add repoPlugin.configs.strict |
Recommended approachβ
- Start with
repoPlugin.configs.recommended. - Add provider presets (
github,gitlab,bitbucket,codeberg) as needed. - Use
repoPlugin.configs.strictfor stronger policy coverage.
Use this baseline snippet everywhere:
import repoPlugin from "eslint-plugin-repo";
export default [repoPlugin.configs.recommended];
Validate the first adoptionβ
After enabling the preset stack, run your normal lint workflow and inspect the rule docs for anything noisy before broadening coverage.
Helpful next reads:
- Rule Overview
- Presets
- Recommended preset
- All preset
- Developer Guide if you are working on the plugin itself
Rule navigationβ
Use the sidebar Rules section for the full list of rule docs.
Troubleshootingβ
- If typed rules are unexpectedly disabled, verify your projectβs
typescript-eslintparser setup. - If your team uses multiple repository hosts, combine provider presets in separate config blocks and scope them with
filespatterns where needed. - If migration feels noisy, start in warning mode and ratchet critical rules to error over time.