diff --git a/lib/jscs-rules/require-spaces-after-closing-parenthesis-in-function-declaration.js b/lib/jscs-rules/require-spaces-after-closing-parenthesis-in-function-declaration.js index 8ead028da71..690574ad3a3 100644 --- a/lib/jscs-rules/require-spaces-after-closing-parenthesis-in-function-declaration.js +++ b/lib/jscs-rules/require-spaces-after-closing-parenthesis-in-function-declaration.js @@ -25,20 +25,10 @@ module.exports.prototype = { check: function(file, errors) { var beforeOpeningRoundBrace = this._beforeOpeningRoundBrace; var beforeOpeningCurlyBrace = this._beforeOpeningCurlyBrace; - var tokens = file.getTokens(); file.iterateNodesByType(['FunctionDeclaration'], function(node) { - var nodeBeforeRoundBrace = node; - // named function - if (node.id) { - nodeBeforeRoundBrace = node.id; - } - - var functionTokenPos = file.getTokenPosByRangeStart(nodeBeforeRoundBrace.range[0]); - var functionToken = tokens[functionTokenPos]; - - var nextTokenPos = file.getTokenPosByRangeStart(functionToken.range[1]); - var nextToken = tokens[nextTokenPos]; + var functionToken = file.getFirstNodeToken(node.id || node); + var nextToken = file.getNextToken(functionToken); if (beforeOpeningRoundBrace) { if (nextToken) { @@ -56,8 +46,8 @@ module.exports.prototype = { } } - var tokenBeforeBodyPos = file.getTokenPosByRangeStart(node.body.range[0] - 1); - var tokenBeforeBody = tokens[tokenBeforeBodyPos]; + // errors if no token is found unless `includeComments` is passed + var tokenBeforeBody = file.getPrevToken(node.body, { includeComments: true }); if (beforeOpeningCurlyBrace) { if (tokenBeforeBody) { diff --git a/packages/container/lib/registry.js b/packages/container/lib/registry.js index 10bb59c5bd5..e2efeec2998 100644 --- a/packages/container/lib/registry.js +++ b/packages/container/lib/registry.js @@ -137,7 +137,7 @@ Registry.prototype = { @property _defaultContainer @type Container */ - _defaultContainer: null, + _defaultContainer: null, /** Creates a container based on this registry. diff --git a/packages/ember-htmlbars/lib/helpers/collection.js b/packages/ember-htmlbars/lib/helpers/collection.js index 9760a5efefa..3eec1facf07 100644 --- a/packages/ember-htmlbars/lib/helpers/collection.js +++ b/packages/ember-htmlbars/lib/helpers/collection.js @@ -220,8 +220,8 @@ export function collectionHelper(params, hash, options, env) { if (inverse) { emptyViewClass = get(collectionPrototype, 'emptyViewClass'); emptyViewClass = emptyViewClass.extend({ - template: inverse, - tagName: itemHash.tagName + template: inverse, + tagName: itemHash.tagName }); } else if (hash.emptyViewClass) { emptyViewClass = readViewFactory(hash.emptyViewClass, container); diff --git a/packages/ember-htmlbars/tests/attr_nodes/boolean_test.js b/packages/ember-htmlbars/tests/attr_nodes/boolean_test.js index 8079029a082..265dbbbc3e9 100644 --- a/packages/ember-htmlbars/tests/attr_nodes/boolean_test.js +++ b/packages/ember-htmlbars/tests/attr_nodes/boolean_test.js @@ -9,8 +9,8 @@ function appendView(view) { run(function() { view.appendTo('#qunit-fixture'); }); } -if (Ember.FEATURES.isEnabled('ember-htmlbars-attribute-syntax')) { // jscs:disable validateIndentation +if (Ember.FEATURES.isEnabled('ember-htmlbars-attribute-syntax')) { QUnit.module("ember-htmlbars: boolean attribute", { teardown() { @@ -94,6 +94,5 @@ QUnit.test("disabled attribute preserves a blank string value", function() { 'boolean property is set false'); }); - -// jscs:enable validateIndentation } +// jscs:enable validateIndentation diff --git a/packages/ember-htmlbars/tests/attr_nodes/class_test.js b/packages/ember-htmlbars/tests/attr_nodes/class_test.js index feb15295723..1c40fbefd34 100644 --- a/packages/ember-htmlbars/tests/attr_nodes/class_test.js +++ b/packages/ember-htmlbars/tests/attr_nodes/class_test.js @@ -14,8 +14,8 @@ if (Ember.FEATURES.isEnabled('ember-htmlbars-inline-if-helper')) { isInlineIfEnabled = true; } -if (Ember.FEATURES.isEnabled('ember-htmlbars-attribute-syntax')) { // jscs:disable validateIndentation +if (Ember.FEATURES.isEnabled('ember-htmlbars-attribute-syntax')) { QUnit.module("ember-htmlbars: class attribute", { teardown() { @@ -151,5 +151,5 @@ QUnit.test("class attribute stays in order", function() { ok(view.element.firstChild.className, 'r b a c', 'classes are in the right order'); }); -// jscs:enable validateIndentation } +// jscs:enable validateIndentation diff --git a/packages/ember-htmlbars/tests/attr_nodes/href_test.js b/packages/ember-htmlbars/tests/attr_nodes/href_test.js index c3e35813c6c..b877f1c5dfb 100644 --- a/packages/ember-htmlbars/tests/attr_nodes/href_test.js +++ b/packages/ember-htmlbars/tests/attr_nodes/href_test.js @@ -9,8 +9,8 @@ function appendView(view) { run(function() { view.appendTo('#qunit-fixture'); }); } -if (Ember.FEATURES.isEnabled('ember-htmlbars-attribute-syntax')) { // jscs:disable validateIndentation +if (Ember.FEATURES.isEnabled('ember-htmlbars-attribute-syntax')) { QUnit.module("ember-htmlbars: href attribute", { teardown() { @@ -31,5 +31,5 @@ QUnit.test("href is set", function() { "attribute is output"); }); -// jscs:enable validateIndentation } +// jscs:enable validateIndentation diff --git a/packages/ember-htmlbars/tests/attr_nodes/property_test.js b/packages/ember-htmlbars/tests/attr_nodes/property_test.js index 57c4a1dba58..6d6a1af3754 100644 --- a/packages/ember-htmlbars/tests/attr_nodes/property_test.js +++ b/packages/ember-htmlbars/tests/attr_nodes/property_test.js @@ -15,8 +15,8 @@ function canSetFalsyMaxLength() { return input.maxLength === 0; } -if (Ember.FEATURES.isEnabled('ember-htmlbars-attribute-syntax')) { // jscs:disable validateIndentation +if (Ember.FEATURES.isEnabled('ember-htmlbars-attribute-syntax')) { QUnit.module("ember-htmlbars: property", { teardown() { @@ -69,5 +69,5 @@ QUnit.test("array value can be set as property", function() { ok(true, "no legacy assertion prohibited setting an array"); }); -// jscs:enable validateIndentation } +// jscs:enable validateIndentation diff --git a/packages/ember-htmlbars/tests/attr_nodes/sanitized_test.js b/packages/ember-htmlbars/tests/attr_nodes/sanitized_test.js index fac34821abf..60b0d963d06 100644 --- a/packages/ember-htmlbars/tests/attr_nodes/sanitized_test.js +++ b/packages/ember-htmlbars/tests/attr_nodes/sanitized_test.js @@ -14,9 +14,9 @@ QUnit.module("ember-htmlbars: sanitized attribute", { } }); -if (Ember.FEATURES.isEnabled('ember-htmlbars-attribute-syntax')) { // jscs:disable validateIndentation // jscs:disable disallowTrailingWhitespace +if (Ember.FEATURES.isEnabled('ember-htmlbars-attribute-syntax')) { var badTags = [ { tag: 'a', attr: 'href', @@ -28,12 +28,12 @@ var badTags = [ unquotedTemplate: compile(""), quotedTemplate: compile(""), multipartTemplate: compile("") }, - + { tag: 'embed', attr: 'src', unquotedTemplate: compile(""), quotedTemplate: compile(""), multipartTemplate: compile("") }, - + { tag: 'body', attr: 'background', unquotedTemplate: compile(""), quotedTemplate: compile(""), @@ -123,5 +123,6 @@ for (var i=0, l=badTags.length; i` generates a warning', function() { @@ -75,5 +75,5 @@ QUnit.test('specifying `
` works properly with a S deepEqual(warnings, [ ]); }); -// jscs:enable validateIndentation } +// jscs:enable validateIndentation diff --git a/packages/ember-htmlbars/tests/attr_nodes/svg_test.js b/packages/ember-htmlbars/tests/attr_nodes/svg_test.js index d8b77cffeb4..b762dea1fcd 100644 --- a/packages/ember-htmlbars/tests/attr_nodes/svg_test.js +++ b/packages/ember-htmlbars/tests/attr_nodes/svg_test.js @@ -9,8 +9,8 @@ function appendView(view) { run(function() { view.appendTo('#qunit-fixture'); }); } -if (Ember.FEATURES.isEnabled('ember-htmlbars-attribute-syntax')) { // jscs:disable validateIndentation +if (Ember.FEATURES.isEnabled('ember-htmlbars-attribute-syntax')) { QUnit.module("ember-htmlbars: svg attribute", { teardown() { @@ -75,5 +75,5 @@ QUnit.test("class is output", function() { equalInnerHTML(view.element, '', "attribute is output"); }); -// jscs:enable validateIndentation } +// jscs:enable validateIndentation diff --git a/packages/ember-htmlbars/tests/attr_nodes/value_test.js b/packages/ember-htmlbars/tests/attr_nodes/value_test.js index 30b2ac007e1..d1b757fcc4e 100644 --- a/packages/ember-htmlbars/tests/attr_nodes/value_test.js +++ b/packages/ember-htmlbars/tests/attr_nodes/value_test.js @@ -8,8 +8,8 @@ function appendView(view) { run(function() { view.appendTo('#qunit-fixture'); }); } -if (Ember.FEATURES.isEnabled('ember-htmlbars-attribute-syntax')) { // jscs:disable validateIndentation +if (Ember.FEATURES.isEnabled('ember-htmlbars-attribute-syntax')) { QUnit.module("ember-htmlbars: value attribute", { teardown() { @@ -55,5 +55,5 @@ QUnit.test("blank property is output", function() { 'property is set true'); }); -// jscs:enable validateIndentation } +// jscs:enable validateIndentation diff --git a/packages/ember-htmlbars/tests/helpers/collection_test.js b/packages/ember-htmlbars/tests/helpers/collection_test.js index 7384303f883..d5f5452e908 100644 --- a/packages/ember-htmlbars/tests/helpers/collection_test.js +++ b/packages/ember-htmlbars/tests/helpers/collection_test.js @@ -156,8 +156,8 @@ QUnit.test("collection helper should try to use container to resolve view", func var container = registry.container(); var ACollectionView = CollectionView.extend({ - tagName: 'ul', - content: A(['foo', 'bar', 'baz']) + tagName: 'ul', + content: A(['foo', 'bar', 'baz']) }); registry.register('view:collectionTest', ACollectionView); diff --git a/packages/ember-htmlbars/tests/helpers/each_test.js b/packages/ember-htmlbars/tests/helpers/each_test.js index 630017466b9..7bc813fd9ce 100644 --- a/packages/ember-htmlbars/tests/helpers/each_test.js +++ b/packages/ember-htmlbars/tests/helpers/each_test.js @@ -570,8 +570,8 @@ QUnit.test("it supports {{itemViewClass=}} via container", function() { QUnit.test("it supports {{itemViewClass=}} with tagName (DEPRECATED)", function() { runDestroy(view); view = EmberView.create({ - template: templateFor('{{each view.people itemViewClass=MyView tagName="ul"}}'), - people: people + template: templateFor('{{each view.people itemViewClass=MyView tagName="ul"}}'), + people: people }); expectDeprecation(/Supplying a tagName to Metamorph views is unreliable and is deprecated./); diff --git a/packages/ember-routing/tests/location/hash_location_test.js b/packages/ember-routing/tests/location/hash_location_test.js index 0e3cb2ed983..0f57e033fad 100644 --- a/packages/ember-routing/tests/location/hash_location_test.js +++ b/packages/ember-routing/tests/location/hash_location_test.js @@ -21,14 +21,14 @@ function mockBrowserLocation(path) { var pathname = (tmp.pathname.match(/^\//)) ? tmp.pathname : '/' + tmp.pathname; return { - hash: tmp.hash, - host: tmp.host || 'localhost', - hostname: tmp.hostname || 'localhost', - href: tmp.href, - pathname: pathname, - port: tmp.port || '', - protocol: protocol, - search: tmp.search + hash: tmp.hash, + host: tmp.host || 'localhost', + hostname: tmp.hostname || 'localhost', + href: tmp.href, + pathname: pathname, + port: tmp.port || '', + protocol: protocol, + search: tmp.search }; } diff --git a/packages/ember-routing/tests/location/history_location_test.js b/packages/ember-routing/tests/location/history_location_test.js index 9ab081ee94e..0d707b61faa 100644 --- a/packages/ember-routing/tests/location/history_location_test.js +++ b/packages/ember-routing/tests/location/history_location_test.js @@ -19,14 +19,14 @@ function mockBrowserLocation(path) { var pathname = (tmp.pathname.match(/^\//)) ? tmp.pathname : '/' + tmp.pathname; return { - hash: tmp.hash, - host: tmp.host || 'localhost', - hostname: tmp.hostname || 'localhost', - href: tmp.href, - pathname: pathname, - port: tmp.port || '', - protocol: protocol, - search: tmp.search + hash: tmp.hash, + host: tmp.host || 'localhost', + hostname: tmp.hostname || 'localhost', + href: tmp.href, + pathname: pathname, + port: tmp.port || '', + protocol: protocol, + search: tmp.search }; } diff --git a/packages/ember-routing/tests/system/dsl_test.js b/packages/ember-routing/tests/system/dsl_test.js index 2bcf475334b..4e7d4655857 100644 --- a/packages/ember-routing/tests/system/dsl_test.js +++ b/packages/ember-routing/tests/system/dsl_test.js @@ -78,8 +78,8 @@ QUnit.test("should retain resource namespace if nested with routes", function() ok(router.router.recognizer.names['bleep.bloop.blork'], 'parent name was used as base of nested routes'); }); -if (Ember.FEATURES.isEnabled("ember-routing-named-substates")) { // jscs:disable validateIndentation +if (Ember.FEATURES.isEnabled("ember-routing-named-substates")) { QUnit.test("should add loading and error routes if _isRouterMapResult is true", function() { Router.map(function() { @@ -107,5 +107,5 @@ QUnit.test("should not add loading and error routes if _isRouterMapResult is fal ok(!router.router.recognizer.names['blork_error'], 'error route was not added'); }); -// jscs:enable validateIndentation } +// jscs:enable validateIndentation diff --git a/packages/ember-runtime/lib/ext/rsvp.js b/packages/ember-runtime/lib/ext/rsvp.js index 0884a75796e..53349ae4eb4 100644 --- a/packages/ember-runtime/lib/ext/rsvp.js +++ b/packages/ember-runtime/lib/ext/rsvp.js @@ -25,13 +25,13 @@ RSVP.configure('async', function(callback, promise) { if (Ember.testing && async) { asyncStart(); } - run.backburner.schedule('actions', function(){ + run.backburner.schedule('actions', function() { if (Ember.testing && async) { asyncEnd(); } callback(promise); }); }); -RSVP.Promise.prototype.fail = function(callback, label){ +RSVP.Promise.prototype.fail = function(callback, label) { Ember.deprecate('RSVP.Promise.fail has been renamed as RSVP.Promise.catch'); return this['catch'](callback, label); }; diff --git a/packages/ember-runtime/tests/computed/reduce_computed_macros_test.js b/packages/ember-runtime/tests/computed/reduce_computed_macros_test.js index bfdf1a236d6..206390d4690 100644 --- a/packages/ember-runtime/tests/computed/reduce_computed_macros_test.js +++ b/packages/ember-runtime/tests/computed/reduce_computed_macros_test.js @@ -634,18 +634,18 @@ QUnit.module('computedSetDiff', { QUnit.test("it throws an error if given fewer or more than two dependent properties", function() { throws(function () { EmberObject.createWithMixins({ - array: Ember.A([1,2,3,4,5,6,7]), - array2: Ember.A([3,4,5]), - diff: computedSetDiff('array') + array: Ember.A([1,2,3,4,5,6,7]), + array2: Ember.A([3,4,5]), + diff: computedSetDiff('array') }); }, /requires exactly two dependent arrays/, "setDiff requires two dependent arrays"); throws(function () { EmberObject.createWithMixins({ - array: Ember.A([1,2,3,4,5,6,7]), - array2: Ember.A([3,4,5]), - array3: Ember.A([7]), - diff: computedSetDiff('array', 'array2', 'array3') + array: Ember.A([1,2,3,4,5,6,7]), + array2: Ember.A([3,4,5]), + array3: Ember.A([7]), + diff: computedSetDiff('array', 'array2', 'array3') }); }, /requires exactly two dependent arrays/, "setDiff requires two dependent arrays"); }); diff --git a/packages/ember-runtime/tests/computed/reduce_computed_test.js b/packages/ember-runtime/tests/computed/reduce_computed_test.js index d91c3d7ce03..ef3af931fcb 100644 --- a/packages/ember-runtime/tests/computed/reduce_computed_test.js +++ b/packages/ember-runtime/tests/computed/reduce_computed_test.js @@ -125,7 +125,7 @@ QUnit.test("on first retrieval, array computed properties dependent on nested ob QUnit.test("after the first retrieval, array computed properties observe additions to dependent arrays", function() { var numbers = get(obj, 'numbers'); - // set up observers + // set up observers var evenNumbers = get(obj, 'evenNumbers'); run(function() { @@ -137,7 +137,7 @@ QUnit.test("after the first retrieval, array computed properties observe additio QUnit.test("after the first retrieval, array computed properties observe removals from dependent arrays", function() { var numbers = get(obj, 'numbers'); - // set up observers + // set up observers var evenNumbers = get(obj, 'evenNumbers'); run(function() { diff --git a/packages/ember-runtime/tests/legacy_1x/mixins/observable/propertyChanges_test.js b/packages/ember-runtime/tests/legacy_1x/mixins/observable/propertyChanges_test.js index e5799f3ff80..acb3be90819 100644 --- a/packages/ember-runtime/tests/legacy_1x/mixins/observable/propertyChanges_test.js +++ b/packages/ember-runtime/tests/legacy_1x/mixins/observable/propertyChanges_test.js @@ -70,7 +70,7 @@ QUnit.test("should observe the changes within the nested begin / end property ch equal(ObjectA.prop, "propValue"); ObjectA.endPropertyChanges(); - //end inner nest + //end inner nest ObjectA.set('prop', 'changePropValue'); equal(ObjectA.newFoo, "newFooValue"); diff --git a/packages/ember-runtime/tests/legacy_1x/system/binding_test.js b/packages/ember-runtime/tests/legacy_1x/system/binding_test.js index e2ae123ad56..8e8ffa0b09b 100644 --- a/packages/ember-runtime/tests/legacy_1x/system/binding_test.js +++ b/packages/ember-runtime/tests/legacy_1x/system/binding_test.js @@ -284,9 +284,9 @@ QUnit.module("propertyNameBinding with longhand", { }); TestNamespace.toObject = EmberObject.createWithMixins({ - valueBinding: Binding.from('TestNamespace.fromObject.value'), - localValue: "originalLocal", - relativeBinding: Binding.from('localValue') + valueBinding: Binding.from('TestNamespace.fromObject.value'), + localValue: "originalLocal", + relativeBinding: Binding.from('localValue') }); }); }, diff --git a/packages/ember-runtime/tests/legacy_1x/system/object/bindings_test.js b/packages/ember-runtime/tests/legacy_1x/system/object/bindings_test.js index 846b624f6e5..83e4b35de13 100644 --- a/packages/ember-runtime/tests/legacy_1x/system/object/bindings_test.js +++ b/packages/ember-runtime/tests/legacy_1x/system/object/bindings_test.js @@ -115,7 +115,7 @@ var fooBindingModuleOpts = { teardown() { Ember.lookup = originalLookup; TestObject = fromObject = extraObject = null; - // delete TestNamespace; + // delete TestNamespace; } }; diff --git a/packages/ember-runtime/tests/legacy_1x/system/set_test.js b/packages/ember-runtime/tests/legacy_1x/system/set_test.js index bf4752c0cba..03d13401a40 100644 --- a/packages/ember-runtime/tests/legacy_1x/system/set_test.js +++ b/packages/ember-runtime/tests/legacy_1x/system/set_test.js @@ -288,8 +288,8 @@ QUnit.test("should ignore removing an object not in the set", function() { }); QUnit.module("Set.pop + Set.copy", { -// generate a set with every type of object, but none of the specific -// ones we add in the tests below... + // generate a set with every type of object, but none of the specific + // ones we add in the tests below... setup() { ignoreDeprecation(function() { set = new Set(Ember.A([ diff --git a/packages/ember-runtime/tests/suites/array.js b/packages/ember-runtime/tests/suites/array.js index ddb9cdb56e4..0a1528567ce 100644 --- a/packages/ember-runtime/tests/suites/array.js +++ b/packages/ember-runtime/tests/suites/array.js @@ -8,7 +8,7 @@ import objectAtTests from 'ember-runtime/tests/suites/array/objectAt'; var ObserverClass = EnumerableTestsObserverClass.extend({ - observeArray(obj) { + observeArray(obj) { obj.addArrayObserver(this); return this; }, diff --git a/packages/ember/tests/helpers/helper_registration_test.js b/packages/ember/tests/helpers/helper_registration_test.js index 08c255122ab..7f8920f993e 100644 --- a/packages/ember/tests/helpers/helper_registration_test.js +++ b/packages/ember/tests/helpers/helper_registration_test.js @@ -68,7 +68,7 @@ QUnit.test("Unbound dashed helpers registered on the container can be late-invok ok(!helpers['x-borf'], "Container-registered helper doesn't wind up on global helpers hash"); }); - // need to make `makeBoundHelper` for HTMLBars +// need to make `makeBoundHelper` for HTMLBars QUnit.test("Bound helpers registered on the container can be late-invoked", function() { Ember.TEMPLATES.application = compile("
{{x-reverse}} {{x-reverse foo}}
"); @@ -83,8 +83,8 @@ QUnit.test("Bound helpers registered on the container can be late-invoked", func ok(!helpers['x-reverse'], "Container-registered helper doesn't wind up on global helpers hash"); }); - // we have unit tests for this in ember-htmlbars/tests/system/lookup-helper - // and we are not going to recreate the handlebars helperMissing concept +// we have unit tests for this in ember-htmlbars/tests/system/lookup-helper +// and we are not going to recreate the handlebars helperMissing concept QUnit.test("Undashed helpers registered on the container can not (presently) be invoked", function() { // Note: the reason we're not allowing undashed helpers is to avoid