Skip to content

TSLint bombs on .vue files for some rules from tslint-microsoft-contrib #2712

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

Closed
millimoose opened this issue Oct 11, 2018 · 5 comments
Closed
Labels
needs team repro We acknowledged your report and will soon try to reproduce it scope: typescript

Comments

@millimoose
Copy link

Version

3.0.5

Reproduction link

https://github.com/millimoose/vue-tslint-microsoft-contrib-bug

Node and OS info

Node v10.11.0, npm 6.4.1, Typescript 3.1.2, TSLint 5.11.0, Ubuntu 18.04.1 LTS on WSL on Windows 10

Steps to reproduce

Run npm run lint --no-fix

What is expected?

The lint runs without errors

What is actually happening?

I get the following stack trace:

The 'no-use-before-declare' rule threw an error in '/mnt/c/Repos/vue-tslint-microsoft-contrib-bug/src/App.vue':
TypeError: Cannot read property 'members' of undefined
    at resolveNameHelper (/mnt/c/Repos/vue-tslint-microsoft-contrib-bug/node_modules/typescript/lib/typescript.js:31434:105)
    at resolveName (/mnt/c/Repos/vue-tslint-microsoft-contrib-bug/node_modules/typescript/lib/typescript.js:31276:20)
    at resolveEntityName (/mnt/c/Repos/vue-tslint-microsoft-contrib-bug/node_modules/typescript/lib/typescript.js:32120:26)
    at getSymbolOfEntityNameOrPropertyAccessExpression (/mnt/c/Repos/vue-tslint-microsoft-contrib-bug/node_modules/typescript/lib/typescrip
t.js:55582:80)
    at getSymbolAtLocation (/mnt/c/Repos/vue-tslint-microsoft-contrib-bug/node_modules/typescript/lib/typescript.js:55669:28)
    at Object.getSymbolAtLocation (/mnt/c/Repos/vue-tslint-microsoft-contrib-bug/node_modules/typescript/lib/typescript.js:30310:31)
    at recur (/mnt/c/Repos/vue-tslint-microsoft-contrib-bug/node_modules/tslint/lib/rules/noUseBeforeDeclareRule.js:65:54)
    at visitNode (/mnt/c/Repos/vue-tslint-microsoft-contrib-bug/node_modules/typescript/lib/typescript.js:15829:24)
    at Object.forEachChild (/mnt/c/Repos/vue-tslint-microsoft-contrib-bug/node_modules/typescript/lib/typescript.js:16208:24)
    at recur (/mnt/c/Repos/vue-tslint-microsoft-contrib-bug/node_modules/tslint/lib/rules/noUseBeforeDeclareRule.js:69:27)
The 'no-unsafe-any' rule threw an error in '/mnt/c/Repos/vue-tslint-microsoft-contrib-bug/src/App.vue':
TypeError: Cannot read property 'members' of undefined
    at resolveNameHelper (/mnt/c/Repos/vue-tslint-microsoft-contrib-bug/node_modules/typescript/lib/typescript.js:31434:105)
    at resolveName (/mnt/c/Repos/vue-tslint-microsoft-contrib-bug/node_modules/typescript/lib/typescript.js:31276:20)
    at resolveEntityName (/mnt/c/Repos/vue-tslint-microsoft-contrib-bug/node_modules/typescript/lib/typescript.js:32120:26)
    at getSymbolOfEntityNameOrPropertyAccessExpression (/mnt/c/Repos/vue-tslint-microsoft-contrib-bug/node_modules/typescript/lib/typescript.js:55582:80)
    at getSymbolAtLocation (/mnt/c/Repos/vue-tslint-microsoft-contrib-bug/node_modules/typescript/lib/typescript.js:55669:28)
    at Object.getSymbolAtLocation (/mnt/c/Repos/vue-tslint-microsoft-contrib-bug/node_modules/typescript/lib/typescript.js:30310:31)
    at isNodeAny (/mnt/c/Repos/vue-tslint-microsoft-contrib-bug/node_modules/tslint/lib/rules/noUnsafeAnyRule.js:368:26)
    at NoUnsafeAnyWalker.check (/mnt/c/Repos/vue-tslint-microsoft-contrib-bug/node_modules/tslint/lib/rules/noUnsafeAnyRule.js:262:14)
    at NoUnsafeAnyWalker.visitNode (/mnt/c/Repos/vue-tslint-microsoft-contrib-bug/node_modules/tslint/lib/rules/noUnsafeAnyRule.js:88:45)
    at NoUnsafeAnyWalker._this.visitNodeCallback (/mnt/c/Repos/vue-tslint-microsoft-contrib-bug/node_modules/tslint/lib/rules/noUnsafeAnyRule.js:55:71)
@LinusBorg LinusBorg added scope: typescript needs team repro We acknowledged your report and will soon try to reproduce it labels Oct 12, 2018
@JoshuaKGoldberg
Copy link

The failing rules are no-use-before-declare and no-unsafe-any, which are both part of core TSLint rather than tslint-microsoft-contrib.

These are bugs that should be fixed in TSLint. We should note that no-use-before-declare is a legacy rule and it is recommend you no longer use it.

@millimoose
Copy link
Author

millimoose commented Nov 7, 2018

Hm, it seems the tslint-microsoft-contrib recommended ruleset enables them which is what threw me off? As in, the sequence of events for me was: using the TSLint ruleset was fine, adding the contrib one caused the bug to manifest, it didn't occur to me to look into which project has the actual rules complaining.

Anyway, thanks for taking a look at this @JoshuaKGoldberg, should I refile this with TSLint? Additionally, maybe tslint-microsoft-contrib shouldn't enable no-use-before-declare in its recommended ruleset anymore?

@JoshuaKGoldberg
Copy link

refile this with TSLint

Yes please 😊. I'm already planning on taking a look anyway, but it'd be nice for tracking there.

maybe tslint-microsoft-contrib shouldn't enable no-use-before-declare in its recommended ruleset

Agreed!

@millimoose
Copy link
Author

@JoshuaKGoldberg - Done at palantir/tslint#4273, thanks.

@millimoose
Copy link
Author

millimoose commented Nov 8, 2018

@LinusBorg, @JoshuaKGoldberg - in light of the investigation leading to other culprits, maybe this issue can be closed as superseded by those other issues?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs team repro We acknowledged your report and will soon try to reproduce it scope: typescript
Projects
None yet
Development

No branches or pull requests

4 participants