Skip to content

Commit

Permalink
Merge pull request #15838 from kellyselden/eslint
Browse files Browse the repository at this point in the history
promote eslint rule "semi" to entire project
  • Loading branch information
rwjblue authored Nov 9, 2017
2 parents c1a892d + cd364f5 commit 1fe2274
Show file tree
Hide file tree
Showing 43 changed files with 81 additions and 80 deletions.
2 changes: 2 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ module.exports = {
'ember-internal/require-yuidoc-access': 'error',
'ember-internal/no-const-outside-module-scope': 'error',

'semi': 'error',

// temporarily disabled
'no-unused-vars': 'off',
'comma-dangle': 'off',
Expand Down
1 change: 0 additions & 1 deletion node-tests/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,5 @@ module.exports = {
node: true,
},
rules: {
'semi': 'error',
},
};
4 changes: 2 additions & 2 deletions packages/container/lib/registry.js
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,7 @@ if (DEBUG) {
}

return injections;
}
};

Registry.prototype.validateInjections = function(injections) {
if (!injections) { return; }
Expand All @@ -639,7 +639,7 @@ if (DEBUG) {

assert(`Attempting to inject an unknown injection: '${fullName}'`, this.has(fullName));
}
}
};
}

function expandLocalLookup(registry, normalizedName, normalizedSource) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,15 +126,15 @@ QUnit.test('unregistering a factory clears all cached instances of that factory'
let postController1 = appInstance.lookup('controller:post');
let postController1Factory = appInstance.factoryFor('controller:post');
assert.ok(postController1 instanceof PostController1, 'precond - lookup creates instance');
assert.equal(PostController1, postController1Factory.class, 'precond - factoryFor().class matches')
assert.equal(PostController1, postController1Factory.class, 'precond - factoryFor().class matches');

appInstance.unregister('controller:post');
appInstance.register('controller:post', PostController2);

let postController2 = appInstance.lookup('controller:post');
let postController2Factory = appInstance.factoryFor('controller:post');
assert.ok(postController2 instanceof PostController2, 'lookup creates instance');
assert.equal(PostController2, postController2Factory.class, 'factoryFor().class matches')
assert.equal(PostController2, postController2Factory.class, 'factoryFor().class matches');

assert.notStrictEqual(postController1, postController2, 'lookup creates a brand new instance, because the previous one was reset');
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ moduleFor('Ember.Application, default resolver with autoboot', class extends Def
[`@test can specify custom router`](assert) {
let MyRouter = Router.extend();
this.runTask(() => {
this.createApplication()
this.createApplication();
this.application.Router = MyRouter;
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ moduleFor('Ember.Application Dependency Injection - Integration - default resolv
this.application.FooRoute = Component.extend();

expectAssertion(() => {
this.privateRegistry.resolve(`route:foo`)
this.privateRegistry.resolve(`route:foo`);
}, /to resolve to an Ember.Route/, 'Should assert');
}

Expand Down
2 changes: 1 addition & 1 deletion packages/ember-application/tests/system/visit_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ moduleFor('Ember.Application - visit()', class extends ApplicationTestCase {
* Destroy the instance.
*/
return this.runTask(() => {
this.applicationInstance.destroy()
this.applicationInstance.destroy();
this.applicationInstance = null;
});
}).then(() => {
Expand Down
8 changes: 4 additions & 4 deletions packages/ember-debug/lib/deprecate.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ let missingOptionsDeprecation, missingOptionsIdDeprecation, missingOptionsUntilD
if (DEBUG) {
registerHandler = function registerHandler(handler) {
genericRegisterHandler('deprecate', handler);
}
};

let formatMessage = function formatMessage(_message, options) {
let message = _message;
Expand All @@ -67,7 +67,7 @@ if (DEBUG) {
}

return message;
}
};

registerHandler(function logDeprecationToConsole(message, options) {
let updatedMessage = formatMessage(message, options);
Expand Down Expand Up @@ -196,7 +196,7 @@ if (DEBUG) {
}

invoke('deprecate', ...arguments);
}
};
}

export default deprecate;
Expand All @@ -206,4 +206,4 @@ export {
missingOptionsDeprecation,
missingOptionsIdDeprecation,
missingOptionsUntilDeprecation
}
};
6 changes: 3 additions & 3 deletions packages/ember-debug/lib/handlers.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ if (DEBUG) {
HANDLERS[type] = (message, options) => {
callback(message, options, nextHandler);
};
}
};

invoke = function invoke(type, message, test, options) {
if (test) { return; }
Expand All @@ -22,10 +22,10 @@ if (DEBUG) {
if (handlerForType) {
handlerForType(message, options);
}
}
};
}

export {
registerHandler,
invoke
}
};
4 changes: 2 additions & 2 deletions packages/ember-debug/lib/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DEBUG } from 'ember-env-flags'
import { DEBUG } from 'ember-env-flags';
import { ENV, environment } from 'ember-environment';
import Logger from 'ember-console';
import { isTesting } from './testing';
Expand Down Expand Up @@ -297,4 +297,4 @@ export {
setDebugFunction,
getDebugFunction,
_warnIfUsingStrippedFeatureFlags
}
};
6 changes: 3 additions & 3 deletions packages/ember-debug/lib/warn.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ if (DEBUG) {
*/
registerHandler = function registerHandler(handler) {
genericRegisterHandler('warn', handler);
}
};

registerHandler(function logWarning(message, options) {
Logger.warn(`WARNING: ${message}`);
Expand Down Expand Up @@ -109,12 +109,12 @@ if (DEBUG) {
}

invoke('warn', message, test, options);
}
};
}

export default warn;
export {
registerHandler,
missingOptionsIdDeprecation,
missingOptionsDeprecation
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ moduleFor('Container Debug Adapter', class extends ApplicationTestCase {
}

['@test default ContainerDebugAdapter catalogs controller entries'](assert) {
this.application.PostController = EmberController.extend()
this.application.PostController = EmberController.extend();
let controllerClasses = adapter.catalogEntriesByType('controller');

assert.equal(controllerClasses.length, 1, 'found 1 class');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -596,12 +596,12 @@ moduleFor('Application test: engine rendering', class extends ApplicationTest {
resolveLoading.resolve();

this.runTaskNext(() => {
this.assertText('ApplicationEnginePost')
this.assertText('ApplicationEnginePost');
done();
});
});

return transition
return transition;
});
}

Expand Down Expand Up @@ -674,7 +674,7 @@ moduleFor('Application test: engine rendering', class extends ApplicationTest {
resolveLoading.resolve();

this.runTaskNext(() => {
this.assertText('ApplicationEngineLikes')
this.assertText('ApplicationEngineLikes');
done();
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2916,7 +2916,7 @@ moduleFor('Components test: curly components', class extends RenderingTest {
this.registerComponent('foo-bar', {
ComponentClass: Component.extend({
didReceiveAttrs() {
assert.equal(1, this.get('foo'), 'expected attrs to have correct value')
assert.equal(1, this.get('foo'), 'expected attrs to have correct value');
}
}),

Expand Down
4 changes: 2 additions & 2 deletions packages/ember-metal/lib/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ class OrderedSet {
@private
*/
forEach(fn /*, ...thisArg*/) {
assert(`${Object.prototype.toString.call(fn)} is not a function`, typeof fn === 'function')
assert(`${Object.prototype.toString.call(fn)} is not a function`, typeof fn === 'function');

if (this.size === 0) { return; }

Expand Down Expand Up @@ -334,7 +334,7 @@ class Map {
@private
*/
forEach(callback/*, ...thisArg*/) {
assert(`${Object.prototype.toString.call(callback)} is not a function`, typeof callback === 'function')
assert(`${Object.prototype.toString.call(callback)} is not a function`, typeof callback === 'function');

if (this.size === 0) { return; }

Expand Down
2 changes: 1 addition & 1 deletion packages/ember-metal/lib/property_set.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ function setPath(root, path, value, tolerant) {
let parts = path.split('.');
let keyName = parts.pop();

assert('Property set failed: You passed an empty path', keyName.trim().length > 0)
assert('Property set failed: You passed an empty path', keyName.trim().length > 0);

let newPath = parts.join('.');

Expand Down
2 changes: 1 addition & 1 deletion packages/ember-metal/tests/alias_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
addObserver,
removeObserver,
tagFor
} from '..'
} from '..';

let obj, count;

Expand Down
2 changes: 1 addition & 1 deletion packages/ember-metal/tests/mixin/reopen_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
run,
get,
Mixin
} from '../..'
} from '../..';

QUnit.module('Ember.Mixin#reopen');

Expand Down
8 changes: 4 additions & 4 deletions packages/ember-metal/tests/observer_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@ QUnit.module('addObserver');

testBoth('observer should assert to invalid input', function(get, set) {
expectAssertion(()=> {
observer(()=>{})
observer(()=>{});
}, 'observer called without valid path');

expectDeprecation('Passing the dependentKeys after the callback function in observer is deprecated. Ensure the callback function is the last argument.')
expectDeprecation('Passing the dependentKeys after the callback function in observer is deprecated. Ensure the callback function is the last argument.');

expectAssertion(()=> {
observer(null)
observer(null);
}, 'observer called without a function');
})
});

testBoth('observer should fire when property is modified', function(get, set) {
let obj = {};
Expand Down
4 changes: 2 additions & 2 deletions packages/ember-routing/lib/system/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ const EmberRouter = EmberObject.extend(Evented, {
this._resetQueuedQueryParameterChanges();
this._handledErrors = dictionary(null);
this._engineInstances = Object.create(null);
this._engineInfoByRoute = Object.create(null)
this._engineInfoByRoute = Object.create(null);
},

/*
Expand Down Expand Up @@ -1275,7 +1275,7 @@ export function triggerEvent(handlerInfos, ignoreFailure, args) {
}
}

let defaultHandler = defaultActionHandlers[name]
let defaultHandler = defaultActionHandlers[name];
if (defaultHandler) {
defaultHandler.apply(this, [handlerInfos, ...args]);
return;
Expand Down
2 changes: 1 addition & 1 deletion packages/ember-routing/lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Error as EmberError } from 'ember-debug';
const ALL_PERIODS_REGEX = /\./g;

export function extractRouteArgs(args) {
args = args.slice()
args = args.slice();
let possibleQueryParams = args[args.length - 1];

let queryParams;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function reduceMacro(dependentKey, callback, initialValue) {
let arr = get(this, dependentKey);
if (arr === null || typeof arr !== 'object') { return initialValue; }
return arr.reduce(callback, initialValue, this);
}, { dependentKeys: [`${dependentKey}.[]`], readOnly: true })
}, { dependentKeys: [`${dependentKey}.[]`], readOnly: true });

return cp;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/ember-runtime/lib/system/native_array.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ let NativeArray = Mixin.create(MutableArray, Observable, Copyable, {
// primitive for array support.
replace(idx, amt, objects) {
assert(FROZEN_ERROR, !this.isFrozen);
assert('The third argument to replace needs to be an array.', objects === null || objects === undefined || Array.isArray(objects))
assert('The third argument to replace needs to be an array.', objects === null || objects === undefined || Array.isArray(objects));

// if we replaced exactly the same number of items, then pass only the
// replaced range. Otherwise, pass the full remaining array length
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ suite.test('[A,B,C].insertAt(1,X) => [A,X,B,C] + notify', function() {
obj.objectAt = (ix) => {
objectAtCalls.push(ix);
return objectAt.call(obj, ix);
}
};

obj.getProperties('firstObject', 'lastObject'); /* Prime the cache */

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ function test(given, expected, description) {
if (ENV.EXTEND_PROTOTYPES.String) {
deepEqual(given.camelize(), expected);
}
})
});
}

test('my favorite items', 'myFavoriteItems', 'camelize normal string');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export default function assertReservedNamedArguments(env) {
}
}
}
}
};
}

function assertMessage(moduleName, node) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export default function deprecateRenderModel(env) {
}
}
}
}
};
}

function deprecationMessage(moduleName, node, param) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,11 @@ export default function transformDotComponentInvocation(env) {
},
BlockStatement: (node) => {
if (isMultipartPath(node.path)) {
wrapInComponent(node, b)
wrapInComponent(node, b);
}
}
}
}
};
}

function isMultipartPath(path) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,5 @@ export default function transformHasBlockSyntax(env) {
}
}
}
}
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default function transformQuotedBindingsIntoJustBindings(env) {
styleAttr.value = styleAttr.value.parts[0];
}
}
}
};
}

function validStyleAttr(attr) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export default function transformTopLevelComponent(env) {
});
}
}
}
};
}

function hasSingleComponentNode(program, componentCallback) {
Expand Down
Loading

0 comments on commit 1fe2274

Please sign in to comment.