Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code cleanup based on ESLint warnings #14603

Merged
merged 1 commit into from
Nov 12, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion STYLEGUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ while (true) {

try {
// code that throws an error
} catch(e) {
} catch (e) {
// code that handles an error
}
```
Expand Down
2 changes: 1 addition & 1 deletion bin/changelog
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function getCommitMessage(commitInfo) {
try {
// command from http://stackoverflow.com/questions/8475448/find-merge-commit-which-include-a-specific-commit
message = execSync('commit=$((git rev-list ' + originalCommit + '..origin/master --ancestry-path | cat -n; git rev-list ' + originalCommit + '..origin/master --first-parent | cat -n) | sort -k2 | uniq -f1 -d | sort -n | tail -1 | cut -f2) && git show --format="%s\n\n%b" $commit', { encoding: 'utf8' });
} catch(e) { }
} catch (e) { }
}

return message;
Expand Down
33 changes: 16 additions & 17 deletions bin/feature-flag-yuidoc-filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,19 @@ function isClassToBeIncluded(item, featuresToFilter) {
}
}
return true;
};
}

function gatherFeatures() {
var featuresJson = JSON.parse(fs.readFileSync('features.json'));
var featuresObj = featuresJson.features;
var featuresToFilter = [];
for (var feature in featuresObj) {
if (featuresObj[feature] === null || featuresObj[feature] === false) {
featuresToFilter.push(feature);
}
var featuresJson = JSON.parse(fs.readFileSync('features.json'));
var featuresObj = featuresJson.features;
var featuresToFilter = [];
for (var feature in featuresObj) {
if (featuresObj[feature] === null || featuresObj[feature] === false) {
featuresToFilter.push(feature);
}
return featuresToFilter;
};
}
return featuresToFilter;
}

function gatherClassesToDocument(data, featuresToFilter) {
var classesToDocument = {};
Expand All @@ -34,24 +34,23 @@ function gatherClassesToDocument(data, featuresToFilter) {
}
}
return classesToDocument;
};
}

function updateClassReferencesInNamespaces(data) {
for (var namespace in data.modules) {
var namespaceClasses = {};
var originalClasses = data.modules[namespace].classes;
for(var className in originalClasses) {
for (var className in originalClasses) {
if (data.classes.hasOwnProperty(className)) {
namespaceClasses[className] = originalClasses[className]
}
}
data.modules[namespace].classes = namespaceClasses;
}

};
}

module.exports = function (data, options) {
var featuresToFilter = gatherFeatures();
data.classes = gatherClassesToDocument(data, featuresToFilter);
updateClassReferencesInNamespaces(data);
var featuresToFilter = gatherFeatures();
data.classes = gatherClassesToDocument(data, featuresToFilter);
updateClassReferencesInNamespaces(data);
};
2 changes: 1 addition & 1 deletion bin/run-sauce-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ RSVP.resolve()
console.log('error');
console.log(error);
process.exit(1);
}).then(function(){
}).then(function() {
console.log('success');
process.exit(0);
});
1 change: 0 additions & 1 deletion bin/run-travis-browser-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

var RSVP = require('rsvp');
var spawn = require('child_process').spawn;
var execSync = require('child_process').execSync;

function run(command, _args) {
var args = _args || [];
Expand Down
2 changes: 1 addition & 1 deletion blueprints/-addon-import.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ module.exports = {
var modulePathSegments = [addonName, inflector.pluralize(options.originBlueprintName), fileName];

if (blueprintName.match(/-addon/)) {
blueprintName = blueprintName.substr(0,blueprintName.indexOf('-addon'));
blueprintName = blueprintName.substr(0, blueprintName.indexOf('-addon'));
modulePathSegments = [addonName, inflector.pluralize(blueprintName), fileName];
}

Expand Down
2 changes: 1 addition & 1 deletion blueprints/component-addon/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ module.exports = {
var importPathName = [addonName, 'components', fileName].join('/');

if (options.pod) {
importPathName = [addonName, 'components', fileName,'component'].join('/');
importPathName = [addonName, 'components', fileName, 'component'].join('/');
}

return {
Expand Down
6 changes: 3 additions & 3 deletions blueprints/component-test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ module.exports = useTestFrameworkDetector({
name: 'test-type',
type: ['integration', 'unit'],
default: 'integration',
aliases:[
{ 'i': 'integration'},
{ 'u': 'unit'},
aliases: [
{ 'i': 'integration' },
{ 'u': 'unit' },
{ 'integration': 'integration' },
{ 'unit': 'unit' }
]
Expand Down
6 changes: 3 additions & 3 deletions blueprints/component/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ module.exports = {
name: 'path',
type: String,
default: 'components',
aliases:[
{'no-path': ''}
aliases: [
{ 'no-path': '' }
]
}
],
Expand Down Expand Up @@ -57,7 +57,7 @@ module.exports = {
var contents = '';
// if we're in an addon, build import statement
if (options.project.isEmberCLIAddon() || options.inRepoAddon && !options.inDummy) {
if(options.pod) {
if (options.pod) {
templatePath = './template';
} else {
templatePath = pathUtil.getRelativeParentPath(options.entity.name) +
Expand Down
10 changes: 5 additions & 5 deletions blueprints/helper-test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ module.exports = useTestFrameworkDetector({
name: 'test-type',
type: ['integration', 'unit'],
default: 'unit',
aliases:[
{ 'i': 'integration'},
{ 'u': 'unit'},
aliases: [
{ 'i': 'integration' },
{ 'u': 'unit' },
{ 'integration': 'integration' },
{ 'unit': 'unit' }
]
Expand All @@ -38,7 +38,7 @@ module.exports = useTestFrameworkDetector({
return {
friendlyTestName: friendlyTestName,
dasherizedModulePrefix: stringUtils.dasherize(options.project.config().modulePrefix),
testType:testType
testType: testType
};
},

Expand All @@ -49,4 +49,4 @@ module.exports = useTestFrameworkDetector({
]);
}
}
});
});
2 changes: 1 addition & 1 deletion blueprints/route/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ module.exports = {
}

if (options.inDummy) {
return path.join('tests','dummy','app');
return path.join('tests', 'dummy', 'app');
}

if (options.inAddon) {
Expand Down
4 changes: 2 additions & 2 deletions config/s3ProjectConfig.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function fileMap(revision,tag,date) {
function fileMap(revision, tag, date) {
return {
"ember.js": fileObject("ember", ".js", "text/javascript", revision, tag, date),
"ember.debug.js": fileObject("ember.debug", ".js", "text/javascript", revision, tag, date),
Expand All @@ -15,7 +15,7 @@ function fileMap(revision,tag,date) {
"composer.json": fileObject("composer", ".json", "application/json", revision, tag, date),
"package.json": fileObject("package", ".json", "application/json", revision, tag, date),
};
};
}

function fileObject(baseName, extension, contentType, currentRevision, tag, date) {
var fullName = "/" + baseName + extension;
Expand Down
3 changes: 1 addition & 2 deletions ember-cli-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ var filterImports = require('babel-plugin-filter-imports');

var vendoredPackage = require('emberjs-build/lib/vendored-package');
var htmlbarsPackage = require('emberjs-build/lib/htmlbars-package');
var vendoredES6Package = require('emberjs-build/lib/es6-vendored-package');
var replaceVersion = require('emberjs-build/lib/utils/replace-version');

var Funnel = require('broccoli-funnel');
Expand Down Expand Up @@ -254,7 +253,7 @@ module.exports = function() {
'router': router(),
'dag-map': dag(),
'route-recognizer': routeRecognizer(),
'simple-html-tokenizer': htmlbarsPackage('simple-html-tokenizer', { libPath: 'node_modules/glimmer-engine/dist/es6'}),
'simple-html-tokenizer': htmlbarsPackage('simple-html-tokenizer', { libPath: 'node_modules/glimmer-engine/dist/es6' }),

'glimmer': glimmerPackage('glimmer'),
'glimmer-compiler': glimmerPackage('glimmer-compiler'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ module.exports.prototype = {
},

check: function(file, errors) {
var tokens = file.getTokens();

file.iterateNodesByType('CallExpression', function(node) {
var nodeBeforeRoundBrace = node;

Expand Down
2 changes: 0 additions & 2 deletions lib/packages.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
var fs = require('fs');

module.exports = function(features) {
var packages = {
'container': { trees: null, requirements: ['ember-utils'] },
Expand Down
4 changes: 2 additions & 2 deletions node-tests/blueprints/acceptance-test-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ describe('Acceptance: ember generate and destroy acceptance-test', function() {

return emberNew()
.then(() => modifyPackages([
{name: 'ember-cli-qunit', delete: true},
{name: 'ember-cli-mocha', dev: true}
{ name: 'ember-cli-qunit', delete: true },
{ name: 'ember-cli-mocha', dev: true }
]))
.then(() => emberGenerateDestroy(args, _file => {
expect(_file('tests/acceptance/foo-test.js'))
Expand Down
8 changes: 4 additions & 4 deletions node-tests/blueprints/component-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -791,8 +791,8 @@ describe('Acceptance: ember generate component', function() {

return emberNew()
.then(() => modifyPackages([
{name: 'ember-cli-qunit', delete: true},
{name: 'ember-cli-mocha', dev: true}
{ name: 'ember-cli-qunit', delete: true },
{ name: 'ember-cli-mocha', dev: true }
]))
.then(() => emberGenerateDestroy(args, _file => {
expect(_file('tests/integration/components/x-foo-test.js'))
Expand All @@ -810,8 +810,8 @@ describe('Acceptance: ember generate component', function() {

return emberNew()
.then(() => modifyPackages([
{name: 'ember-cli-qunit', delete: true},
{name: 'ember-cli-mocha', dev: true}
{ name: 'ember-cli-qunit', delete: true },
{ name: 'ember-cli-mocha', dev: true }
]))
.then(() => emberGenerateDestroy(args, _file => {
expect(_file('tests/unit/components/x-foo-test.js'))
Expand Down
4 changes: 2 additions & 2 deletions node-tests/blueprints/controller-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -238,8 +238,8 @@ describe('Acceptance: ember generate and destroy controller', function() {

return emberNew()
.then(() => modifyPackages([
{name: 'ember-cli-qunit', delete: true},
{name: 'ember-cli-mocha', dev: true}
{ name: 'ember-cli-qunit', delete: true },
{ name: 'ember-cli-mocha', dev: true }
]))
.then(() => emberGenerateDestroy(args, _file => {
expect(_file('tests/unit/controllers/foo-test.js'))
Expand Down
8 changes: 4 additions & 4 deletions node-tests/blueprints/helper-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -249,8 +249,8 @@ describe('Acceptance: ember generate and destroy helper', function() {

return emberNew()
.then(() => modifyPackages([
{name: 'ember-cli-qunit', delete: true},
{name: 'ember-cli-mocha', dev: true}
{ name: 'ember-cli-qunit', delete: true },
{ name: 'ember-cli-mocha', dev: true }
]))
.then(() => emberGenerateDestroy(args, _file => {
expect(_file('tests/integration/helpers/foo/bar-baz-test.js'))
Expand All @@ -264,8 +264,8 @@ describe('Acceptance: ember generate and destroy helper', function() {

return emberNew()
.then(() => modifyPackages([
{name: 'ember-cli-qunit', delete: true},
{name: 'ember-cli-mocha', dev: true}
{ name: 'ember-cli-qunit', delete: true },
{ name: 'ember-cli-mocha', dev: true }
]))
.then(() => emberGenerateDestroy(args, _file => {
expect(_file('tests/unit/helpers/foo/bar-baz-test.js'))
Expand Down
4 changes: 2 additions & 2 deletions node-tests/blueprints/initializer-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -296,8 +296,8 @@ describe('Acceptance: ember generate and destroy initializer', function() {

return emberNew()
.then(() => modifyPackages([
{name: 'ember-cli-qunit', delete: true},
{name: 'ember-cli-mocha', dev: true}
{ name: 'ember-cli-qunit', delete: true },
{ name: 'ember-cli-mocha', dev: true }
]))
.then(() => emberGenerateDestroy(args, _file => {
expect(_file('tests/unit/initializers/foo-test.js'))
Expand Down
4 changes: 2 additions & 2 deletions node-tests/blueprints/instance-initializer-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -296,8 +296,8 @@ describe('Acceptance: ember generate and destroy instance-initializer', function

return emberNew()
.then(() => modifyPackages([
{name: 'ember-cli-qunit', delete: true},
{name: 'ember-cli-mocha', dev: true}
{ name: 'ember-cli-qunit', delete: true },
{ name: 'ember-cli-mocha', dev: true }
]))
.then(() => emberGenerateDestroy(args, _file => {
expect(_file('tests/unit/instance-initializers/foo-test.js'))
Expand Down
4 changes: 2 additions & 2 deletions node-tests/blueprints/mixin-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,8 @@ describe('Acceptance: ember generate and destroy mixin', function() {

return emberNew()
.then(() => modifyPackages([
{name: 'ember-cli-qunit', delete: true},
{name: 'ember-cli-mocha', dev: true}
{ name: 'ember-cli-qunit', delete: true },
{ name: 'ember-cli-mocha', dev: true }
]))
.then(() => emberGenerateDestroy(args, _file => {
expect(_file('tests/unit/mixins/foo-test.js'))
Expand Down
4 changes: 2 additions & 2 deletions node-tests/blueprints/service-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,8 @@ describe('Acceptance: ember generate and destroy service', function() {

return emberNew()
.then(() => modifyPackages([
{name: 'ember-cli-qunit', delete: true},
{name: 'ember-cli-mocha', dev: true}
{ name: 'ember-cli-qunit', delete: true },
{ name: 'ember-cli-mocha', dev: true }
]))
.then(() => emberGenerateDestroy(args, _file => {
expect(_file('tests/unit/services/foo-test.js'))
Expand Down
1 change: 0 additions & 1 deletion node-tests/blueprints/template-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,5 +133,4 @@ describe('Acceptance: ember generate and destroy template', function() {
expect(_file('lib/my-addon/addon/templates/foo/bar.hbs')).to.equal('');
}));
});

});
4 changes: 2 additions & 2 deletions node-tests/blueprints/util-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,8 @@ describe('Acceptance: ember generate and destroy util', function() {

return emberNew()
.then(() => modifyPackages([
{name: 'ember-cli-qunit', delete: true},
{name: 'ember-cli-mocha', dev: true}
{ name: 'ember-cli-qunit', delete: true },
{ name: 'ember-cli-mocha', dev: true }
]))
.then(() => emberGenerateDestroy(args, _file => {
expect(_file('tests/unit/utils/foo-bar-test.js'))
Expand Down
Loading