Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

semi-style - rc.0 - cannot read property range of null #8696

Closed
lukeapage opened this issue Jun 7, 2017 · 1 comment · Fixed by singapore/lint-condo#308, renovatebot/renovate#290 or homezen/hz-test-helpers#42
Assignees
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion archived due to age This issue has been archived; please open a new issue for any further discussion bug ESLint is working incorrectly rule Relates to ESLint's core rules

Comments

@lukeapage
Copy link
Contributor

Tell us about your environment

  • ESLint Version: 4.0.0-rc.0
  • Node Version:
  • npm Version:

What parser (default, Babel-ESLint, etc.) are you using?
default

Please show your full configuration:

{
    "root": true,
    "parserOptions": {
        "ecmaVersion": 6,
        "ecmaFeatures": {
            "jsx": true
        },
        "sourceType": "module"
    },
    "plugins": ["destructuring", "switch-case", "promise"],
    "settings": {
        "react": {
            "version": "15.1"
        },
        "import/resolver": {
            "@saxo/webpack-import-resolver": {
                "config": "./js/build/webpack/config"
            }
        },
        "import/ignore": [
            "templates",
            "libs",
            "\\.json",
            "node_modules"
        ]
    },
    "globals": {
        // added by the build process
        "BUILD_IS_DEBUG": false,
        "BUILD_IS_PHONE": false,
        "BUILD_IS_TABLET": false,
        "BUILD_IS_DESKTOP": false,
        "BUILD_APP_NAME": false,
        // use for module splitting
        "require": false,
        // define our own globals since the built-in list contains many false negatives like "find" that are non-standard
        "window": false,
        "document": false,
        "location": false,
        "escape": false,
        "unescape": false,
        "setTimeout": false,
        "clearTimeout": false,
        "setInterval": false,
        "clearInterval": false,
        "console": false,
        "sessionStorage": false,
        "localStorage": false,
        "XMLHttpRequest": false,
        "atob": false,
        "Blob": false,
        "navigator": false,
        "MessageChannel": false,
        "Map": false,
        "Uint8Array": false,
        "Promise": false,
        "HTMLElement": false,
        "MouseEvent": false,
        "performance": false
    },
    "rules": {
        // Possible errors
        "no-await-in-loop": "error",
        "no-compare-neg-zero": "error",
        "no-cond-assign": "error",
        "no-console": "error",
        "no-constant-condition": "error",
        "no-control-regex": "error",
        "no-debugger": "error",
        "no-dupe-args": "error",
        "no-dupe-keys": "error",
        "no-duplicate-case": "error",
        "no-empty": "error",
        "no-empty-character-class": "error",
        "no-ex-assign": "error",
        "no-extra-boolean-cast": "error",
        "no-extra-parens": ["error", "functions"],
        "no-extra-semi": "error",
        "no-func-assign": "error",
        "no-inner-declarations": ["error", "functions"],
        "no-invalid-regexp": "error",
        "no-irregular-whitespace": "error",
        "no-obj-calls": "error",
        "no-prototype-builtins": "off",
        "no-regex-spaces": "error",
        "no-sparse-arrays": "error",
        "no-template-curly-in-string": "off",
        "no-unexpected-multiline": "error",
        "no-unreachable": "error",
        "no-unsafe-negation": "error",
        "no-unsafe-finally": "error",
        "use-isnan": "error",
        "valid-jsdoc": [
            "off", {
                // too restrictive at present
                "requireReturn": false,
                "requireParamDescription": false,
                "requireReturnDescription": false
            }
        ],
        "valid-typeof": "error",
        // Best practices
        "accessor-pairs": "off",
        "array-callback-return": "error",
        "block-scoped-var": "error",
        "class-methods-use-this": "off",
        "complexity": ["error", 18],
        "consistent-return": "off",
        "curly": ["error", "all"],
        "default-case": "off",
        "dot-location": ["error", "property"],
        "dot-notation": "off",
        "eqeqeq": ["error", "always", {"null": "ignore"}],
        "guard-for-in": "error",
        "no-alert": "error",
        "no-caller": "error",
        "no-case-declarations": "error",
        "no-div-regex": "error",
        "no-else-return": "error",
        "no-empty-function": "off",
        // Related - lodash/use-noop
        "no-empty-pattern": "error",
        "no-eq-null": "off",
        // see also eqeqeq
        "no-eval": "error",
        "no-extend-native": "error",
        "no-extra-bind": "error",
        "no-extra-label": "error",
        "no-fallthrough": "error",
        "no-floating-decimal": "error",
        "no-global-assign": "error",
        "no-implicit-coercion": "error",
        "no-implicit-globals": "error",
        "no-implied-eval": "error",
        "no-invalid-this": "off",
        // Does not work with spine this.proxy and arrows used in new code
        "no-iterator": "error",
        "no-labels": "error",
        "no-lone-blocks": "error",
        "no-loop-func": "error",
        "no-magic-numbers": [
            "off",
            {
                "ignore": [-1, 0, 1, 2]
            }
        ],
        // nice idea but many self explanatory numbers caught
        "no-multi-spaces": ["error", { "ignoreEOLComments": true }],
        "no-multi-str": "error",
        "no-new": "off",
        "no-new-func": "error",
        "no-new-wrappers": "error",
        "no-octal": "error",
        "no-octal-escape": "error",
        "no-param-reassign": "off",
        "no-proto": "error",
        "no-redeclare": "error",
        "no-return-assign": "error",
        "no-return-await": "error",
        "no-script-url": "error",
        "no-self-assign": "error",
        "no-self-compare": "error",
        "no-sequences": "error",
        "no-throw-literal": "error",
        "no-unmodified-loop-condition": "error",
        "no-unused-expressions": "error",
        "no-unused-labels": "error",
        "no-useless-call": "error",
        "no-useless-concat": "error",
        "no-useless-escape": "error",
        "no-useless-return": "error",
        "no-void": "error",
        "no-warning-comments": "off",
        "no-with": "error",
        "radix": ["error", "always"],
        "require-await": "off",
        // fixed in es5 but we support android 4.1-4.3 which require a radix
        "vars-on-top": "off",
        "wrap-iife": ["error", "any"],
        "yoda": ["error", "never"],
        // Strict mode
        "strict": "error",
        // Variables
        "init-declarations": "off",
        "no-catch-shadow": "error",
        "no-delete-var": "off",
        "no-label-var": "error",
        "no-restricted-globals": "off",
        "no-shadow": "error",
        "no-shadow-restricted-names": "error",
        "no-undef": "error",
        "no-undef-init": "off",
        "no-undefined": "off",
        "no-use-before-define": ["error", "nofunc"],
        // Node.js and CommonJS
        "callback-return": "off",
        "global-require": "off",
        "handle-callback-err": "off",
        "no-mixed-requires": "off",
        "no-new-require": "off",
        "no-path-concat": "off",
        "no-process-env": "off",
        "no-process-exit": "off",
        "no-restricted-modules": "off",
        "no-restricted-properties": "off",
        "no-sync": "off",

        // Stylistic issues
        "array-bracket-spacing": ["error", "never"],
        "block-spacing": ["error", "always"],
        "brace-style": [
            "error",
            "1tbs",
            {
                "allowSingleLine": false
            }
        ],
        "camelcase": [
            "error",
            {
                "properties": "always"
            }
        ],
        "capitalized-comments": ["off", "never"], // would need a full review of alot of comments!
        "comma-dangle": ["error", "always-multiline"],
        "comma-spacing": [
            "error",
            {
                "before": false,
                "after": true
            }
        ],
        "comma-style": ["error", "last"],
        "computed-property-spacing": ["error", "never"],
        "consistent-this": "off",
        "eol-last": "error",
        "for-direction": "off",
        "func-call-spacing": ["error", "never"],
        "func-name-matching": "error",
        "func-names": "off",
        "func-style": [
            "error",
            "declaration",
            {
                "allowArrowFunctions": true
            }
        ],
        "id-blacklist": "off",
        "id-length": ["off"],
        // Difficult to enforce
        "id-match": "off",
        "indent": [
            "error",
            4,
            {
                "SwitchCase": 1
            }
        ],
        // TODO: Consider MemberExpression
        "jsx-quotes": ["error", "prefer-double"],
        "key-spacing": [
            "error",
            {
                "beforeColon": false,
                "afterColon": true
            }
        ],
        "keyword-spacing": "error",
        "line-comment-position": "off",
        "linebreak-style": ["error", "windows"],
        "lines-around-comment": [
            "error",
            {
                "beforeBlockComment": true,
                "beforeLineComment": true,
                "allowBlockStart": true,
                "allowObjectStart": true,
                "allowArrayStart": true
            }
        ],
        "max-depth": ["error", 4],
        "max-len": [
            "error",
            {
                "code": 150
            }
        ],
        "max-lines": [
            "error",
            {
                "skipBlankLines": true,
                "skipComments": true,
                "max": 300
            }
        ],
        "max-nested-callbacks": ["error", 3],
        "max-params": ["error", 5],
        "max-statements": ["error", 30],
        "max-statements-per-line": [
            "error",
            {
                "max": 2
            }
        ],
        "multiline-ternary": "off",
        "new-cap": [
            "error",
            {
                "newIsCap": true,
                "capIsNew": false
            }
        ],
        // React mixins are capitalized
        "new-parens": "error",
        "newline-per-chained-call": "off",
        "no-array-constructor": "error",
        "no-bitwise": "off",
        "no-continue": "off",
        "no-inline-comments": "off",
        "no-lonely-if": "error",
        "no-mixed-spaces-and-tabs": "error",
        "no-multiple-empty-lines": [
            "error",
            {
                "max": 1,
                "maxBOF": 0,
                "maxEOF": 1
            }
        ],
        "no-multi-assign": "off",
        "no-negated-condition": "error",
        "no-nested-ternary": "error",
        "no-new-object": "error",
        "no-plusplus": "off",
        "no-restricted-syntax": "off",
        "no-tabs": "error",
        "no-ternary": "off",
        "no-trailing-spaces": "error",
        "no-underscore-dangle": [
            "off",
            {
                "allow": ["_"]
            }
        ],
        // required in a few cases
        "no-unneeded-ternary": [
            "error",
            {
                "defaultAssignment": false
            }
        ],
        "no-whitespace-before-property": "error",
        "nonblock-statement-body-position": "off",
        "object-curly-newline": [
            "off", {
                // waiting on https://github.com/eslint/eslint/issues/6488
                "ObjectExpression": {
                    "multiline": true,
                    "minProperties": 3
                }
            }
        ],
        "object-curly-spacing": ["error", "always"],
        "object-property-newline": [
            "error", {
                "allowMultiplePropertiesPerLine": true
            }
        ],
        "one-var": [
            "error",
            {
                "let": "never",
                "const": "never"
            }
        ],
        "one-var-declaration-per-line": "off",
        "operator-assignment": ["error", "always"],
        "operator-linebreak": ["error", "after"],
        "padded-blocks": "off",
        "padding-line-between-statements": "off",
        "quote-props": "off",
        "quotes": ["error", "single"],
        "require-jsdoc": "off",
        "semi": ["error", "always"],
        "semi-spacing": [
            "error",
            {
                "before": false,
                "after": true
            }
        ],
        "semi-style": ["error", "last"],
        "sort-keys": "off",
        "sort-vars": "off",
        "space-before-blocks": ["error", "always"],
        "space-before-function-paren": ["error", "never"],
        "space-in-parens": ["error", "never"],
        "space-infix-ops": "error",
        "space-unary-ops": [
            "error",
            {
                "words": true,
                "nonwords": false
            }
        ],
        "spaced-comment": ["error", "always", { "exceptions": ["*"] }],
        "switch-colon-spacing": ["error", { "after": true, "before": false }],
        "template-tag-spacing": "off",
        "unicode-bom": "off",
        "wrap-regex": "off",
        // ES2015 rules
        "arrow-body-style": [
            "error",
            "as-needed",
            {
                "requireReturnForObjectLiteral": true
            }
        ],
        "arrow-parens": ["error", "always"],
        "arrow-spacing": [
            "error",
            {
                "before": true,
                "after": true
            }
        ],
        "constructor-super": "error",
        "generator-star-spacing": "off",
        "no-class-assign": "error",
        "no-confusing-arrow": "off",
        "no-const-assign": "error",
        "no-dupe-class-members": "error",
        "no-duplicate-imports": "error",
        "no-new-symbol": "error",
        "no-restricted-imports": "error",
        "no-this-before-super": "error",
        "no-useless-computed-key": "error",
        "no-useless-constructor": "error",
        "no-useless-rename": "error",
        "no-var": "error",
        "object-shorthand": "error",
        "prefer-arrow-callback": "off",
        "prefer-const": [
            "error",
            {
                "ignoreReadBeforeAssign": true
            }
        ],
        "prefer-destructuring": "off", // could consider when autofixed
        "prefer-numeric-literals": "off",
        "prefer-promise-reject-errors": "off",
        "prefer-reflect": "off",
        "prefer-rest-params": "off",
        "prefer-spread": "off",
        "prefer-template": "off",
        "sort-imports": "off",
        "symbol-description": "off",
        "require-yield": "off",
        "template-curly-spacing": "off",
        "yield-star-spacing": "off",
        // Destructuring
        "destructuring/no-rename": "error",
        "destructuring/in-params": [
            "error",
            {
                "max-params": 1
            }
        ],
        // Switch-Case
        "switch-case/no-case-curly": "error",
        "switch-case/newline-between-switch-case": [
            "error",
            "always",
            {
                "fallthrough": "never"
            }
        ],
        "promise/catch-or-return": "off",
        "promise/param-names": "error",
        "promise/no-native": "off",
        "promise/no-return-wrap": "off",
        "promise/always-return": "off",
        "promise/no-nesting": "off",
        "promise/no-promise-in-callback": "error",
        "promise/no-callback-in-promise": "off",
        "promise/prefer-await-to-then": "off",
        "promise/prefer-await-to-callbacks": "off"
    }
}

What did you do? Please include the actual source code causing the issue.

ran eslint.. got an error. This appears to be a decent file that reproduces the issue..

describe('xyz', () => {
})
;

What did you expect to happen?

No error..

What actually happened? Please include the actual, raw output from ESLint.

TypeError: Cannot read property 'range' of null
  at SourceCode.getFirstTokenBetween (c:\path\to\node_modules\eslint\lib\token-store\index.js:339:18)
  at commentsExistBetween (c:\path\to\node_modules\eslint\lib\rules\semi-style.js:50:31)
  at Object.fix (c:\path\to\node_modules\eslint\lib\rules\semi-style.js:82:29)
  at RuleContext.report (c:\path\to\node_modules\eslint\lib\rule-context.js:127:34)
  at check (c:\path\to\node_modules\eslint\lib\rules\semi-style.js:73:25)
  at Linter.:matches(BreakStatement,ContinueStatement,DebuggerStatement,DoWhileStatement,EmptyStatement,ExportAllDeclaration,ExportDefaultDeclaration,ExportNamedDeclaration,ExpressionStatement,ImportDeclaration,ReturnStatement,ThrowStatement,VariableDeclaration) (c:\path\to\node_modules\eslint\lib\rules\semi-style.js:101:21)
  at emitOne (events.js:96:13)
  at Linter.emit (events.js:188:7)
  at NodeEventGenerator.applySelector (c:\path\to\node_modules\eslint\lib\util\node-event-generator.js:265:26)
  at NodeEventGenerator.applySelectors (c:\path\to\node_modules\eslint\lib\util\node-event-generator.js:294:22)
  at NodeEventGenerator.enterNode (c:\path\to\node_modules\eslint\lib\util\node-event-generator.js:308:14)
  at CodePathAnalyzer.enterNode (c:\path\to\node_modules\eslint\lib\code-path-analysis\code-path-analyzer.js:602:23)
  at Traverser.enter (c:\path\to\node_modules\eslint\lib\linter.js:920:36)
  at Traverser.__execute (c:\path\to\node_modules\estraverse\estraverse.js:397:31)
  at Traverser.traverse (c:\path\to\node_modules\estraverse\estraverse.js:501:28)
  at Traverser.traverse (c:\path\to\node_modules\eslint\lib\util\traverser.js:31:22)
  at Linter.verify (c:\path\to\node_modules\eslint\lib\linter.js:917:28)
  at multipassFix (c:\path\to\node_modules\eslint\lib\cli-engine.js:169:27)
  at processText (c:\path\to\node_modules\eslint\lib\cli-engine.js:272:27)
  at processFile (c:\path\to\node_modules\eslint\lib\cli-engine.js:320:18)
  at executeOnFile (c:\path\to\node_modules\eslint\lib\cli-engine.js:655:25)
  at fileList.forEach.fileInfo (c:\path\to\node_modules\eslint\lib\cli-engine.js:693:13)
  at Array.forEach (native)
  at CLIEngine.executeOnFiles (c:\path\to\node_modules\eslint\lib\cli-engine.js:692:18)
  at Object.<anonymous> (c:\path\to\node_modules\grunt-eslint\tasks\eslint.js:29:20)
@eslintbot eslintbot added the triage An ESLint team member will look at this issue soon label Jun 7, 2017
@lukeapage lukeapage changed the title rc.0 - cannot read property range of null semi-style - rc.0 - cannot read property range of null Jun 7, 2017
@soda0289 soda0289 added accepted There is consensus among the team that this change meets the criteria for inclusion bug ESLint is working incorrectly rule Relates to ESLint's core rules and removed triage An ESLint team member will look at this issue soon labels Jun 7, 2017
@soda0289
Copy link
Member

soda0289 commented Jun 7, 2017

I can reproduce the problem. Its caused by the semi-style rule.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion archived due to age This issue has been archived; please open a new issue for any further discussion bug ESLint is working incorrectly rule Relates to ESLint's core rules
Projects
None yet
3 participants