require-code-of-conduct-file
Require CODE_OF_CONDUCT.md for repository interactions.
Targeted pattern scopeâ
This rule checks the repository root for CODE_OF_CONDUCT.md.
What this rule reportsâ
This rule reports repositories that do not publish a code of conduct.
Why this rule existsâ
A code of conduct documents expected behavior and gives community members a clear path for reporting unacceptable conduct.
That matters for public repositories especially, but it also helps internal teams set shared expectations consistently.
â Incorrectâ
// Repository files
// .
// âââ CONTRIBUTING.md
// âââ README.md
// âââ package.json
//
// Missing: CODE_OF_CONDUCT.md
â Correctâ
// Repository files
// .
// âââ CODE_OF_CONDUCT.md
// âââ CONTRIBUTING.md
// âââ README.md
ESLint flat config exampleâ
import repoPlugin from "eslint-plugin-repo";
export default [
repoPlugin.configs.recommended,
{
plugins: { "repo-compliance": repoPlugin },
rules: {
"repo-compliance/require-code-of-conduct-file": "error",
},
},
];
When not to use itâ
Disable this rule only if the repository is strictly private and conduct policy is managed somewhere else that all contributors already use.
Rule catalog ID: R004