@ faircopy/ rules- 默认
公平复制的默认规则。 以最常见的登陆页副本模式为目标的"九条规则".
安装
安装时自动包含 faircopy。单独使用:
npm i @faircopy/rules-default
规则
no-complex-sentences
标出Flesch-Kincaid级别超过目标的个人句子.
warn[no-complex-sentences]: sentence readability is grade 18.5 — simplify to 12 or below
选项 :
{
maxGradeLevel?: number // Default: 12
minWords?: number // Minimum words before scoring a sentence. Default: 10
}
配置示例 :
rules: {
'no-complex-sentences': ['warn', { maxGradeLevel: 10, minWords: 8 }],
}
no-em-dash
禁用嵌入式字符( E)—, U+2014) 在营销副本.
error[no-em-dash]: use a sentence break instead of an em-dash
选项 :
{
flagEnDash?: boolean // Also flag en-dashes (–). Default false.
flagDoubleHyphen?: boolean // Also flag --. Default false.
}
配置示例 :
rules: {
'no-em-dash': ['error', { flagDoubleHyphen: true }],
}
no-weasel-words
禁止削弱主张的强化副词.
error[no-weasel-words]: remove "actually" — it weakens the claim
选项 :
{
words: string[] // Default: ['actually', 'truly', 'really', 'literally']
}
配置示例 :
rules: {
'no-weasel-words': ['error', { words: ['actually', 'truly', 'really', 'literally', 'just', 'simply'] }],
}
no-filler-words
禁止填充句子而不添加意义.
error[no-filler-words]: remove "just" — it's filler
选项 :
{
words: string[] // Default: ['just']
}
配置示例 :
rules: {
'no-filler-words': ['error', { words: ['just', 'basically', 'literally'] }],
}
no-rhetorical-scaffolding
禁止三种公式模式:
X is Y, not Z建筑Without X... With X...句子对- 独立
This/That distinction/difference matters.重要事项通知
error[no-rhetorical-scaffolding]: avoid "X is Y, not Z" — state the claim directly
error[no-rhetorical-scaffolding]: avoid "Without X / With X" — drop the setup and make the claim
error[no-rhetorical-scaffolding]: avoid "That distinction matters" — state the point directly
选项 :
{
allowIsNotConstruction?: boolean // Disable pattern 1. Default false.
allowWithoutWithConstruction?: boolean // Disable pattern 2. Default false.
allowImportanceAnnouncements?: boolean // Disable pattern 3. Default false.
extraPatterns?: string[] // Additional regex patterns to ban.
}
重要通知只匹配四个组合 This 或者说 That, (中文(简体) ),
distinction 或者说 difference,以及 matters,对案例不敏感。 他们必须开始
取出的案文、句子或空行分隔的段落,并结束
与 ., (中文(简体) ), !, (中文(简体) ), ?,或提取文本的结尾。 单词之间的空白
可能包括换行符;允许周围的引文和括号.
诊断突出该短语和末端点,不包括领先
白空间和周围引文。 不提供自动删除或替换.
直接说明后果:
- 在此之前:
That distinction matters. Only owners can change the file. - 之后:
Only owners can change the file.
实质性用途仍然有效,包括: That distinction matters because only owners can change the file., (中文(简体) ), This difference matters when access changes., (中文(简体) ),
财务报告和审定财务报表 The distinction between read and write access determines who can change the file. 保留带有逗号、结号或分号的条款.
这是限定的股票单词检查,不是禁止这些单词.
利用现有的严厉和禁止公约,或只允许这种家庭 保留其他脚手架检查:
rules: {
'no-rhetorical-scaffolding': ['warn', { allowImportanceAnnouncements: true }],
}
设定规则为 'off' 以禁用每个家庭,或使用特定规则的评论
例如 // faircopy-ignore-next-line no-rhetorical-scaffolding 故意伤害
使用时。 CLI和下游消费者使用相同的出口规则和注册.
no-non-inclusive-language
标出非包容性术语并推荐中性替代.
error[no-non-inclusive-language]: replace "guys" with a neutral alternative such as "everyone, team, folks"
默认条件 :
| 任期 | 建议的替代品 |
|---|---|
guys | everyone, (中文(简体) ), team, (中文(简体) ), folks |
manpower | workforce, (中文(简体) ), staffing, (中文(简体) ), personnel |
whitelist | allowlist |
blacklist | denylist, (中文(简体) ), blocklist |
master | primary, (中文(简体) ), main, (中文(简体) ), leader |
slave | secondary, (中文(简体) ), replica, (中文(简体) ), follower |
crazy | unexpected, (中文(简体) ), intense, (中文(简体) ), extreme |
insane | extreme, (中文(简体) ), unbelievable, (中文(简体) ), remarkable |
dumb | unhelpful, (中文(简体) ), poor, (中文(简体) ), uninformed |
lame | unimpressive, (中文(简体) ), inadequate, (中文(简体) ), weak |
sanity check | quick check, (中文(简体) ), confidence check, (中文(简体) ), verification |
blind spot | unaware area, (中文(简体) ), gap, (中文(简体) ), oversight |
grandfathered | legacy status, (中文(简体) ), exempted |
mankind | humanity, (中文(简体) ), humankind, (中文(简体) ), people |
选项 :
{
terms?: { term: string; alternatives: string[]; exact?: boolean }[]
allowedTerms?: string[]
}
配置示例 :
rules: {
'no-non-inclusive-language': ['error', {
terms: [
{ term: 'guys', alternatives: ['everyone', 'team'] },
{ term: 'rockstar', alternatives: ['expert', 'skilled'] },
],
allowedTerms: ['master'],
}],
}
单词词总是符合词的界限,所以 master 将不显示 masterpiece。默认的多词短语,例如 sanity check 财务报告和审定财务报表 blind spot 使用情况 exact: true这样 sanity checker 没有标记。 设定 exact: false 在一个自定义多词名词上与它相匹配,作为文本中任何地方的子字符串.
allowedTerms 不区分大小写: 添加 master 也许可 Master 或者说 MASTER。 。 。 .
no-redundant-phrases
旗子文字冗余短语并推荐简洁取而代之.
默认短语包括:
| 词组 | 建议替换 |
|---|---|
in order to | to |
due to the fact that | because |
in spite of the fact that | although |
at this point in time | now |
in the event that | if |
for the purpose of | to |
with regard to | about |
in close proximity to | near |
a large number of | many |
the reason is that | because |
it is important to note that | (删除) |
needless to say | (删除) |
warn[no-redundant-phrases]: "in order to" is redundant — use "to"
选项 :
{
phrases?: { phrase: string; replacement: string }[]
}
配置示例 :
rules: {
'no-redundant-phrases': ['warn', {
phrases: [
{ phrase: 'in order to', replacement: 'to' },
{ phrase: 'touch base', replacement: 'talk' },
],
}],
}
设定 replacement 改为空字符串,建议完全删除该短语.
no-cliches
旗子过度使用或陈词滥调,并提出更新鲜的替代方案.
默认短语包括:
| 词组 | 建议的替代品 |
|---|---|
world-class | top-tier, (中文(简体) ), exceptional, (中文(简体) ), outstanding |
best-in-class | leading, (中文(简体) ), top-performing, (中文(简体) ), category-leading |
cutting-edge | advanced, (中文(简体) ), modern, (中文(简体) ), latest |
state-of-the-art | advanced, (中文(简体) ), modern, (中文(简体) ), sophisticated |
game changer | breakthrough, (中文(简体) ), transformation, (中文(简体) ), major advance |
think outside the box | be creative, (中文(简体) ), innovate, (中文(简体) ), find a new approach |
at the end of the day | ultimately, (中文(简体) ), finally, (中文(简体) ), in summary |
low-hanging fruit | easy wins, (中文(简体) ), quick opportunities, (中文(简体) ), simple targets |
move the needle | make a measurable difference, (中文(简体) ), drive results, (中文(简体) ), create impact |
circle back | follow up, (中文(简体) ), reconnect, (中文(简体) ), return to this |
hit the ground running | start quickly, (中文(简体) ), get started immediately, (中文(简体) ), begin effectively |
boil the ocean | take on too much, (中文(简体) ), overcomplicate, (中文(简体) ), lose focus |
paradigm shift | fundamental change, (中文(简体) ), new approach, (中文(简体) ), transformation |
next level | advanced, (中文(简体) ), improved, (中文(简体) ), elevated |
seamless | smooth, (中文(简体) ), effortless, (中文(简体) ), frictionless |
robust | strong, (中文(简体) ), resilient, (中文(简体) ), reliable |
leverage | use, (中文(简体) ), take advantage of, (中文(简体) ), utilize |
synergy | collaboration, (中文(简体) ), combined effect, (中文(简体) ), partnership |
warn[no-cliches]: replace "world-class" with a fresher alternative such as "top-tier, exceptional, outstanding"
选项 :
{
phrases?: { phrase: string; alternatives: string[] }[]
allow?: string[]
}
配置示例 :
rules: {
'no-cliches': ['warn', {
phrases: [
{ phrase: 'world-class', alternatives: ['top-tier', 'exceptional'] },
{ phrase: 'low-hanging fruit', alternatives: ['easy wins'] },
],
allow: ['robust'],
}],
}
no-passive-voice
使用辅助 + 过去 participle 模式的旗子可能为被动语音构造.
warn[no-passive-voice]: rewrite passive construction "was approved" with a named actor
被动的声音经常会隐藏演员并添加拖放. 除非演员真的无所谓 否则最好点名.
选项 :
{
auxiliaries?: string[] // Default: ['is', 'are', 'was', 'were', 'be', 'been', 'being']
participles?: string[] // Past participles to flag. Default is a curated list of common action participles.
allowedPhrases?: string[] // Phrases to allow even if they match the passive pattern.
}
配置示例 :
rules: {
'no-passive-voice': ['warn', {
allowedPhrases: ['is licensed', 'was founded'],
}],
}