@cspell/eslint-plugin 6.4.0-alpha.0 → 6.4.2
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.
- package/dist/index.d.ts +19 -3
- package/dist/index.js +36 -7
- package/dist/index.mjs +36 -7
- package/package.json +9 -9
package/dist/index.d.ts
CHANGED
|
@@ -78,10 +78,26 @@ interface Check {
|
|
|
78
78
|
*/
|
|
79
79
|
checkComments?: boolean;
|
|
80
80
|
/**
|
|
81
|
-
*
|
|
82
|
-
* This file is used to present the option to add words.
|
|
81
|
+
* Specify a path to a custom word list file
|
|
83
82
|
*/
|
|
84
|
-
customWordListFile?:
|
|
83
|
+
customWordListFile?: CustomWordListFilePath | CustomWordListFile | undefined;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Specify a path to a custom word list file
|
|
87
|
+
*/
|
|
88
|
+
declare type CustomWordListFilePath = string;
|
|
89
|
+
interface CustomWordListFile {
|
|
90
|
+
/**
|
|
91
|
+
* Path to word list file.
|
|
92
|
+
* File format: 1 word per line
|
|
93
|
+
*/
|
|
94
|
+
path: CustomWordListFilePath;
|
|
95
|
+
/**
|
|
96
|
+
* **Experimental**: Provide a fix option to add words to the file.
|
|
97
|
+
*
|
|
98
|
+
* Note: this does not yet work perfectly.
|
|
99
|
+
*/
|
|
100
|
+
addWords: boolean;
|
|
85
101
|
}
|
|
86
102
|
|
|
87
103
|
export { Options, configs, rules };
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @cspell/eslint-plugin v6.
|
|
2
|
+
* @cspell/eslint-plugin v6.4.1
|
|
3
3
|
* Copyright 2022 Jason Dent <jason@streetsidesoftware.nl>
|
|
4
4
|
* Released under the MIT License
|
|
5
5
|
* https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell-eslint-plugin#readme
|
|
@@ -120,8 +120,31 @@ var properties = {
|
|
|
120
120
|
type: "boolean"
|
|
121
121
|
},
|
|
122
122
|
customWordListFile: {
|
|
123
|
-
|
|
124
|
-
|
|
123
|
+
anyOf: [
|
|
124
|
+
{
|
|
125
|
+
description: "Specify a path to a custom word list file",
|
|
126
|
+
type: "string"
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
additionalProperties: false,
|
|
130
|
+
properties: {
|
|
131
|
+
addWords: {
|
|
132
|
+
description: "**Experimental**: Provide a fix option to add words to the file.\n\nNote: this does not yet work perfectly.",
|
|
133
|
+
type: "boolean"
|
|
134
|
+
},
|
|
135
|
+
path: {
|
|
136
|
+
description: "Path to word list file. File format: 1 word per line",
|
|
137
|
+
type: "string"
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
required: [
|
|
141
|
+
"path",
|
|
142
|
+
"addWords"
|
|
143
|
+
],
|
|
144
|
+
type: "object"
|
|
145
|
+
}
|
|
146
|
+
],
|
|
147
|
+
description: "Specify a path to a custom word list file"
|
|
125
148
|
},
|
|
126
149
|
debugMode: {
|
|
127
150
|
"default": false,
|
|
@@ -336,9 +359,10 @@ function create(context) {
|
|
|
336
359
|
};
|
|
337
360
|
}
|
|
338
361
|
function createAddWordToDictionaryFix(word) {
|
|
339
|
-
if (!options.customWordListFile)
|
|
362
|
+
if (!isCustomWordListFile(options.customWordListFile) || !options.customWordListFile.addWords) {
|
|
340
363
|
return undefined;
|
|
341
|
-
|
|
364
|
+
}
|
|
365
|
+
const dictFile = path__namespace.resolve(context.getCwd(), options.customWordListFile.path);
|
|
342
366
|
const data = { word, dictionary: path__namespace.basename(dictFile) };
|
|
343
367
|
const messageId = 'addWordToDictionary';
|
|
344
368
|
return {
|
|
@@ -533,9 +557,11 @@ function getDocValidator(context) {
|
|
|
533
557
|
return validator;
|
|
534
558
|
}
|
|
535
559
|
function calcInitialSettings(options, cwd) {
|
|
536
|
-
|
|
560
|
+
const { customWordListFile } = options;
|
|
561
|
+
if (!customWordListFile)
|
|
537
562
|
return defaultSettings;
|
|
538
|
-
const
|
|
563
|
+
const filePath = isCustomWordListFile(customWordListFile) ? customWordListFile.path : customWordListFile;
|
|
564
|
+
const dictFile = path__namespace.resolve(cwd, filePath);
|
|
539
565
|
const settings = {
|
|
540
566
|
...defaultSettings,
|
|
541
567
|
dictionaryDefinitions: [{ name: 'eslint-plugin-custom-words', path: dictFile }],
|
|
@@ -578,6 +604,9 @@ class WrapFix {
|
|
|
578
604
|
return this.fix.text;
|
|
579
605
|
}
|
|
580
606
|
}
|
|
607
|
+
function isCustomWordListFile(value) {
|
|
608
|
+
return !!value && typeof value === 'object';
|
|
609
|
+
}
|
|
581
610
|
|
|
582
611
|
exports.configs = configs;
|
|
583
612
|
exports.rules = rules;
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @cspell/eslint-plugin v6.
|
|
2
|
+
* @cspell/eslint-plugin v6.4.1
|
|
3
3
|
* Copyright 2022 Jason Dent <jason@streetsidesoftware.nl>
|
|
4
4
|
* Released under the MIT License
|
|
5
5
|
* https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell-eslint-plugin#readme
|
|
@@ -92,8 +92,31 @@ var properties = {
|
|
|
92
92
|
type: "boolean"
|
|
93
93
|
},
|
|
94
94
|
customWordListFile: {
|
|
95
|
-
|
|
96
|
-
|
|
95
|
+
anyOf: [
|
|
96
|
+
{
|
|
97
|
+
description: "Specify a path to a custom word list file",
|
|
98
|
+
type: "string"
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
additionalProperties: false,
|
|
102
|
+
properties: {
|
|
103
|
+
addWords: {
|
|
104
|
+
description: "**Experimental**: Provide a fix option to add words to the file.\n\nNote: this does not yet work perfectly.",
|
|
105
|
+
type: "boolean"
|
|
106
|
+
},
|
|
107
|
+
path: {
|
|
108
|
+
description: "Path to word list file. File format: 1 word per line",
|
|
109
|
+
type: "string"
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
required: [
|
|
113
|
+
"path",
|
|
114
|
+
"addWords"
|
|
115
|
+
],
|
|
116
|
+
type: "object"
|
|
117
|
+
}
|
|
118
|
+
],
|
|
119
|
+
description: "Specify a path to a custom word list file"
|
|
97
120
|
},
|
|
98
121
|
debugMode: {
|
|
99
122
|
"default": false,
|
|
@@ -308,9 +331,10 @@ function create(context) {
|
|
|
308
331
|
};
|
|
309
332
|
}
|
|
310
333
|
function createAddWordToDictionaryFix(word) {
|
|
311
|
-
if (!options.customWordListFile)
|
|
334
|
+
if (!isCustomWordListFile(options.customWordListFile) || !options.customWordListFile.addWords) {
|
|
312
335
|
return undefined;
|
|
313
|
-
|
|
336
|
+
}
|
|
337
|
+
const dictFile = path.resolve(context.getCwd(), options.customWordListFile.path);
|
|
314
338
|
const data = { word, dictionary: path.basename(dictFile) };
|
|
315
339
|
const messageId = 'addWordToDictionary';
|
|
316
340
|
return {
|
|
@@ -505,9 +529,11 @@ function getDocValidator(context) {
|
|
|
505
529
|
return validator;
|
|
506
530
|
}
|
|
507
531
|
function calcInitialSettings(options, cwd) {
|
|
508
|
-
|
|
532
|
+
const { customWordListFile } = options;
|
|
533
|
+
if (!customWordListFile)
|
|
509
534
|
return defaultSettings;
|
|
510
|
-
const
|
|
535
|
+
const filePath = isCustomWordListFile(customWordListFile) ? customWordListFile.path : customWordListFile;
|
|
536
|
+
const dictFile = path.resolve(cwd, filePath);
|
|
511
537
|
const settings = {
|
|
512
538
|
...defaultSettings,
|
|
513
539
|
dictionaryDefinitions: [{ name: 'eslint-plugin-custom-words', path: dictFile }],
|
|
@@ -550,6 +576,9 @@ class WrapFix {
|
|
|
550
576
|
return this.fix.text;
|
|
551
577
|
}
|
|
552
578
|
}
|
|
579
|
+
function isCustomWordListFile(value) {
|
|
580
|
+
return !!value && typeof value === 'object';
|
|
581
|
+
}
|
|
553
582
|
|
|
554
583
|
export { configs, rules };
|
|
555
584
|
//# sourceMappingURL=index.mjs.map
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "6.4.
|
|
6
|
+
"version": "6.4.2",
|
|
7
7
|
"description": "[WIP] CSpell ESLint plugin",
|
|
8
8
|
"keywords": [
|
|
9
9
|
"cspell",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"scripts": {
|
|
36
36
|
"build": "npm run build-schema && npm run build-rollup",
|
|
37
37
|
"build-rollup": "rollup --config rollup.config.ts --configPlugin typescript",
|
|
38
|
-
"build-schema": "ts-json-schema-generator --no-top-ref --path src/options.ts --type Options -o ./src/_auto_generated_/options.schema.json",
|
|
38
|
+
"build-schema": "ts-json-schema-generator --no-top-ref --expose none --path src/options.ts --type Options -o ./src/_auto_generated_/options.schema.json",
|
|
39
39
|
"watch": "npm run build-rollup -- --watch",
|
|
40
40
|
"clean": "rimraf dist coverage .tsbuildinfo",
|
|
41
41
|
"clean-build": "npm run clean && npm run build",
|
|
@@ -59,11 +59,11 @@
|
|
|
59
59
|
"@rollup/plugin-node-resolve": "^13.3.0",
|
|
60
60
|
"@rollup/plugin-typescript": "^8.3.3",
|
|
61
61
|
"@types/eslint": "^8.4.5",
|
|
62
|
-
"@types/estree": "^0.0
|
|
63
|
-
"@types/node": "^18.
|
|
64
|
-
"@typescript-eslint/parser": "^5.
|
|
65
|
-
"@typescript-eslint/types": "^5.
|
|
66
|
-
"@typescript-eslint/typescript-estree": "^5.
|
|
62
|
+
"@types/estree": "^1.0.0",
|
|
63
|
+
"@types/node": "^18.6.1",
|
|
64
|
+
"@typescript-eslint/parser": "^5.31.0",
|
|
65
|
+
"@typescript-eslint/types": "^5.31.0",
|
|
66
|
+
"@typescript-eslint/typescript-estree": "^5.31.0",
|
|
67
67
|
"eslint": "^8.20.0",
|
|
68
68
|
"mocha": "^10.0.0",
|
|
69
69
|
"rimraf": "^3.0.2",
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
"ts-json-schema-generator": "^1.0.0"
|
|
73
73
|
},
|
|
74
74
|
"dependencies": {
|
|
75
|
-
"cspell-lib": "^6.4.
|
|
75
|
+
"cspell-lib": "^6.4.2"
|
|
76
76
|
},
|
|
77
|
-
"gitHead": "
|
|
77
|
+
"gitHead": "1f7481fd7d6a561de92ba49870da6eb1441a9d20"
|
|
78
78
|
}
|