tslint-loader
Advanced tools
Comparing version 3.2.1 to 3.3.0
# Changelog | ||
### 3.3.0 | ||
- Add ability to specify tsconfig.json for type checked rules, | ||
fixes [#45](https://github.com/wbuchwalter/tslint-loader/issues/45) | ||
## 3.2.1 | ||
@@ -4,0 +9,0 @@ |
32
index.js
@@ -16,17 +16,14 @@ /* | ||
var tslintOptions = webpackInstance.options.tslint ? webpackInstance.options.tslint : {}; | ||
var configFile = tslintOptions.configFile | ||
? path.resolve(process.cwd(), tslintOptions.configFile) | ||
: null; | ||
var query = loaderUtils.parseQuery(webpackInstance.query); | ||
var options = { | ||
formatter: 'custom', | ||
formattersDirectory: __dirname + '/formatters/', | ||
configuration: Lint.Linter.findConfiguration(configFile, webpackInstance.resourcePath).results | ||
}; | ||
var options = objectAssign({}, tslintOptions, query); | ||
objectAssign(options, tslintOptions); | ||
var configFile = options.configFile | ||
? path.resolve(process.cwd(), options.configFile) | ||
: null; | ||
// Override options in tslint.json by those passed to the loader as a query string | ||
var query = loaderUtils.parseQuery(webpackInstance.query); | ||
objectAssign(options, query); | ||
options.formatter = options.formatter || 'custom'; | ||
options.formattersDirectory = options.formattersDirectory || __dirname + '/formatters/'; | ||
options.configuration = options.configuration || Lint.Linter.findConfiguration(configFile, webpackInstance.resourcePath).results; | ||
options.tsConfigFile = options.tsConfigFile || 'tsconfig.json'; | ||
@@ -37,3 +34,8 @@ return options; | ||
function lint(webpackInstance, input, options) { | ||
var newLintOptions = { fix: false, formatter: options.formatter || 'custom', formattersDirectory: options.formattersDirectory || __dirname + '/formatters/', rulesDirectory: '' }; | ||
var lintOptions = { | ||
fix: false, | ||
formatter: options.formatter, | ||
formattersDirectory: options.formattersDirectory, | ||
rulesDirectory: '' | ||
}; | ||
var bailEnabled = (webpackInstance.options.bail === true); | ||
@@ -43,7 +45,7 @@ | ||
if (options.typeCheck) { | ||
var tsconfigPath = path.resolve(process.cwd(), 'tsconfig.json'); | ||
var tsconfigPath = path.resolve(process.cwd(), options.tsConfigFile); | ||
program = Lint.Linter.createProgram(tsconfigPath); | ||
} | ||
var linter = new Lint.Linter(newLintOptions, program); | ||
var linter = new Lint.Linter(lintOptions, program); | ||
linter.lint(webpackInstance.resourcePath, input, options.configuration); | ||
@@ -50,0 +52,0 @@ var result = linter.getResult(); |
{ | ||
"name": "tslint-loader", | ||
"version": "3.2.1", | ||
"version": "3.3.0", | ||
"description": "tslint loader for webpack", | ||
@@ -39,7 +39,8 @@ "main": "index.js", | ||
"devDependencies": { | ||
"awesome-typescript-loader": "^3.0.0-beta.3", | ||
"awesome-typescript-loader": "^3.0.0-beta.9", | ||
"chai": "^3.5.0", | ||
"enhanced-resolve": "^2.3.0", | ||
"es6-promisify": "^5.0.0", | ||
"eslint": "3.11.1", | ||
"mocha": "^3.1.2", | ||
"mocha": "^3.2.0", | ||
"np": "^2.10.1", | ||
@@ -46,0 +47,0 @@ "tslint": "^4.0.0", |
@@ -9,2 +9,8 @@ # tslint-loader | ||
## Installation | ||
``` shell | ||
npm install tslint-loader --save-dev | ||
``` | ||
## Usage | ||
@@ -31,7 +37,3 @@ | ||
}, | ||
// enables type checked rules like 'for-in-array' | ||
// uses tsconfig.json from current working directory | ||
typeCheck: false, | ||
// can specify a custom config file relative to current directory | ||
@@ -48,4 +50,12 @@ // 'tslint-custom.json' | ||
// set failOnHint to true | ||
failOnHint: true, | ||
failOnHint: true, | ||
// enables type checked rules like 'for-in-array' | ||
// uses tsconfig.json from current working directory | ||
typeCheck: false, | ||
// can specify a custom tsconfig file relative to current directory | ||
// to be used with type checked rules | ||
tsConfigFile: 'tsconfig.json', | ||
// name of your formatter (optional) | ||
@@ -56,3 +66,3 @@ formatter: 'yourformatter', | ||
formattersDirectory: 'node_modules/tslint-loader/formatters/', | ||
// These options are useful if you want to save output to files | ||
@@ -81,12 +91,7 @@ // for your continuous integration server | ||
``` | ||
## Installation | ||
``` shell | ||
npm install tslint-loader --save-dev | ||
``` | ||
## License | ||
MIT (http://www.opensource.org/licenses/mit-license.php) | ||
[MIT](http://www.opensource.org/licenses/mit-license.php) | ||
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
66433
112
93
10