Skip to content

Commit 42aa0d2

Browse files
authored
Merge pull request #16 from Realytics/fix/tslint-option
Fix tslint: true issue
2 parents 8bce60f + c2aea83 commit 42aa0d2

File tree

6 files changed

+52
-12
lines changed

6 files changed

+52
-12
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
## v0.2.1
2+
* Fix for `tslint: true` option issue
3+
14
## v0.2.0
25
* tsconfig.json and tslint.json path are not printed anymore.
36
* `watch` option is not used on 'build' mode

lib/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ function ForkTsCheckerWebpackPlugin (options) {
2020
this.options = Object.assign({}, options);
2121

2222
this.tsconfig = options.tsconfig || './tsconfig.json';
23-
this.tslint = options.tslint ? isString(options.tslint) ? options.tslint : './tslint.json' : undefined;
23+
this.tslint = options.tslint ?
24+
options.tslint === true ? './tslint.json' : options.tslint : undefined;
2425
this.watch = isString(options.watch) ? [options.watch] : options.watch || [];
2526
this.ignoreDiagnostics = options.ignoreDiagnostics || [];
2627
this.ignoreLints = options.ignoreLints || [];

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "fork-ts-checker-webpack-plugin",
3-
"version": "0.2.0",
3+
"version": "0.2.1",
44
"description": "Runs typescript type checker and linter on separate process.",
55
"main": "lib/index.js",
66
"scripts": {

test/integration/index.spec.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,4 +121,10 @@ describe('[INTEGRATION] index', function () {
121121
callback();
122122
}
123123
});
124+
125+
it('should detect tslint path for true option', function () {
126+
expect(function() {
127+
createCompiler({ tslint: true });
128+
}).to.not.throw.error;
129+
});
124130
});

test/unit/index.spec.js

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
var describe = require('mocha').describe;
2+
var it = require('mocha').it;
3+
var expect = require('chai').expect;
4+
var ForkTsCheckerWebpackPlugin = require('../../lib/index');
5+
6+
describe('[UNIT] index', function () {
7+
8+
it('should allow to pass no options', function () {
9+
expect(function () {
10+
new ForkTsCheckerWebpackPlugin();
11+
}).to.not.throw.error;
12+
});
13+
14+
it('should detect paths', function () {
15+
var plugin = new ForkTsCheckerWebpackPlugin({ tslint: true });
16+
17+
expect(plugin.tsconfig).to.be.equal('./tsconfig.json');
18+
expect(plugin.tslint).to.be.equal('./tslint.json');
19+
});
20+
21+
it('should set logger to console by default', function () {
22+
var plugin = new ForkTsCheckerWebpackPlugin({ });
23+
24+
expect(plugin.logger).to.be.equal(console);
25+
});
26+
27+
it('should set watch to empty array by default', function () {
28+
var plugin = new ForkTsCheckerWebpackPlugin({ });
29+
30+
expect(plugin.watch).to.be.deep.equal([]);
31+
});
32+
33+
it('should set watch to one element array for string', function () {
34+
var plugin = new ForkTsCheckerWebpackPlugin({ watch: '/test' });
35+
36+
expect(plugin.watch).to.be.deep.equal(['/test']);
37+
});
38+
39+
});

yarn.lock

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2493,16 +2493,7 @@ typescript@^2.1.0:
24932493
version "2.3.2"
24942494
resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.3.2.tgz#f0f045e196f69a72f06b25fd3bd39d01c3ce9984"
24952495

2496-
uglify-js@^2.6:
2497-
version "2.8.22"
2498-
resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-2.8.22.tgz#d54934778a8da14903fa29a326fb24c0ab51a1a0"
2499-
dependencies:
2500-
source-map "~0.5.1"
2501-
yargs "~3.10.0"
2502-
optionalDependencies:
2503-
uglify-to-browserify "~1.0.0"
2504-
2505-
uglify-js@^2.8.27:
2496+
uglify-js@^2.6, uglify-js@^2.8.27:
25062497
version "2.8.27"
25072498
resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-2.8.27.tgz#47787f912b0f242e5b984343be8e35e95f694c9c"
25082499
dependencies:

0 commit comments

Comments
 (0)