cspell-lib 6.8.0 → 6.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -269,9 +269,9 @@ function mergeSources(left, right) {
|
|
|
269
269
|
};
|
|
270
270
|
}
|
|
271
271
|
function max(a, b) {
|
|
272
|
-
if (a === undefined)
|
|
272
|
+
if (a === undefined || a === null)
|
|
273
273
|
return b;
|
|
274
|
-
if (b === undefined)
|
|
274
|
+
if (b === undefined || b === null)
|
|
275
275
|
return a;
|
|
276
276
|
return a > b ? a : b;
|
|
277
277
|
}
|
|
@@ -46,11 +46,21 @@ const officialDirectives = [
|
|
|
46
46
|
'ignore',
|
|
47
47
|
'ignoreWord',
|
|
48
48
|
'ignoreWords',
|
|
49
|
+
'ignore-word',
|
|
50
|
+
'ignore-words',
|
|
49
51
|
'includeRegExp',
|
|
50
52
|
'ignoreRegExp',
|
|
53
|
+
'local',
|
|
51
54
|
'locale',
|
|
52
55
|
'language',
|
|
53
56
|
'dictionaries',
|
|
57
|
+
'dictionary',
|
|
58
|
+
'forbid',
|
|
59
|
+
'forbidWord',
|
|
60
|
+
'forbid-word',
|
|
61
|
+
'flag',
|
|
62
|
+
'flagWord',
|
|
63
|
+
'flag-word',
|
|
54
64
|
'enableCompoundWords',
|
|
55
65
|
'enableAllowCompoundWords',
|
|
56
66
|
'disableCompoundWords',
|
|
@@ -58,6 +68,7 @@ const officialDirectives = [
|
|
|
58
68
|
'enableCaseSensitive',
|
|
59
69
|
'disableCaseSensitive',
|
|
60
70
|
];
|
|
71
|
+
const noSuggestDirectives = new Set(['local']);
|
|
61
72
|
const preferredDirectives = [
|
|
62
73
|
'enable',
|
|
63
74
|
'disable',
|
|
@@ -65,7 +76,9 @@ const preferredDirectives = [
|
|
|
65
76
|
'disable-next-line',
|
|
66
77
|
'words',
|
|
67
78
|
'ignore',
|
|
79
|
+
'forbid',
|
|
68
80
|
'locale',
|
|
81
|
+
'dictionary',
|
|
69
82
|
'dictionaries',
|
|
70
83
|
'enableCaseSensitive',
|
|
71
84
|
'disableCaseSensitive',
|
|
@@ -95,14 +108,15 @@ const settingParsers = [
|
|
|
95
108
|
[/^(?:enable|disable)CaseSensitive\b/i, parseCaseSensitive],
|
|
96
109
|
[/^enable\b(?!-)/i, parseEnable],
|
|
97
110
|
[/^disable(-line|-next(-line)?)?\b(?!-)/i, parseDisable],
|
|
98
|
-
[/^words?\
|
|
99
|
-
[/^ignore(
|
|
111
|
+
[/^words?\b/i, parseWords],
|
|
112
|
+
[/^ignore(?:-?words?)?\b/i, parseIgnoreWords],
|
|
113
|
+
[/^(?:flag|forbid)(?:-?words?)?\b/i, parseFlagWords],
|
|
100
114
|
[/^ignore_?Reg_?Exp\s+.+$/i, parseIgnoreRegExp],
|
|
101
115
|
[/^include_?Reg_?Exp\s+.+$/i, parseIncludeRegExp],
|
|
102
|
-
[/^locale?\
|
|
116
|
+
[/^locale?\b/i, parseLocale],
|
|
103
117
|
[/^language\s/i, parseLocale],
|
|
104
|
-
[/^
|
|
105
|
-
[/^LocalWords:/, (w) => parseWords(w.replace(
|
|
118
|
+
[/^dictionar(?:y|ies)\b/i, parseDictionaries],
|
|
119
|
+
[/^LocalWords:/, (w) => parseWords(w.replace(/^LocalWords:?/gi, ' '))],
|
|
106
120
|
];
|
|
107
121
|
exports.regExSpellingGuardBlock = /(\bc?spell(?:-?checker)?::?)\s*disable(?!-line|-next)\b[\s\S]*?((?:\1\s*enable\b)|$)/gi;
|
|
108
122
|
exports.regExSpellingGuardNext = /\bc?spell(?:-?checker)?::?\s*disable-next\b.*\s\s?.*/gi;
|
|
@@ -128,7 +142,10 @@ function parseSettingMatchValidation(matchArray) {
|
|
|
128
142
|
if (matchingParsers.length > 0)
|
|
129
143
|
return undefined;
|
|
130
144
|
// No matches were found, let make some suggestions.
|
|
131
|
-
const dictSugs = dictInDocSettings
|
|
145
|
+
const dictSugs = dictInDocSettings
|
|
146
|
+
.suggest(text, { ignoreCase: false })
|
|
147
|
+
.map((sug) => sug.word)
|
|
148
|
+
.filter((a) => !noSuggestDirectives.has(a));
|
|
132
149
|
const sugs = new Set((0, cspell_pipe_1.pipeSync)(dictSugs, (0, cspell_pipe_1.opAppend)(allDirectives)));
|
|
133
150
|
const suggestions = [...sugs].slice(0, 8);
|
|
134
151
|
const issue = {
|
|
@@ -156,7 +173,11 @@ function parseCaseSensitive(match) {
|
|
|
156
173
|
return { id: 'in-doc-caseSensitive', caseSensitive };
|
|
157
174
|
}
|
|
158
175
|
function parseWords(match) {
|
|
159
|
-
const words = match
|
|
176
|
+
const words = match
|
|
177
|
+
// .replace(/[@#$%^&={}/"]/g, ' ')
|
|
178
|
+
.split(/[,\s;]+/g)
|
|
179
|
+
.slice(1)
|
|
180
|
+
.filter((a) => !!a);
|
|
160
181
|
return { id: 'in-doc-words', words };
|
|
161
182
|
}
|
|
162
183
|
function parseLocale(match) {
|
|
@@ -168,6 +189,10 @@ function parseIgnoreWords(match) {
|
|
|
168
189
|
const wordsSetting = parseWords(match);
|
|
169
190
|
return (0, util_1.clean)({ id: 'in-doc-ignore', ignoreWords: wordsSetting.words });
|
|
170
191
|
}
|
|
192
|
+
function parseFlagWords(match) {
|
|
193
|
+
const wordsSetting = parseWords(match);
|
|
194
|
+
return (0, util_1.clean)({ id: 'in-doc-forbid', flagWords: wordsSetting.words });
|
|
195
|
+
}
|
|
171
196
|
function parseRegEx(match) {
|
|
172
197
|
const patterns = [match.replace(/^[^\s]+\s+/, '')].map((a) => {
|
|
173
198
|
const m = a.match(regExMatchRegEx);
|
package/dist/util/util.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export declare function unique<T>(src: T[]): T[];
|
|
|
7
7
|
* Delete all `undefined` fields from an object.
|
|
8
8
|
* @param src - object to be cleaned
|
|
9
9
|
*/
|
|
10
|
-
export declare function clean<T>(src: T): RemoveUndefined<T>;
|
|
10
|
+
export declare function clean<T extends object>(src: T): RemoveUndefined<T>;
|
|
11
11
|
/**
|
|
12
12
|
* Creates a scan function that can be used in a map function.
|
|
13
13
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cspell-lib",
|
|
3
|
-
"version": "6.8.
|
|
3
|
+
"version": "6.8.1",
|
|
4
4
|
"description": "A library of useful functions used across various cspell tools.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"typings": "dist/index.d.ts",
|
|
@@ -48,18 +48,18 @@
|
|
|
48
48
|
},
|
|
49
49
|
"homepage": "https://github.com/streetsidesoftware/cspell#readme",
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@cspell/cspell-bundled-dicts": "^6.8.
|
|
52
|
-
"@cspell/cspell-pipe": "^6.8.
|
|
53
|
-
"@cspell/cspell-types": "^6.8.
|
|
51
|
+
"@cspell/cspell-bundled-dicts": "^6.8.1",
|
|
52
|
+
"@cspell/cspell-pipe": "^6.8.1",
|
|
53
|
+
"@cspell/cspell-types": "^6.8.1",
|
|
54
54
|
"clear-module": "^4.1.2",
|
|
55
55
|
"comment-json": "^4.2.3",
|
|
56
56
|
"configstore": "^5.0.1",
|
|
57
57
|
"cosmiconfig": "^7.0.1",
|
|
58
|
-
"cspell-glob": "^6.8.
|
|
59
|
-
"cspell-grammar": "^6.8.
|
|
60
|
-
"cspell-io": "^6.8.
|
|
61
|
-
"cspell-trie-lib": "^6.8.
|
|
62
|
-
"fast-equals": "^4.0.
|
|
58
|
+
"cspell-glob": "^6.8.1",
|
|
59
|
+
"cspell-grammar": "^6.8.1",
|
|
60
|
+
"cspell-io": "^6.8.1",
|
|
61
|
+
"cspell-trie-lib": "^6.8.1",
|
|
62
|
+
"fast-equals": "^4.0.3",
|
|
63
63
|
"find-up": "^5.0.0",
|
|
64
64
|
"fs-extra": "^10.1.0",
|
|
65
65
|
"gensequence": "^3.1.1",
|
|
@@ -83,8 +83,8 @@
|
|
|
83
83
|
"@cspell/dict-python": "^2.0.6",
|
|
84
84
|
"@types/configstore": "^5.0.1",
|
|
85
85
|
"@types/fs-extra": "^9.0.13",
|
|
86
|
-
"@types/jest": "^28.1.
|
|
87
|
-
"@types/node": "^18.7.
|
|
86
|
+
"@types/jest": "^28.1.8",
|
|
87
|
+
"@types/node": "^18.7.13",
|
|
88
88
|
"cspell-dict-nl-nl": "^1.1.2",
|
|
89
89
|
"jest": "^28.1.3",
|
|
90
90
|
"lorem-ipsum": "^2.0.8",
|
|
@@ -93,5 +93,5 @@
|
|
|
93
93
|
"rollup-plugin-dts": "^4.2.2",
|
|
94
94
|
"ts-jest": "^28.0.8"
|
|
95
95
|
},
|
|
96
|
-
"gitHead": "
|
|
96
|
+
"gitHead": "3c5c8c51b6cad9bc728f3383f5fe6ba34d6d559f"
|
|
97
97
|
}
|