@jslint-org/jslint 2022.6.21 → 2022.9.20
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/CHANGELOG.md +9 -2
- package/README.md +377 -27
- package/jslint.mjs +231 -158
- package/jslint_wrapper_vscode.js +54 -5
- package/package.json +1 -1
package/jslint_wrapper_vscode.js
CHANGED
|
@@ -30,10 +30,11 @@
|
|
|
30
30
|
/*property
|
|
31
31
|
Diagnostic, DiagnosticSeverity, ProgressLocation, Warning, Window, activate,
|
|
32
32
|
cancellable, character, clear, column, commands, createDiagnosticCollection,
|
|
33
|
-
document, end, exports, getText, increment,
|
|
34
|
-
location, map, message, module, push,
|
|
35
|
-
|
|
36
|
-
|
|
33
|
+
document, end, endsWith, exports, getText, increment, insert, isEmpty,
|
|
34
|
+
jslint, languages, line, lineAt, location, map, message, module, push,
|
|
35
|
+
range, rangeIncludingLineBreak, readFileSync, registerTextEditorCommand,
|
|
36
|
+
replace, report, runInNewContext, selection, set, slice, start,
|
|
37
|
+
subscriptions, title, uri, warnings, window, withProgress
|
|
37
38
|
*/
|
|
38
39
|
|
|
39
40
|
"use strict";
|
|
@@ -82,6 +83,48 @@ function activate({
|
|
|
82
83
|
});
|
|
83
84
|
}
|
|
84
85
|
|
|
86
|
+
function jslintDisableRegion({
|
|
87
|
+
document,
|
|
88
|
+
selection
|
|
89
|
+
}, edit) {
|
|
90
|
+
let range;
|
|
91
|
+
let text;
|
|
92
|
+
edit.insert({
|
|
93
|
+
character: 0,
|
|
94
|
+
line: selection.start.line
|
|
95
|
+
}, "/*jslint-disable*/\n");
|
|
96
|
+
range = document.lineAt(selection.end).rangeIncludingLineBreak;
|
|
97
|
+
text = document.getText(range);
|
|
98
|
+
|
|
99
|
+
// If selection-end is EOL without preceding line-break,
|
|
100
|
+
// then prepend line-break before directive.
|
|
101
|
+
|
|
102
|
+
if (!text.endsWith("\n")) {
|
|
103
|
+
text += "\n/*jslint-enable*/";
|
|
104
|
+
|
|
105
|
+
// If selection-end is start of a new line, then prepend directive before it.
|
|
106
|
+
|
|
107
|
+
} else if (!selection.isEmpty && selection.end.character === 0) {
|
|
108
|
+
text = "/*jslint-enable*/\n" + text;
|
|
109
|
+
|
|
110
|
+
// Append directive to selection-end.
|
|
111
|
+
|
|
112
|
+
} else {
|
|
113
|
+
text += "/*jslint-enable*/\n";
|
|
114
|
+
}
|
|
115
|
+
edit.replace(range, text);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
function jslintIgnoreLine({
|
|
119
|
+
document,
|
|
120
|
+
selection
|
|
121
|
+
}, edit) {
|
|
122
|
+
edit.insert({
|
|
123
|
+
character: document.lineAt(selection.end).range.end.character,
|
|
124
|
+
line: selection.end.line
|
|
125
|
+
}, " //jslint-ignore-line");
|
|
126
|
+
}
|
|
127
|
+
|
|
85
128
|
function jslintLint({
|
|
86
129
|
document
|
|
87
130
|
}) {
|
|
@@ -148,7 +191,7 @@ function activate({
|
|
|
148
191
|
require("vm").runInNewContext(
|
|
149
192
|
(
|
|
150
193
|
"\"use strict\";"
|
|
151
|
-
+ require("fs").readFileSync( //jslint-
|
|
194
|
+
+ require("fs").readFileSync( //jslint-ignore-line
|
|
152
195
|
__dirname + "/jslint.mjs",
|
|
153
196
|
"utf8"
|
|
154
197
|
).replace(
|
|
@@ -170,6 +213,12 @@ function activate({
|
|
|
170
213
|
subscriptions.push(vscode.commands.registerTextEditorCommand((
|
|
171
214
|
"jslint.clear"
|
|
172
215
|
), jslintClear));
|
|
216
|
+
subscriptions.push(vscode.commands.registerTextEditorCommand((
|
|
217
|
+
"jslint.disableRegion"
|
|
218
|
+
), jslintDisableRegion));
|
|
219
|
+
subscriptions.push(vscode.commands.registerTextEditorCommand((
|
|
220
|
+
"jslint.ignoreLine"
|
|
221
|
+
), jslintIgnoreLine));
|
|
173
222
|
subscriptions.push(vscode.commands.registerTextEditorCommand((
|
|
174
223
|
"jslint.lint"
|
|
175
224
|
), jslintLint));
|
package/package.json
CHANGED