This repository was archived by the owner on Mar 25, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 883
This repository was archived by the owner on Mar 25, 2021. It is now read-only.
no-unsafe-any
bombs on .vue single-file-templates #4273
Copy link
Copy link
Closed
Description
Bug Report
- TSLint version: 5.11.0
- TypeScript version: 3.1.2
- Running TSLint via: the Vue CLI
TypeScript code being linted
The following Vue single-file template.
<script lang="ts">
//tslint:disable missing-jsdoc
import Vue from 'vue';
export default class App extends Vue {}
</script>
with tslint.json
configuration:
{
"defaultSeverity": "warning",
"extends": [
"tslint:recommended",
"tslint-microsoft-contrib"
],
"linterOptions": {
"exclude": [
"node_modules/**"
]
},
"rules": {
"quotemark": [true, "single"],
"indent": [true, "spaces", 2],
"interface-name": false,
"ordered-imports": false,
"object-literal-sort-keys": false,
"no-consecutive-blank-lines": false,
"export-name": [true, {"ignore-case": true}],
"import-name": [false],
"no-default-export": false
}
}
Actual behavior
The following stack traces are output:
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)
Expected behavior
The lint runs without errors. (Not including lint issues reported.)
Notes:
This refiles vuejs/vue-cli#2712.
A repository that allows reproducing the issue can be found at https://github.com/millimoose/vue-tslint-microsoft-contrib-bug.
The issue will manifest when TSLint is run through Vue CLI which enables support for linting Vue single-file templates.
JoshuaKGoldberg, gluons, laurilehmijoki and patricio-ezequiel-hondagneu-roig