Giter Club home page Giter Club logo

eslint-indent-range's Introduction

eslint-indent-range

repro of eslint indent rule bug

see eslint#8893

PS> .\node_modules\.bin\eslint .\index.js

Cannot read property 'range' of undefined
TypeError: Cannot read property 'range' of undefined
    at SourceCode.getTokensBetween (C:\Users\peet\git\eslint-indent-range\node_modules\eslint\lib\token-store\index.js:557:17)
    at parenPairs.forEach.pair (C:\Users\peet\git\eslint-indent-range\node_modules\eslint\lib\rules\indent.js:932:68)
    at Array.forEach (native)
    at addParensIndent (C:\Users\peet\git\eslint-indent-range\node_modules\eslint\lib\rules\indent.js:926:24)
    at Linter.Program:exit (C:\Users\peet\git\eslint-indent-range\node_modules\eslint\lib\rules\indent.js:1379:17)
    at emitOne (events.js:115:13)
    at Linter.emit (events.js:210:7)
    at NodeEventGenerator.applySelector (C:\Users\peet\git\eslint-indent-range\node_modules\eslint\lib\util\node-event-generator.js:265:26)
    at NodeEventGenerator.applySelectors (C:\Users\peet\git\eslint-indent-range\node_modules\eslint\lib\util\node-event-generator.js:294:22)
    at NodeEventGenerator.leaveNode (C:\Users\peet\git\eslint-indent-range\node_modules\eslint\lib\util\node-event-generator.js:317:14)

pre-reduced code

Code
const rgbToHex = rgb => `#${rgb.map(x => {
  const hex = x.toString(16);
  return hex.length === 1 ? `0${hex}` : hex;
}).join('')}`;

function addOpacity(color, coefficient, ...args) {
  if (typeof color !== 'string') {
    throw new Error('color should be a string');
  }
  const opacity = limit(coefficient, 0, 1);

  let hex;
  if (testHexColor.test(color)) {
    hex = color;
  } else {
    hex = lookupColor(color, args);
  }

  const hex6 = colorToHex6(hex);
  const rgb = hexToRgb(hex6);

  return `rgba(${rgb[0]}, ${rgb[1]}, ${rgb[2]}, ${opacity})`;
}

eslint-indent-range's People

Contributors

peet avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.