Skip to content

Commit

Permalink
add tslint and optimize-js
Browse files Browse the repository at this point in the history
  • Loading branch information
haoliangyu committed Oct 6, 2016
1 parent b8ddef4 commit 8379d66
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 0 deletions.
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,13 @@
"html-webpack-plugin": "^2.22.0",
"less": "^2.5.3",
"less-loader": "^2.2.2",
"optimize-js-plugin": "0.0.4",
"raw-loader": "^0.5.1",
"style-loader": "^0.13.0",
"to-string-loader": "^1.1.3",
"ts-loader": "^0.7.2",
"tslint": "^3.15.1",
"tslint-loader": "^2.1.5",
"typescript": "^1.7.5",
"url-loader": "^0.5.7",
"webpack": "^1.12.9",
Expand Down
57 changes: 57 additions & 0 deletions tslint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{
"rules": {
"class-name": true,
"comment-format": [
true,
"check-space"
],
"indent": [
true,
"spaces"
],
"no-duplicate-variable": true,
"no-eval": true,
"no-internal-module": true,
"no-trailing-whitespace": true,
"no-var-keyword": true,
"one-line": [
true,
"check-open-brace",
"check-whitespace"
],
"quotemark": [
true,
"double"
],
"semicolon": [
true,
"always"
],
"triple-equals": [
true,
"allow-null-check"
],
"typedef-whitespace": [
true,
{
"call-signature": "nospace",
"index-signature": "nospace",
"parameter": "nospace",
"property-declaration": "nospace",
"variable-declaration": "nospace"
}
],
"variable-name": [
true,
"ban-keywords"
],
"whitespace": [
true,
"check-branch",
"check-decl",
"check-operator",
"check-separator",
"check-type"
]
}
}
7 changes: 7 additions & 0 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ var path = require('path');

var HtmlWebpackPlugin = require('html-webpack-plugin');
var ExtractTextPlugin = require("extract-text-webpack-plugin");
var OptimizeJsPlugin = require("optimize-js-plugin");

var srcDir = 'public_src';
var outputDir = 'public';
Expand All @@ -24,6 +25,9 @@ module.exports = {
extensions: ['', '.ts', '.component.ts', '.service.ts', '.js', '.component.html', '.component.less', '.less', '.css']
},
module: {
preLoaders: [
{ test: /\.ts$/, loader: 'tslint' }
],
loaders: [
{ test: /(\.component|\.service|)\.ts$/, loader: 'ts-loader'},
{ test: /\.component\.html$/, loader: 'raw' },
Expand All @@ -50,6 +54,9 @@ module.exports = {
new HtmlWebpackPlugin({
template: path.resolve(srcDir, 'index.html'),
inject: true
}),
new OptimizeJsPlugin({
sourceMap: false
})
]
};

0 comments on commit 8379d66

Please sign in to comment.