Skip to content

Commit 7bc97ac

Browse files
committed
chore: remove jshint as default linter to prepare for eslint
1 parent 414f163 commit 7bc97ac

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

src/extensions/default/JSHint/main.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ define(function (require, exports, module) {
4646
projectSpecificOptions = null,
4747
jsHintConfigFileErrorMessage = null;
4848

49+
const PREFS_JSHINT_DISABLED = "disabled";
50+
4951
// We don't provide default options in the preferences as preferences will try to mixin default options with
5052
// user defined options leading to unexpected results. Either we take user defined options or default, no mixin.
5153
let DEFAULT_OPTIONS = {
@@ -58,8 +60,8 @@ define(function (require, exports, module) {
5860
"devel": false
5961
};
6062

61-
prefs.definePreference("options", "object", {}, {
62-
description: Strings.DESCRIPTION_JSHINT_OPTIONS
63+
prefs.definePreference(PREFS_JSHINT_DISABLED, "boolean", false, {
64+
description: Strings.DESCRIPTION_JSHINT_DISABLE
6365
}).on("change", function () {
6466
CodeInspection.requestRun(Strings.JSHINT_NAME);
6567
});
@@ -86,9 +88,7 @@ define(function (require, exports, module) {
8688
// If a line contains only whitespace (here spaces or tabs), remove the whitespace
8789
text = text.replace(/^[ \t]+$/gm, "");
8890

89-
let userPrefOptions = _.isEmpty(prefs.get("options")) ? DEFAULT_OPTIONS : prefs.get("options");
90-
91-
let options = projectSpecificOptions || userPrefOptions;
91+
let options = projectSpecificOptions || DEFAULT_OPTIONS;
9292

9393
IndexingWorker.execPeer("jsHint", {
9494
text,
@@ -230,6 +230,7 @@ define(function (require, exports, module) {
230230
_reloadOptions();
231231
} else if(_isFileInArray(configFilePath, removed)){
232232
projectSpecificOptions = null;
233+
jsHintConfigFileErrorMessage = null;
233234
}
234235
}
235236

@@ -244,7 +245,8 @@ define(function (require, exports, module) {
244245
name: Strings.JSHINT_NAME,
245246
scanFileAsync: lintOneFile,
246247
canInspect: function (fullPath) {
247-
return fullPath && !fullPath.endsWith(".min.js");
248+
return !prefs.get(PREFS_JSHINT_DISABLED) && (projectSpecificOptions || jsHintConfigFileErrorMessage)
249+
&& fullPath && !fullPath.endsWith(".min.js");
248250
}
249251
});
250252
});

src/nls/root/strings.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -952,7 +952,7 @@ define({
952952
"DESCRIPTION_HIGHLIGHT_MATCHES_WORDS_ONLY": "Highlight only when selection is a complete token",
953953
"DESCRIPTION_INSERT_HINT_ON_TAB": "true to insert the currently selected code hint on tab",
954954
"DESCRIPTION_NO_HINTS_ON_DOT": "true to not automatically show JS code hints when . is typed",
955-
"DESCRIPTION_JSHINT_OPTIONS": "An object with the default options for JSHint. Please see the following URL for all available JSHint Options: https://jshint.com/docs/options/",
955+
"DESCRIPTION_JSHINT_DISABLE": "true to disable JSHints linter in problems panel",
956956
"DESCRIPTION_LANGUAGE": "Language specific settings",
957957
"DESCRIPTION_LANGUAGE_FILE_EXTENSIONS": "Additional mappings from file extension to language name",
958958
"DESCRIPTION_LANGUAGE_FILE_NAMES": "Additional mappings from file name to language name",

0 commit comments

Comments
 (0)