summaryrefslogtreecommitdiff
path: root/tools/eslint/lib/rules/generator-star.js
diff options
context:
space:
mode:
authorMichaƫl Zasso <mic.besace@gmail.com>2016-01-12 20:50:19 +0100
committerRoman Reiss <me@silverwind.io>2016-01-13 23:15:39 +0100
commit2d441493a4a46a511ba1bdf93e442c3288fbe92d (patch)
treec649c3aa100a57ff38ed267e3a5e5bba7ac8d961 /tools/eslint/lib/rules/generator-star.js
parented55169834a3ce16a271def9630c858626ded34d (diff)
downloadnode-new-2d441493a4a46a511ba1bdf93e442c3288fbe92d.tar.gz
tools: update eslint to v1.10.3
PR-URL: https://github.com/nodejs/io.js/pull/2286 Reviewed-By: Roman Reiss <me@silverwind.io>
Diffstat (limited to 'tools/eslint/lib/rules/generator-star.js')
-rw-r--r--tools/eslint/lib/rules/generator-star.js76
1 files changed, 0 insertions, 76 deletions
diff --git a/tools/eslint/lib/rules/generator-star.js b/tools/eslint/lib/rules/generator-star.js
deleted file mode 100644
index d6f3d2cdc5..0000000000
--- a/tools/eslint/lib/rules/generator-star.js
+++ /dev/null
@@ -1,76 +0,0 @@
-/**
- * @fileoverview Rule to check for the position of the * in your generator functions
- * @author Jamund Ferguson
- * @copyright 2014 Jamund Ferguson. All rights reserved.
- */
-
-"use strict";
-
-//------------------------------------------------------------------------------
-// Rule Definition
-//------------------------------------------------------------------------------
-
-module.exports = function(context) {
-
- var position = context.options[0] || "end";
-
- /**
- * Check the position of the star compared to the expected position.
- * @param {ASTNode} node - the entire function node
- * @returns {void}
- */
- function checkStarPosition(node) {
- var starToken;
-
- if (!node.generator) {
- return;
- }
-
- // Blocked, pending decision to fix or work around in eslint/espree#36
- if (context.getAncestors().pop().method) {
- return;
- }
-
- starToken = context.getFirstToken(node, 1);
-
- // check for function *name() {}
- if (position === "end") {
-
- // * starts where the next identifier begins
- if (starToken.range[1] !== context.getTokenAfter(starToken).range[0]) {
- context.report(node, "Expected a space before *.");
- }
- }
-
- // check for function* name() {}
- if (position === "start") {
-
- // * begins where the previous identifier ends
- if (starToken.range[0] !== context.getTokenBefore(starToken).range[1]) {
- context.report(node, "Expected no space before *.");
- }
- }
-
- // check for function * name() {}
- if (position === "middle") {
-
- // must be a space before and afer the *
- if (starToken.range[0] <= context.getTokenBefore(starToken).range[1] ||
- starToken.range[1] >= context.getTokenAfter(starToken).range[0]) {
- context.report(node, "Expected spaces around *.");
- }
- }
- }
-
- return {
- "FunctionDeclaration": checkStarPosition,
- "FunctionExpression": checkStarPosition
- };
-
-};
-
-module.exports.schema = [
- {
- "enum": ["start", "middle", "end"]
- }
-];