Skip to content
This repository has been archived by the owner on Mar 25, 2021. It is now read-only.

Exception thrown when no-use-before-declare is enabled. #2181

Closed
narthollis opened this issue Feb 6, 2017 · 0 comments · Fixed by #2235
Closed

Exception thrown when no-use-before-declare is enabled. #2181

narthollis opened this issue Feb 6, 2017 · 0 comments · Fixed by #2235

Comments

@narthollis
Copy link

Bug Report

  • TSLint version: 4.2.2
  • TypeScript version: 2.2.0 RC
  • Running TSLint via: cli and npm ( tslint --project tsconfig.json -t stylish --type-check -e **/src/types/api.ts

TypeScript code being linted

I have been unable to narrow it down to a single file, any file in my project I check causes the error to throw.

with tslint.json configuration:

{
  "extends": [
    "tslint:recommended",
    "tslint-microsoft-contrib/recommended_ruleset"
  ],

  "rulesDirectory": "node_modules/tslint-microsoft-contrib",

  "rules": {
    "quotemark": [true, "single", "jsx-double"],
    "max-classes-per-file": false,
    "interface-name": false,
    "missing-jsdoc": false,
    "no-unused-variable": false,
    "no-default-export": false,
    "no-relative-imports": false,
    "no-empty-interfaces": false,
    "import-name": false,
    "export-name": false,
    "react-tsx-curly-spacing": [ true, "never" ],
    "array-type": [ true, "generic" ],
    "prefer-array-literal": [ true, { "allow-type-parameters": true } ],
    "prefer-for-of": false,
    "no-increment-decrement": false,
    "no-backbone-get-set-outside-model": false,
    "prefer-type-cast": false,
    "no-angle-bracket-type-assertion": true,
    // This should be enabled for beta and release builds
    "no-suspicious-comment": false,
  },
  "jsRules": {
    "quotemark": [true, "single", "jsx-double"],
    "max-classes-per-file": false,
    "no-unused-variable": false
  }
}

Actual behavior

Exception is thrown:

$ ./node_modules/.bin/tslint --project tsconfig.json -t stylish -c tslint.json --type-check src/index.tsx
no-unused-variable is deprecated. Use the tsc compiler options --noUnusedParameters and --noUnusedLocals instead.
C:\Alcidion\Miya\Web\MiyaED\node_modules\tslint\lib\runner.js:117
            throw error;
            ^

Error: Debug Failure. False expression:
    at Object.assert (C:\Alcidion\Miya\Web\MiyaED\node_modules\typescript\lib\typescript.js:3238:23)
    at getDefaultImportName (C:\Alcidion\Miya\Web\MiyaED\node_modules\typescript\lib\typescript.js:70705:26)
    at Object.getReferencedSymbolsForNode (C:\Alcidion\Miya\Web\MiyaED\node_modules\typescript\lib\typescript.js:70634:51)
    at getSemanticDocumentHighlights (C:\Alcidion\Miya\Web\MiyaED\node_modules\typescript\lib\typescript.js:69952:58)
    at Object.getDocumentHighlights (C:\Alcidion\Miya\Web\MiyaED\node_modules\typescript\lib\typescript.js:69939:29)
    at Object.getDocumentHighlights (C:\Alcidion\Miya\Web\MiyaED\node_modules\typescript\lib\typescript.js:80730:42)
    at NoUseBeforeDeclareWalker.validateUsageForVariable (C:\Alcidion\Miya\Web\MiyaED\node_modules\tslint\lib\rules\noUseBeforeDeclareRule.js:113:47)
    at NoUseBeforeDeclareWalker.visitImportDeclaration (C:\Alcidion\Miya\Web\MiyaED\node_modules\tslint\lib\rules\noUseBeforeDeclareRule.js:77:18)
    at NoUseBeforeDeclareWalker.SyntaxWalker.visitNode (C:\Alcidion\Miya\Web\MiyaED\node_modules\tslint\lib\language\walker\syntaxWalker.js:382:22)
    at NoUseBeforeDeclareWalker.ScopeAwareRuleWalker.visitNode (C:\Alcidion\Miya\Web\MiyaED\node_modules\tslint\lib\language\walker\scopeAwareRuleWalker.js:58:36)

Expected behavior

Not to throw an error.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant