Skip to content
This repository has been archived by the owner on Feb 21, 2024. It is now read-only.

Commit

Permalink
yarn lint --fix
Browse files Browse the repository at this point in the history
  • Loading branch information
rwjblue committed Mar 23, 2020
1 parent 8fb4f71 commit 6152f5c
Show file tree
Hide file tree
Showing 191 changed files with 3,052 additions and 3,054 deletions.
2 changes: 1 addition & 1 deletion blueprints/addon/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ module.exports = {
let packagePath = path.join(this.path, 'files', 'package.json');
let bowerPath = path.join(this.path, 'files', 'bower.json');

[packagePath, bowerPath].forEach(filePath => {
[packagePath, bowerPath].forEach((filePath) => {
fs.removeSync(filePath);
});
},
Expand Down
2 changes: 1 addition & 1 deletion blueprints/blueprint/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module.exports = {
let files = this._super.files.apply(this, arguments);

if (!this.hasJSHint()) {
files = files.filter(file => file !== 'blueprints/.jshintrc');
files = files.filter((file) => file !== 'blueprints/.jshintrc');
}

return files;
Expand Down
4 changes: 2 additions & 2 deletions blueprints/in-repo-addon/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ module.exports = {

fileMapTokens() {
return {
__root__: options => this._processTokens(options.dasherizedModuleName).root,
__name__: options => this._processTokens(options.dasherizedModuleName).name,
__root__: (options) => this._processTokens(options.dasherizedModuleName).root,
__name__: (options) => this._processTokens(options.dasherizedModuleName).name,
};
},

Expand Down
2 changes: 1 addition & 1 deletion docs/project_version_preprocessor.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
let versionUtils = require('../lib/utilities/version-utils');
let emberCLIVersion = versionUtils.emberCLIVersion;

module.exports = function(data, options) {
module.exports = function (data, options) {
options.project.version = emberCLIVersion();
};
4 changes: 2 additions & 2 deletions lib/broccoli/default-packager.js
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ module.exports = class DefaultPackager {
*/
importAdditionalAssets(tree) {
if (this._cachedProcessedAdditionalAssets === null) {
let otherAssetTrees = funnelReducer(this.additionalAssetPaths).map(options => {
let otherAssetTrees = funnelReducer(this.additionalAssetPaths).map((options) => {
let files = options.include.join(',');
options.annotation = `${options.srcDir}/{${files}} => ${options.destDir}/{${files}}`;

Expand Down Expand Up @@ -1303,7 +1303,7 @@ module.exports = class DefaultPackager {
// iterate over the keys and concat files
// to support scenarios like
// app.import('vendor/foobar.js', { outputFile: 'assets/baz.js' });
let vendorTrees = importPaths.map(importPath => {
let vendorTrees = importPaths.map((importPath) => {
let files = this.scriptOutputFiles[importPath];
let isMainVendorFile = importPath === this.distPaths.vendorJsFile;

Expand Down
40 changes: 20 additions & 20 deletions lib/broccoli/ember-app.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ class EmberApp {

this.populateLegacyFiles();
this.initializeAddons();
this.project.addons.forEach(addon => (addon.app = this));
this.project.addons.forEach((addon) => (addon.app = this));
p.setupRegistry(this);
this._importAddonTransforms();
this._notifyAddonIncluded();
Expand Down Expand Up @@ -205,7 +205,7 @@ class EmberApp {
this.project = options.project || Project.closestSync(process.cwd());

if (options.configPath) {
this.project.configPath = function() {
this.project.configPath = function () {
return app._resolveLocal(options.configPath);
};
}
Expand Down Expand Up @@ -565,7 +565,7 @@ class EmberApp {
result = result || false;
roots = roots || {};

let babelInstance = addons.find(addon => addon.name === 'ember-cli-babel');
let babelInstance = addons.find((addon) => addon.name === 'ember-cli-babel');
if (babelInstance) {
let version = babelInstance.pkg.version;
if (semver.lt(version, '6.6.0')) {
Expand All @@ -579,7 +579,7 @@ class EmberApp {
}
}

return addons.some(addon => this._checkEmberCliBabel(addon.addons, result, roots)) || result;
return addons.some((addon) => this._checkEmberCliBabel(addon.addons, result, roots)) || result;
}

/**
Expand All @@ -605,18 +605,18 @@ class EmberApp {
@method _notifyAddonIncluded
*/
_notifyAddonIncluded() {
let addonNames = this.project.addons.map(addon => addon.name);
let addonNames = this.project.addons.map((addon) => addon.name);

if (this.options.addons.blacklist) {
this.options.addons.blacklist.forEach(addonName => {
this.options.addons.blacklist.forEach((addonName) => {
if (addonNames.indexOf(addonName) === -1) {
throw new Error(`Addon "${addonName}" defined in blacklist is not found`);
}
});
}

if (this.options.addons.whitelist) {
this.options.addons.whitelist.forEach(addonName => {
this.options.addons.whitelist.forEach((addonName) => {
if (addonNames.indexOf(addonName) === -1) {
throw new Error(`Addon "${addonName}" defined in whitelist is not found`);
}
Expand All @@ -625,9 +625,9 @@ class EmberApp {

// the addons must be filtered before the `included` hook is called
// in case an addon caches the project.addons list
this.project.addons = this.project.addons.filter(addon => this.shouldIncludeAddon(addon));
this.project.addons = this.project.addons.filter((addon) => this.shouldIncludeAddon(addon));

this.project.addons.forEach(addon => {
this.project.addons.forEach((addon) => {
if (addon.included) {
addon.included(this);
}
Expand All @@ -641,7 +641,7 @@ class EmberApp {
@method _importAddonTransforms
*/
_importAddonTransforms() {
this.project.addons.forEach(addon => {
this.project.addons.forEach((addon) => {
if (this.shouldIncludeAddon(addon)) {
if (addon.importTransforms) {
let transforms = addon.importTransforms();
Expand All @@ -650,7 +650,7 @@ class EmberApp {
throw new Error(`Addon "${addon.name}" did not return a transform map from importTransforms function`);
}

Object.keys(transforms).forEach(transformName => {
Object.keys(transforms).forEach((transformName) => {
let transformConfig = {
files: [],
options: {},
Expand Down Expand Up @@ -719,17 +719,17 @@ class EmberApp {
@return {Array} List of trees
*/
addonTreesFor(type) {
return this._addonTreesFor(type).map(addonBundle => addonBundle.tree);
return this._addonTreesFor(type).map((addonBundle) => addonBundle.tree);
}

_getDefaultPluginForType(type) {
let plugins = this.registry.load(type);
let defaultsForType = plugins.filter(plugin => plugin.isDefaultForType);
let defaultsForType = plugins.filter((plugin) => plugin.isDefaultForType);

if (defaultsForType.length > 1) {
throw new Error(
`There are multiple preprocessor plugins marked as default for '${type}': ${defaultsForType
.map(p => p.name)
.map((p) => p.name)
.join(', ')}`
);
}
Expand Down Expand Up @@ -1087,14 +1087,14 @@ class EmberApp {
@return {Array} An array of regular expressions.
*/
_podTemplatePatterns() {
return this.registry.extensionsForType('template').map(extension => `**/*/template.${extension}`);
return this.registry.extensionsForType('template').map((extension) => `**/*/template.${extension}`);
}

_nodeModuleTrees() {
if (!this._cachedNodeModuleTrees) {
this._cachedNodeModuleTrees = Array.from(
this._nodeModules.values(),
module =>
(module) =>
new Funnel(module.path, {
srcDir: '/',
destDir: `node_modules/${module.name}/`,
Expand Down Expand Up @@ -1419,7 +1419,7 @@ class EmberApp {
if (!Array.isArray(options.using)) {
throw new Error('You must pass an array of transformations for `using` option');
}
options.using.forEach(entry => {
options.using.forEach((entry) => {
if (!entry.transformation) {
throw new Error(
`while importing ${assetPath}: each entry in the \`using\` list must have a \`transformation\` name`
Expand Down Expand Up @@ -1557,7 +1557,7 @@ class EmberApp {

let addonBundles = this._cachedAddonBundles[type];

let addonTrees = addonBundles.map(addonBundle => {
let addonTrees = addonBundles.map((addonBundle) => {
let { name, tree, root } = addonBundle;

let precompiledSource = tree;
Expand All @@ -1581,8 +1581,8 @@ class EmberApp {
return [tree, precompiledSource];
});

let precompiledSource = addonTrees.map(pair => pair[1]);
addonTrees = addonTrees.map(pair => pair[0]);
let precompiledSource = addonTrees.map((pair) => pair[1]);
addonTrees = addonTrees.map((pair) => pair[0]);

precompiledSource = mergeTrees(precompiledSource, {
overwrite: true,
Expand Down
2 changes: 1 addition & 1 deletion lib/broccoli/merge-trees.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function getEmptyTree() {
});

let originalCleanup = EMPTY_MERGE_TREE.cleanup;
EMPTY_MERGE_TREE.cleanup = function() {
EMPTY_MERGE_TREE.cleanup = function () {
// this tree is being cleaned up, we must
// ensure that our shared EMPTY_MERGE_TREE is
// reset (otherwise it will not have a valid
Expand Down
6 changes: 3 additions & 3 deletions lib/cli/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ class CLI {

commandLookupCreationToken.stop();

getOptionArgs('--verbose', commandArgs).forEach(arg => {
getOptionArgs('--verbose', commandArgs).forEach((arg) => {
process.env[`EMBER_VERBOSE_${arg.toUpperCase()}`] = 'true';
});

Expand Down Expand Up @@ -209,7 +209,7 @@ class CLI {
}
} finally {
instrumentation.start('shutdown');
shutdownOnExit = function() {
shutdownOnExit = function () {
instrumentation.stopAndReport('shutdown');
};
}
Expand All @@ -234,7 +234,7 @@ class CLI {
// This ensures that stdout is flushed so acceptance tests get full output

if (process.platform === 'win32') {
return new Promise(resolve => {
return new Promise((resolve) => {
setTimeout(resolve, 250, exitCode);
});
} else {
Expand Down
6 changes: 2 additions & 4 deletions lib/cli/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,7 @@ function clientId() {
if (id) {
return id;
} else {
id = require('uuid')
.v4()
.toString();
id = require('uuid').v4().toString();
configStore.set('client-id', id);
return id;
}
Expand All @@ -68,7 +66,7 @@ function configureLogger(env) {
}

// Options: Array cliArgs, Stream inputStream, Stream outputStream, EventEmitter process
module.exports = async function(options) {
module.exports = async function (options) {
// `process` should be captured before we require any libraries which
// may use `process.exit` work arounds for async cleanup.
willInterruptProcess.capture(options.process || process);
Expand Down
2 changes: 1 addition & 1 deletion lib/cli/lookup-command.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

const UnknownCommand = require('../commands/unknown');

module.exports = function(commands, commandName, commandArgs, optionHash) {
module.exports = function (commands, commandName, commandArgs, optionHash) {
let options = optionHash || {};
let project = options.project;
let ui = options.ui;
Expand Down
4 changes: 2 additions & 2 deletions lib/commands/generate.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ module.exports = Command.extend({

let collectionsJson = [];

blueprintList.forEach(function(collection) {
blueprintList.forEach(function (collection) {
let result = this.getPackageBlueprints(collection, options, singleBlueprintName);
if (options.json) {
let collectionJson = {};
Expand Down Expand Up @@ -141,7 +141,7 @@ module.exports = Command.extend({

let blueprintsJson = [];

blueprints.forEach(function(blueprint) {
blueprints.forEach(function (blueprint) {
let singleMatch = singleBlueprintName === blueprint.name;
if (singleMatch) {
verbose = true;
Expand Down
6 changes: 3 additions & 3 deletions lib/commands/help.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ module.exports = Command.extend({
this.ui.writeLine('Available commands in ember-cli:');
this.ui.writeLine('');

Object.keys(this.commands).forEach(function(commandName) {
Object.keys(this.commands).forEach(function (commandName) {
this._printHelpForCommand(commandName, false, commandOptions);
}, this);

Expand All @@ -53,7 +53,7 @@ module.exports = Command.extend({
this.ui.writeLine('');
this.ui.writeLine(`Available commands from ${addonName}:`);

Object.keys(this.commands).forEach(function(commandName) {
Object.keys(this.commands).forEach(function (commandName) {
this._printHelpForCommand(commandName, false, commandOptions);
}, this);
});
Expand Down Expand Up @@ -82,7 +82,7 @@ module.exports = Command.extend({

// Iterate through each arg beyond the initial 'help' command,
// and try to display usage instructions.
rawArgs.forEach(function(commandName) {
rawArgs.forEach(function (commandName) {
this._printHelpForCommand(commandName, true, commandOptions);
}, this);
}
Expand Down
4 changes: 2 additions & 2 deletions lib/commands/new.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,10 @@ module.exports = Command.extend({
projectName,
directoryName: commandOptions.directory,
dryRun: commandOptions.dryRun,
}).then(opts => {
}).then((opts) => {
initCommand.project.root = process.cwd();

return initCommand.run(commandOptions, rawArgs).catch(err => {
return initCommand.run(commandOptions, rawArgs).catch((err) => {
let { initialDirectory, projectDirectory } = opts;

process.chdir(initialDirectory);
Expand Down
4 changes: 2 additions & 2 deletions lib/commands/serve.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ module.exports = Command.extend({
run(commandOptions) {
commandOptions.liveReloadHost = commandOptions.liveReloadHost || commandOptions.host;

return this._checkExpressPort(commandOptions).then(commandOptions => {
return this._checkExpressPort(commandOptions).then((commandOptions) => {
if (commandOptions.proxy) {
if (!/^(http:|https:)/.test(commandOptions.proxy)) {
let message = `You need to include a protocol with the proxy URL.${EOL}Try --proxy http://${commandOptions.proxy}`;
Expand All @@ -107,7 +107,7 @@ module.exports = Command.extend({
},

_checkExpressPort(commandOptions) {
return getPort({ port: commandOptions.port, host: commandOptions.host }).then(foundPort => {
return getPort({ port: commandOptions.port, host: commandOptions.host }).then((foundPort) => {
if (commandOptions.port !== foundPort && commandOptions.port !== 0) {
let message = `Port ${commandOptions.port} is already in use.`;
return Promise.reject(new SilentError(message));
Expand Down
Loading

0 comments on commit 6152f5c

Please sign in to comment.