-
-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy path.textlintrc.cjs
107 lines (101 loc) · 2.28 KB
/
.textlintrc.cjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
const fs = require('node:fs');
const path = require('node:path');
const { globSync } = require('glob');
// Read all content files to use for relative links validation
const chapters = globSync('manuscript/*.md').map(
filename => ({
filename,
text: fs.readFileSync(filename, 'utf8')
})
);
const config = {
rules: {
terminology: true,
apostrophe: true,
quotes: true,
diacritics: true,
'common-misspellings': true,
'stop-words': {
severity: 'warning',
exclude: [
'divide and conquer',
'keep an eye on',
'never say never',
'we all know that',
'keep it simple, stupid'
]
},
'write-good': {
severity: 'warning',
adverb: false,
cliches: false,
illusion: true,
passive: false,
so: false,
thereIs: false,
tooWordy: false,
weasel: false
},
alex: {
profanitySureness: 2,
allow: [
'color',
'easy',
'invalid',
'just',
'nuts',
'obvious',
'of-course',
'simple',
'special',
'straightforward',
'threeway',
'vomit',
'whitespace',
'wacko',
'stupid'
]
},
'@textlint-rule/no-unmatched-pair': true,
'doubled-spaces': true,
'no-todo': true
},
filters: {
comments: true
}
};
// Only run dead link check on CI, since it’s very slow
if (process.env.CI) {
config['alive-link'] = {
preferGET: ['https://www.amazon.com'],
ignore: [
// Skip on GitHub because it always fails there
url =>
process.env.GITHUB_ACTIONS &&
url.startsWith('https://www.reddit.com'),
// Fails half of the time
url => url.startsWith('https://www.rssing.com')
],
checkRelative: true,
baseURI: url => {
// Images
if (url.startsWith('images/')) {
return path.join(
__dirname,
'manuscript/resources',
url
);
}
// Chapter links
if (url.startsWith('#')) {
// Try to find a chapter with the anchor (`{#pizza}`)
const chapter = chapters.find(({ text }) =>
text.includes(`{${url}}`)
);
return chapter?.filename ?? '';
}
return '';
}
};
}
module.exports = config;