Socket
Socket
Sign inDemoInstall

tslint-loader

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tslint-loader - npm Package Compare versions

Comparing version 0.0.1 to 0.9.0

50

index.js

@@ -44,9 +44,6 @@ /*

function lint(input, config) {
function lint(input, options) {
//Override options in tslint.json by those passed to the compiler
if(this.options.tslint) {
for(var name in this.options.tslint) {
config[name] = this.options.tslint[name];
}
if(this.options.tslint) {
merge(options.configuration, this.options.tslint);
}

@@ -56,17 +53,44 @@

var query = loaderUtils.parseQuery(this.query);
for(var name in query) {
config[name] = query[name];
}
merge(options.configuration, query);
var linter = new Linter(this.resourcePath, input, config);
var result = linter.lint();
report(this.resourcePath, result, this.emitWarning);
var linter = new Linter(this.resourcePath, input, options);
var result = linter.lint();
var emitter = options.configuration.emitErrors ? this.emitError : this.emitWarning;
report(result, emitter, options.configuration.failOnHint);
}
function report(filename, result, emitter) {
function report(result, emitter, failOnHint) {
if(result.failureCount === 0) return;
emitter(result.output);
if(failOnHint) {
throw new Error("Compilation failed due to tslint errors.");
}
}
/* Merges two (or more) objects,
giving the last one precedence */
function merge(target, source) {
if ( typeof target !== 'object' ) {
target = {};
}
for (var property in source) {
if ( source.hasOwnProperty(property) ) {
var sourceProperty = source[ property ];
if ( typeof sourceProperty === 'object' ) {
target[ property ] = merge( target[ property ], sourceProperty );
continue;
}
target[ property ] = sourceProperty;
}
}
for (var a = 2, l = arguments.length; a < l; a++) {
merge(target, arguments[a]);
}
return target;
};
module.exports = function(input, map) {

@@ -73,0 +97,0 @@ this.cacheable && this.cacheable();

{
"name": "tslint-loader",
"version": "0.0.1",
"version": "0.9.0",
"description": "tslint loader for webpack",

@@ -26,3 +26,3 @@ "main": "index.js",

"homepage": "https://github.com/wbuchwalter/tslint-loader",
"dependencies": {
"dependencies": {
"loader-utils": "^0.2.7",

@@ -29,0 +29,0 @@ "strip-json-comments": "^1.0.2",

@@ -16,8 +16,32 @@ # tslint loader for webpack

]
},
// more options in the optional tslint object
tslint: {
// any tslint option https://www.npmjs.com/package/tslint#supported-rules
// i. e.
rules: {
quotemark: [true, "double"]
},
// tslint errors are displayed by default as warnings
// set emitErrors to true to display them as errors
emitErrors: false,
// tslint does not interrupt the compilation by default
// if you want any file with jshint errors to fail
// set failOnHint to true
failOnHint: true,
}
}
```
## 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)
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc