-
Notifications
You must be signed in to change notification settings - Fork 65
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
Ref #76: Pass program for performance gain #78
base: master
Are you sure you want to change the base?
Conversation
@mtraynham can we restrict it only to |
Edit: Sorry, still early here. You want |
Alrighty, rebased. When users provide |
@mtraynham seems good, added one review |
Actually, my mistake @BlackSonic . This is still creating the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you check that the error remains or not if the program is cached? It is mentioned in the corresponding ticket.
index.js
Outdated
program = Lint.Linter.createProgram(tsconfigPath); | ||
if (!options.program) { | ||
var tsconfigPath = resolveFile(options.tsConfigFile); | ||
options.program = Lint.Linter.createProgram(tsconfigPath); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just assign it to program
, it is not desired to modify an input object.
@BlackSonic I think you may have annotated an old commit. That |
Can you merge this PR please?
|
I just checked it locally - works as intended only for the first time - in watch mode shows exactly the same, "cached" errors with every incremental builds. This should be fixed and also we should add a test to ensure it is capable to work correctly in watch mode? |
Any idea when this is going to be resolved? |
index.js
Outdated
@@ -62,8 +62,15 @@ function lint(webpackInstance, input, options) { | |||
|
|||
var program; | |||
if (options.typeCheck) { | |||
var tsconfigPath = resolveFile(options.tsConfigFile); | |||
program = Lint.Linter.createProgram(tsconfigPath); | |||
if (!webpackInstance.options.tslintProgram) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
compiler.options
is deprecated.
nudge This is a major inefficiency and it would be great to see this PR merged! |
Guys, any news? |
The PR is not a full solution, because the first result gets cached |
Rebased and corrected. When using Webpack watch mode, use the new var TslintPlugin = require('tslint-loader').TslintPlugin;
module.exports = {
plugins: [
new TslintPlugin()
],
module: {
rules: [
{
test: /\.ts$/,
enforce: 'pre',
loader: 'tslint-loader',
options: { typeCheck: true, /* Loader options go here */ }
}
]
}
} |
Bump @BlackSonic - could you please take a look? |
Just giving anyone a heads up. I wrote this pull, but I'm no longer using I have moved to fork-ts-checker-webpack-plugin. It runs TypeScript typechecking and optionally tslint in a secondary node process that does not affect the Webpack build process. ts-loader now recommends this setup. Setting the |
@mtraynham fork-ts-checker plugin runs async. Even with async set to false, there is no way to make the bundle not emit on error. I am using |
Does this not work? |
@pelotom no. I'm using the plugin but my bundle is still emitted. That's the reason why I switched over to try this loader. |
This change would definitely be a nice-to-have. I noticed the performance difference as well and couldn't get any of the other TS Lint with webpack plugins to work the way I needed. |
Using TSLint Language Service in VSCode, I figure why Of course, by default, TS plugins get ignored during compilation. However, there is a workaround to make them work as part of the compiler. Advantage of this? Messages of tslint are part of the compiler diagnostics and tslint is run at the same time while the file is being transpiled (and type checking as well). The problem with It works in my projects. However, it may still need some work. Part of the ideas where also taken from this thread and others. |
@eddyw thanks for the info, I'll take a look at it. The primary reason I want TS Linting during compilation is for Checkstyle reporting as part of the automated build process. In most other scenarios, you're right: it doesn't make sense to couple these two things. |
As suggested in #76, we can pass the program so it's only created once per build. Alternatively, you could have the loader generate just once, instead of having the user pass it. But, I use both gulp-tslint and tslint-loader, so the consistency there is nice.