summaryrefslogtreecommitdiff
path: root/tools/eslint-rules
diff options
context:
space:
mode:
authorRich Trott <rtrott@gmail.com>2016-12-31 21:51:03 -0800
committerRich Trott <rtrott@gmail.com>2017-01-06 14:36:34 -0800
commit33cd0aa70c1a3161fa821875b538c888eba7ddc6 (patch)
tree9d2aeb2883de52f2eb109677b344baf6d2d0f950 /tools/eslint-rules
parentf44969a5aba6b447f7c1a715c5009644cbd49a5b (diff)
downloadandroid-node-v8-33cd0aa70c1a3161fa821875b538c888eba7ddc6.tar.gz
android-node-v8-33cd0aa70c1a3161fa821875b538c888eba7ddc6.tar.bz2
android-node-v8-33cd0aa70c1a3161fa821875b538c888eba7ddc6.zip
tools: remove custom align-function-arguments rule
ESLint `indent` rule now has options that duplicate functionality in our custom `align-function-arguments` rule. Remove `align-function-arguments` custom rule. PR-URL: https://github.com/nodejs/node/pull/10561 Reviewed-By: Teddy Katz <teddy.katz@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
Diffstat (limited to 'tools/eslint-rules')
-rw-r--r--tools/eslint-rules/align-function-arguments.js76
1 files changed, 0 insertions, 76 deletions
diff --git a/tools/eslint-rules/align-function-arguments.js b/tools/eslint-rules/align-function-arguments.js
deleted file mode 100644
index 015552489a..0000000000
--- a/tools/eslint-rules/align-function-arguments.js
+++ /dev/null
@@ -1,76 +0,0 @@
-/**
- * @fileoverview Align arguments in multiline function calls
- * @author Rich Trott
- */
-'use strict';
-
-//------------------------------------------------------------------------------
-// Rule Definition
-//------------------------------------------------------------------------------
-
-function checkArgumentAlignment(context, node) {
-
- function isNodeFirstInLine(node, byEndLocation) {
- const firstToken = byEndLocation === true ? context.getLastToken(node, 1) :
- context.getTokenBefore(node);
- const startLine = byEndLocation === true ? node.loc.end.line :
- node.loc.start.line;
- const endLine = firstToken ? firstToken.loc.end.line : -1;
-
- return startLine !== endLine;
- }
-
- if (node.arguments.length === 0)
- return;
-
- var msg = '';
- const first = node.arguments[0];
- var currentLine = first.loc.start.line;
- const firstColumn = first.loc.start.column;
-
- const ignoreTypes = [
- 'ArrowFunctionExpression',
- 'FunctionExpression',
- 'ObjectExpression',
- ];
-
- const args = node.arguments;
-
- // For now, don't bother trying to validate potentially complicating things
- // like closures. Different people will have very different ideas and it's
- // probably best to implement configuration options.
- if (args.some((node) => { return ignoreTypes.indexOf(node.type) !== -1; })) {
- return;
- }
-
- if (!isNodeFirstInLine(node)) {
- return;
- }
-
- var misaligned;
-
- args.slice(1).forEach((argument) => {
- if (!misaligned) {
- if (argument.loc.start.line === currentLine + 1) {
- if (argument.loc.start.column !== firstColumn) {
- if (isNodeFirstInLine(argument)) {
- msg = 'Function argument in column ' +
- `${argument.loc.start.column + 1}, ` +
- `expected in ${firstColumn + 1}`;
- misaligned = argument;
- }
- }
- }
- }
- currentLine = argument.loc.start.line;
- });
-
- if (msg)
- context.report(misaligned, msg);
-}
-
-module.exports = function(context) {
- return {
- 'CallExpression': (node) => checkArgumentAlignment(context, node)
- };
-};