Configuration
The shape of faircopy.config.ts.
On this page
faircopy reads faircopy.config.ts from the project root. The defineConfig helper from @faircopy/config gives you full type completion on rule names and options. NLP rules are available once you install @faircopy/rules-nlp and load it through rulesets.
Shape
import { defineConfig } from '@faircopy/config'
import { astro } from '@faircopy/astro'
export default defineConfig({
files: ['src/**/*.astro'],
ignore: ['src/**/*.test.astro'],
adapters: [astro()],
rulesets: ['@faircopy/rules-nlp'],
rules: {
'no-em-dash': 'error',
'no-weasel-words': ['error', { words: ['actually', 'truly', 'just'] }],
'no-rhetorical-scaffolding': 'error',
'no-filter-words': 'error',
'@faircopy/rules-nlp/no-passive-voice': 'warn',
'no-weak-modals': 'warn',
'no-stacked-adjectives': 'warn',
'no-nominalized-phrases': 'warn',
},
noGitignore: false,
concurrency: 4,
})
Fields
| Field | Type | Description |
|---|---|---|
files |
string[] |
Globs of files to lint, relative to the config. |
ignore |
string[] |
Globs to skip. Merged with .gitignore. |
adapters |
Adapter[] |
Registered adapters in priority order. |
rulesets |
string[] |
Optional rule packages to load, such as @faircopy/rules-nlp. |
rules |
Record<string, RuleConfig> |
Rule severity and options. |
noGitignore |
boolean |
Disable .gitignore integration. Default false. |
concurrency |
number |
Max concurrent files. Defaults to CPU count. |
Rule config
Each rule takes a severity ('off' | 'warn' | 'error') or a tuple of [severity, options].
rules: {
'no-em-dash': 'error',
'no-weasel-words': ['error', { words: ['actually', 'truly'] }],
'no-rhetorical-scaffolding': 'off',
'no-filter-words': ['error', { phrases: ['I think', 'basically'] }],
'@faircopy/rules-nlp/no-passive-voice': ['warn', { allowedAuxiliaries: ['is', 'was'] }],
'no-weak-modals': ['warn', { modals: ['can', 'might'] }],
'no-stacked-adjectives': ['warn', { allowedPhrases: ['continuous integration server'] }],
'no-nominalized-phrases': ['warn', { allowedWords: ['accessibility', 'security'] }],
}
CLI
npx faircopy lint # lint configured files
npx faircopy lint --format github # report inline CI annotations
npx faircopy lint --format json # export structured diagnostics
npx faircopy lint --max-warnings 0 # fail when warnings remain
The CLI reports issues for you or your agent to revise. It does not provide init, fix, or explain commands. Create the configuration file manually and use the rules reference for help. Use package-qualified IDs for rules, such as passive voice, that exist in both packs.