Skip to content

Commit

Permalink
Chore: Use object-shorthand batch 2 (refs #6407) (#6897)
Browse files Browse the repository at this point in the history
  • Loading branch information
kaicataldo authored and ilyavolodin committed Aug 12, 2016
1 parent 2841008 commit cd09c96
Show file tree
Hide file tree
Showing 36 changed files with 236 additions and 236 deletions.
36 changes: 18 additions & 18 deletions lib/ast-utils.js
Expand Up @@ -210,23 +210,23 @@ module.exports = {
* @returns {boolean} Whether or not the tokens are on the same line.
* @public
*/
isTokenOnSameLine: function(left, right) {
isTokenOnSameLine(left, right) {
return left.loc.end.line === right.loc.start.line;
},

isNullOrUndefined: isNullOrUndefined,
isCallee: isCallee,
isES5Constructor: isES5Constructor,
getUpperFunction: getUpperFunction,
isArrayFromMethod: isArrayFromMethod,
isParenthesised: isParenthesised,
isNullOrUndefined,
isCallee,
isES5Constructor,
getUpperFunction,
isArrayFromMethod,
isParenthesised,

/**
* Checks whether or not a given node is a string literal.
* @param {ASTNode} node - A node to check.
* @returns {boolean} `true` if the node is a string literal.
*/
isStringLiteral: function(node) {
isStringLiteral(node) {
return (
(node.type === "Literal" && typeof node.value === "string") ||
node.type === "TemplateLiteral"
Expand All @@ -247,7 +247,7 @@ module.exports = {
* @param {ASTNode} node - A node to check.
* @returns {boolean} `true` if the node is breakable.
*/
isBreakableStatement: function(node) {
isBreakableStatement(node) {
return breakableTypePattern.test(node.type);
},

Expand All @@ -257,7 +257,7 @@ module.exports = {
* @param {ASTNode} node - A node to get.
* @returns {string|null} The label or `null`.
*/
getLabel: function(node) {
getLabel(node) {
if (node.parent.type === "LabeledStatement") {
return node.parent.label.name;
}
Expand All @@ -270,7 +270,7 @@ module.exports = {
* @returns {Reference[]} An array of only references which are non initializer and writable.
* @public
*/
getModifyingReferences: function(references) {
getModifyingReferences(references) {
return references.filter(isModifyingReference);
},

Expand All @@ -281,7 +281,7 @@ module.exports = {
* @returns {boolean} True if the text is surrounded by the character, false if not.
* @private
*/
isSurroundedBy: function(val, character) {
isSurroundedBy(val, character) {
return val[0] === character && val[val.length - 1] === character;
},

Expand All @@ -290,7 +290,7 @@ module.exports = {
* @param {LineComment|BlockComment} node The node to be checked
* @returns {boolean} `true` if the node is an ESLint directive comment
*/
isDirectiveComment: function(node) {
isDirectiveComment(node) {
const comment = node.value.trim();

return (
Expand Down Expand Up @@ -323,7 +323,7 @@ module.exports = {
* @param {string} name - A variable name to find.
* @returns {escope.Variable|null} A found variable or `null`.
*/
getVariableByName: function(initScope, name) {
getVariableByName(initScope, name) {
let scope = initScope;

while (scope) {
Expand Down Expand Up @@ -360,7 +360,7 @@ module.exports = {
* @param {SourceCode} sourceCode - A SourceCode instance to get comments.
* @returns {boolean} The function node is the default `this` binding.
*/
isDefaultThisBinding: function(node, sourceCode) {
isDefaultThisBinding(node, sourceCode) {
if (isES5Constructor(node) || hasJSDocThisTag(node, sourceCode)) {
return false;
}
Expand Down Expand Up @@ -496,7 +496,7 @@ module.exports = {
* @returns {int} precedence level
* @private
*/
getPrecedence: function(node) {
getPrecedence(node) {
switch (node.type) {
case "SequenceExpression":
return 0;
Expand Down Expand Up @@ -594,7 +594,7 @@ module.exports = {
* @param {ASTNode|null} node - A node to check.
* @returns {boolean} `true` if the node is a loop node.
*/
isLoop: function(node) {
isLoop(node) {
return Boolean(node && anyLoopPattern.test(node.type));
},

Expand All @@ -609,7 +609,7 @@ module.exports = {
* @param {ASTNode|null} node - A node to check.
* @returns {boolean} `true` if the node is a function node.
*/
isFunction: function(node) {
isFunction(node) {
return Boolean(node && anyFunctionPattern.test(node.type));
},

Expand Down
32 changes: 16 additions & 16 deletions lib/cli-engine.js
Expand Up @@ -241,8 +241,8 @@ function processText(text, configHelper, filename, fix, allowInlineConfig) {

parsedBlocks.forEach(function(block) {
unprocessedMessages.push(eslint.verify(block, config, {
filename: filename,
allowInlineConfig: allowInlineConfig
filename,
allowInlineConfig
}));
});

Expand All @@ -254,14 +254,14 @@ function processText(text, configHelper, filename, fix, allowInlineConfig) {

if (fix) {
fixedResult = multipassFix(text, config, {
filename: filename,
allowInlineConfig: allowInlineConfig
filename,
allowInlineConfig
});
messages = fixedResult.messages;
} else {
messages = eslint.verify(text, config, {
filename: filename,
allowInlineConfig: allowInlineConfig
filename,
allowInlineConfig
});
}
}
Expand All @@ -270,7 +270,7 @@ function processText(text, configHelper, filename, fix, allowInlineConfig) {

const result = {
filePath: filename,
messages: messages,
messages,
errorCount: stats.errorCount,
warningCount: stats.warningCount
};
Expand Down Expand Up @@ -329,7 +329,7 @@ function createIgnoreResult(filePath, baseDir) {
{
fatal: false,
severity: 1,
message: message
message
}
],
errorCount: 0,
Expand Down Expand Up @@ -559,7 +559,7 @@ CLIEngine.prototype = {
* @param {Object} pluginobject Plugin configuration object.
* @returns {void}
*/
addPlugin: function(name, pluginobject) {
addPlugin(name, pluginobject) {
Plugins.define(name, pluginobject);
},

Expand All @@ -569,7 +569,7 @@ CLIEngine.prototype = {
* @param {string[]} patterns The file patterns passed on the command line.
* @returns {string[]} The equivalent glob patterns.
*/
resolveFileGlobPatterns: function(patterns) {
resolveFileGlobPatterns(patterns) {
return globUtil.resolveFileGlobPatterns(patterns, this.options);
},

Expand All @@ -578,7 +578,7 @@ CLIEngine.prototype = {
* @param {string[]} patterns An array of file and directory names.
* @returns {Object} The results for all files that were linted.
*/
executeOnFiles: function(patterns) {
executeOnFiles(patterns) {
const results = [],
options = this.options,
fileCache = this._fileCache,
Expand Down Expand Up @@ -716,7 +716,7 @@ CLIEngine.prototype = {
debug("Linting complete in: " + (Date.now() - startTime) + "ms");

return {
results: results,
results,
errorCount: stats.errorCount,
warningCount: stats.warningCount
};
Expand All @@ -729,7 +729,7 @@ CLIEngine.prototype = {
* @param {boolean} warnIgnored Always warn when a file is ignored
* @returns {Object} The results for the linting.
*/
executeOnText: function(text, filename, warnIgnored) {
executeOnText(text, filename, warnIgnored) {

const results = [],
options = this.options,
Expand All @@ -752,7 +752,7 @@ CLIEngine.prototype = {
const stats = calculateStatsPerRun(results);

return {
results: results,
results,
errorCount: stats.errorCount,
warningCount: stats.warningCount
};
Expand All @@ -765,7 +765,7 @@ CLIEngine.prototype = {
* @param {string} filePath The path of the file to retrieve a config object for.
* @returns {Object} A configuration object for the file.
*/
getConfigForFile: function(filePath) {
getConfigForFile(filePath) {
const configHelper = new Config(this.options);

return configHelper.getConfig(filePath);
Expand All @@ -776,7 +776,7 @@ CLIEngine.prototype = {
* @param {string} filePath The path of the file to check.
* @returns {boolean} Whether or not the given path is ignored.
*/
isPathIgnored: function(filePath) {
isPathIgnored(filePath) {
const resolvedPath = path.resolve(this.options.cwd, filePath);
const ignoredPaths = new IgnoredPaths(this.options);

Expand Down
2 changes: 1 addition & 1 deletion lib/cli.js
Expand Up @@ -120,7 +120,7 @@ const cli = {
* @param {string} [text] The text to lint (used for TTY).
* @returns {int} The exit code for the operation.
*/
execute: function(args, text) {
execute(args, text) {

let currentOptions;

Expand Down
6 changes: 3 additions & 3 deletions lib/code-path-analysis/code-path-analyzer.js
Expand Up @@ -592,7 +592,7 @@ CodePathAnalyzer.prototype = {
* @param {ASTNode} node - A node which is entering.
* @returns {void}
*/
enterNode: function(node) {
enterNode(node) {
this.currentNode = node;

// Updates the code path due to node's position in its parent node.
Expand All @@ -617,7 +617,7 @@ CodePathAnalyzer.prototype = {
* @param {ASTNode} node - A node which is leaving.
* @returns {void}
*/
leaveNode: function(node) {
leaveNode(node) {
this.currentNode = node;

// Updates the code path.
Expand All @@ -641,7 +641,7 @@ CodePathAnalyzer.prototype = {
* @param {CodePathSegment} toSegment - A segment of next.
* @returns {void}
*/
onLooped: function(fromSegment, toSegment) {
onLooped(fromSegment, toSegment) {
if (fromSegment.reachable && toSegment.reachable) {
debug.dump("onCodePathSegmentLoop " + fromSegment.id + " -> " + toSegment.id);
this.emitter.emit(
Expand Down
2 changes: 1 addition & 1 deletion lib/code-path-analysis/code-path-segment.js
Expand Up @@ -138,7 +138,7 @@ CodePathSegment.prototype = {
* @param {CodePathSegment} segment - A previous segment to check.
* @returns {boolean} `true` if the segment is coming from the end of a loop.
*/
isLoopedPrevSegment: function(segment) {
isLoopedPrevSegment(segment) {
return this.internal.loopedPrevSegments.indexOf(segment) !== -1;
}
};
Expand Down

0 comments on commit cd09c96

Please sign in to comment.