{ isCommentToken } = require("eslint-utils"),
TokenStore = require("./token-store"),
astUtils = require("../shared/ast-utils"),
{ isCommentToken } = require("eslint-utils"),
TokenStore = require("./token-store"),
astUtils = require("../shared/ast-utils"),
let currentToken = this.getTokenBefore(node, { includeComments: true });
while (currentToken && isCommentToken(currentToken)) {
let currentToken = this.getTokenBefore(node, { includeComments: true });
while (currentToken && isCommentToken(currentToken)) {
currentToken = this.getTokenAfter(node, { includeComments: true });
while (currentToken && isCommentToken(currentToken)) {
currentToken = this.getTokenAfter(node, { includeComments: true });
while (currentToken && isCommentToken(currentToken)) {
- * To figure out which line rangeIndex is on, determine the last index at which rangeIndex could
- * be inserted into lineIndices to keep the list sorted.
+ * To figure out which line index is on, determine the last place at which index could
+ * be inserted into lineStartIndices to keep the list sorted.
- const lineNumber = lodash.sortedLastIndex(this.lineStartIndices, index);
+ const lineNumber = index >= this.lineStartIndices[this.lineStartIndices.length - 1]
+ ? this.lineStartIndices.length
+ : this.lineStartIndices.findIndex(el => index < el);