Configuration
The shape of faircopy.config.ts.
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.
Shape
import { defineConfig } from '@faircopy/config'
import { astro } from '@faircopy/astro'
export default defineConfig({
files: ['src/**/*.astro'],
ignore: ['src/**/*.test.astro'],
adapters: [astro()],
rules: {
'no-em-dash': 'error',
'no-weasel-words': ['error', { words: ['actually', 'truly', 'just'] }],
'no-rhetorical-scaffolding': 'error',
'no-filter-words': 'error',
'no-passive-voice': '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. |
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'] }],
'no-passive-voice': ['warn', { allowedAuxiliaries: ['is', 'was'] }],
}
CLI
npx faircopy lint # run all rules
npx faircopy fix # apply auto-fixes where possible
npx faircopy explain <rule> # print the full help for a rule