-
Notifications
You must be signed in to change notification settings - Fork 916
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
vue-loader 15 with TypeScript & webpack causes tslint to fail on .vue files. #1304
Comments
You miss https://github.com/TypeStrong/ts-loader#appendtssuffixto-regexp-default |
@JounQin, thanks for the response. I added that (I've updated the sample project) but I'm still getting the same error. Any other ideas? |
FYI, maybe it is related to tslint itself palantir/tslint#2099 and I will recommend you to use fork-ts-checker-webpack-plugin which supports |
I'm also having problems with this, although it's only throwing a warning. The problem I've got is that exported code from vue-loader has some blank lines and I get the warning "Consecutive blank lines are forbidden" from ts-lint. Should I open a different issue for this? I have fixed it with a custom loader that trims the code exported by vue-loader, so it should be easy to fix, but maybe it should be configurable (for example, depending on tslint configuration users may want or not a newline at the end of the file). |
@NoelDeMartin, yes, that's a known issue with a different issue # I believe. Are you using Vue-loader 14 or 15? If it's the latter, can you link to your project so I can see what you're doing differently than me? |
@bobbylight I have tried your repo and the problem seems to be with the And I guess you'll find that, but in your |
I removed the The only workaround I see for now is to exclude I updated the demo project with this information. |
Something else I also have different from you is the rules, you seem to have two different rules for the same files, and I have never used this {
test: /\.ts$/,
use: [
'babel-loader',
{
loader: 'ts-loader',
options: {
appendTsSuffixTo: [/\.vue$/],
},
},
'tslint-loader',
'custom-loader?name=vue-tslint-fixer',
],
}, The only thing custom-loader does is what I mentioned of removing empty lines (it works without this, but I get the warning). And I am using babel-loader because I have target: esnext in tsconfig, but I can remove this loader and it also compiles correctly. |
Thanks @NoelDeMartin, changing We're now on the same page. Remaining issues are:
IMO, the former sounds like an issue that can be corrected on the Thanks for the help guys! |
This should help: TypeStrong/fork-ts-checker-webpack-plugin#77 |
This is occurring again, when I update from vue-loader 15.3.0 to vue-loader 15.4.0. I suspect this commit: As a recap, this is where my loader configuration ended up for .vue and .ts files: {
test: /\.ts$/,
exclude: /node_modules/,
use: [
{
loader: 'ts-loader',
options: {
// Needed for <script lang="ts"> to work in *.vue files; see https://github.com/vuejs/vue-loader/issues/109
appendTsSuffixTo: [ /\.vue$/ ]
}
},
{
loader: 'tslint-loader'
// Enabling the typeCheck option here causes builds to fail:
// "Ensure that the files supplied to lint have a .ts, .tsx, .d.ts, .js or .jsx extension."
// Commented out like this, the build runs, but all lines of *.vue files are linted, including
// <template> and <script> blocks.
// , options: {
// typeCheck: true
// }
}
]
}, {
test: /\.vue$/,
use: [
{
loader: 'vue-loader'
}
]
}, { I can't see any way to get tslint to run on my *.vue files at the moment. Any other ideas? |
I just remove "typeCheck" option, It works for me |
Version
15.0.0
Reproduction link
https://github.com/bobbylight/vue-loader-15-tslint-issue
Steps to reproduce
git clone https://github.com/bobbylight/vue-loader-15-tslint-issue.git
npm install
npm run build
What is expected?
The project builds successfully.
What is actually happening?
tslint fails, seemingly because it is unhappy with "app.vue"'s suffix not being .ts/.tsx/.js/.jsx.
There might be a way to get this working, but I could not figure it out. A similar setup worked in vue-loade 14.x.x (there were differences in the webpack loaders since vue-loader didn't delegate to other loaders in 14).
I think this is the only thing holding me back from updating to vue-loader 15.
The text was updated successfully, but these errors were encountered: