-
Notifications
You must be signed in to change notification settings - Fork 309
/
cspell.config.js
113 lines (102 loc) · 3.11 KB
/
cspell.config.js
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
108
109
110
111
112
113
/**
* Copyright (c) Moodle Pty Ltd.
*
* Moodle is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Moodle is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Moodle. If not, see <http://www.gnu.org/licenses/>.
*/
const fs = require('fs');
const path = require('path');
const config = {
version: 0.2,
gitignoreRoot: '.',
useGitignore: true,
dictionaries: [
'en',
'en-gb',
'css',
'html',
'fonts',
'typescript',
'softwareTerms',
'companies',
'jira-tags',
'lorem-ipsum',
'moodle-components',
'moodle-contributors',
'project-words',
'plugin-names',
'tools-names',
],
dictionaryDefinitions: [
{
name: 'moodle-components',
path: './data/component-spelling.txt',
noSuggest: true,
},
{
name: 'moodle-contributors',
path: './data/moodle-contributors.txt',
noSuggest: true,
},
{
name: 'plugin-names',
path: './data/plugin-names.txt',
noSuggest: true,
},
{
name: 'project-words',
path: './project-words.txt',
noSuggest: true,
},
],
ignorePaths: [
'*.js',
'*.mjs',
'CHANGELOG.md',
'package.json',
'yarn.lock',
'project-words.txt',
'versioned_docs',
'*.min.*',
'src/*',
// Disable spell-checking of legacy release notes.
'general/releases/{1,2,3}.*',
],
ignoreRegExpList: [
// Both Email and Urls are in the list of Predefined regexps.
'Email',
'Urls',
// Ignore Code blocks in ```multiline backticks```.
'/^\\s*```[\\s\\S]*?^\\s*```/gm',
// Ignore inline code blocks in `single backticks`.
'/`[^`]*`/g',
// Links to the legacy documentation are ignored.
// These are in the format [[<LINK>]].
'\\[\\[.*\\]\\]',
// Ignore relative paths in markdown links.
'/\\]([^)]*)/gm',
],
};
// Add the content of any .git/info/exclude file too.
const addGitIgnoreFile = (gitignore) => {
/* eslint-disable no-restricted-properties */
const relPath = path.join(process.env.PWD, gitignore);
if (!fs.statSync(relPath, { throwIfNoEntry: false })) {
return [];
}
const content = fs.readFileSync(relPath, { encoding: 'utf-8' });
return content.split('\n').filter((glob) => !glob.startsWith('#')).filter((val) => val);
/* eslint-enable */
};
config.ignorePaths = config.ignorePaths.concat(addGitIgnoreFile('.git/info/exclude'));
module.exports = config;