Remove unused vars #8954

Merged
merged 17 commits into from Sep 17, 2014

Projects

None yet

6 participants

@MarcelGerber
Member

Code cleanup for JSHint support

  • Removes unused vars (reported by JSHint)
  • Adjusts .jshintrc config: Remove obsolete prefs, add unused: "vars" (... will change our Travis results)
  • Remove unused /* globals */ (reported by JSHint)
  • Make ExtensionLoader.js pass JSLint
@peterflynn peterflynn commented on the diff Sep 4, 2014
src/command/Menus.js
@@ -31,8 +31,7 @@ define(function (require, exports, module) {
var _ = require("thirdparty/lodash");
// Load dependent modules
- var Global = require("utils/Global"),
@peterflynn
peterflynn Sep 4, 2014 Member

Drive-by note: we can't just remove unused references to Globals, since this is used to ensure a load order that sets up the global brackets.* members early enough. You'll have to change cases like this to a require() call that's not stored into a variable.

@MarcelGerber
MarcelGerber Sep 4, 2014 Member

Done (MarcelGerber@5c44c87).
I didn't add it back to SidebarView as it never uses brackets.

@MarcelGerber
Member

Fixed the Travis build.

@le717 le717 commented on the diff Sep 4, 2014
src/extensions/default/HtmlEntityCodeHints/unittests.js
@@ -23,15 +23,13 @@
/*jslint vars: true, plusplus: true, devel: true, browser: true, nomen: true, indent: 4, maxerr: 50 */
-/*global define, describe, it, xit, expect, beforeEach, afterEach, waitsFor, runs, $, brackets, waitsForDone */
@le717
le717 Sep 4, 2014 Contributor

Because a test might have to be disabled at any time, perhaps xit should be added to the globals array in .jshintrc?

@redmunds
redmunds Sep 4, 2014 Contributor

Yes, but xit should only be used as a temporary fix, so it's nice to get a warning from jslint as a reminder.

@MarcelGerber
MarcelGerber Sep 4, 2014 Member

We actually have 28 calls to xit in 10 files on current master.

MarcelGerber added some commits Sep 4, 2014
@MarcelGerber MarcelGerber Fix "globals" option 3c2859a
@MarcelGerber MarcelGerber Merge remote-tracking branch 'upstream/master' into unused-vars
Conflicts:
	src/brackets.js
	src/document/DocumentManager.js
	src/editor/EditorManager.js
	src/editor/ImageViewer.js
	src/extensions/default/JavaScriptQuickEdit/unittests.js
	src/extensions/default/UrlCodeHints/unittests.js
	src/language/CodeInspection.js
	src/project/WorkingSetSort.js
	src/project/WorkingSetView.js
	src/search/FindReplace.js
	src/search/ScrollTrackMarkers.js
	test/spec/FindReplace-test.js
	test/spec/LanguageManager-test.js
98a79c1
@MarcelGerber MarcelGerber [SplitView] Removed unused vars f8a2749
@MarcelGerber MarcelGerber Fix EditorCommandHandlers unit tests ce242f8
@MarcelGerber MarcelGerber Update 7563498
@MarcelGerber MarcelGerber Merge remote-tracking branch 'upstream/master' into unused-vars 07db97c
@MarcelGerber MarcelGerber Merge remote-tracking branch 'upstream/master' into unused-vars
Conflicts:
	src/search/FindReplace.js
	src/utils/ViewUtils.js
7c3c5c9
@MarcelGerber MarcelGerber Merge remote-tracking branch 'upstream/master' into unused-vars
Conflicts:
	src/widgets/StatusBar.js
4b5eeb4
@ingorichter ingorichter self-assigned this Sep 15, 2014
@ingorichter
Contributor

I'm done with my review. There is nothing that made me nervous and I'd like to merge this change.

@dangoor dangoor commented on an outdated diff Sep 16, 2014
src/language/HTMLInstrumentation.js
@@ -162,24 +161,6 @@ define(function (require, exports, module) {
return match.mark;
}
-
- /**
- * @private
- * Dumps the current list of mark ranges for instrumented tags to the console. Used for debugging.
- * @param {Editor} editor The editor to find the mark ranges for.
- * @param {Object=} nodeMap If specified, a map of tag IDs to DOM nodes, used so we can indicate which tag name
- * the DOM thinks corresponds to the given mark.
- */
- function _dumpMarks(editor, nodeMap) {
@dangoor
dangoor Sep 16, 2014 Contributor

This should not be removed. It's a handy debugging function.

@MarcelGerber
Member

Just did some other changes, mostly whitespace.
For just reviewing the actual changes, please use MarcelGerber@7734b35?w=0.

@MarcelGerber
Member

Just double checked everything in this PR. All tests pass, JSHint doesn't complain, Travis succeeds.

@ingorichter Please let me know whether I should stash the changes.
And be aware merging this PR will break many open PRs and their Travis builds, and it will make JSHint behave rather different from JSLint.

@MarcelGerber MarcelGerber reopened this Sep 16, 2014
@MarcelGerber
Member

(Didn't mean to close)

@ingorichter
Contributor

@MarcelGerber I'm aware that this will most likely to cause some of the existing PR's to choke. If we need to wait for a window where no PR is open and waiting to be merged, then we''l wait forever. :-)

@MarcelGerber
Member

@ingorichter That's what I thought as well ;)
Btw, I resolved the conflicts once again.

@ingorichter ingorichter merged commit 6affa79 into adobe:master Sep 17, 2014

1 check passed

continuous-integration/travis-ci The Travis CI build passed
Details
@ingorichter
Contributor

Getting ready to rumble...

@MarcelGerber MarcelGerber deleted the MarcelGerber:unused-vars branch Sep 17, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment