Skip to content

Commit 5d00631

Browse files
committed
jshint-loader + babel-loader work together
1 parent fab01d4 commit 5d00631

File tree

3 files changed

+23
-47
lines changed

3 files changed

+23
-47
lines changed

.jshintrc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"nonew": true,
1414
"quotmark": true,
1515
"smarttabs": true,
16-
"strict": true,
16+
"strict": false,
1717
"sub": true,
1818
"trailing": true,
1919
"undef": true,

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
"concurrently": "^3.5.0",
3535
"copy-webpack-plugin": "^4.2.0",
3636
"jasmine-core": "^2.8.0",
37-
"jshint": "^2.9.5",
37+
"jshint": "^2.5.0",
3838
"jshint-loader": "^0.8.4",
3939
"karma": "^1.7.1",
4040
"karma-chrome-launcher": "^2.2.0",

webpack/config.js

Lines changed: 21 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,6 @@ const getBanner = function (compressing) {
1414

1515
const ENV = (process.env.npm_lifecycle_event.indexOf('dev') === 0) ? 'development' : 'production';
1616

17-
_loaders = [{
18-
test: /\.js$/,
19-
exclude: /node_modules/,
20-
loader: 'babel-loader?presets[]=es2015'
21-
}, {
22-
test: [/\.\.\/src\/*\.js$/, /\.\.\/src\/modules\/*\.js$/],
23-
exclude: /node_modules/,
24-
enforce: 'pre',
25-
loader: 'jshint-loader',
26-
options: Object.assign({}, require('../.jshintrc.json'), require('../src/.jshintrc.json'))
27-
}];
28-
2917
let configEnv = {};
3018

3119
if (ENV === 'development') {
@@ -36,34 +24,6 @@ if (ENV === 'development') {
3624

3725
entry: {},
3826

39-
module: {
40-
loaders: [..._loaders, {
41-
test: /\.\.\/test\/*Spec\.js$/,
42-
exclude: /node_modules/,
43-
enforce: 'pre',
44-
loader: 'jshint-loader',
45-
options: Object.assign({}, require('../.jshintrc.json'), {
46-
node: true,
47-
globals: {
48-
angular: false,
49-
inject: false,
50-
jQuery: false,
51-
jasmine: false,
52-
afterEach: false,
53-
beforeEach: false,
54-
ddescribe: false,
55-
describe: false,
56-
expect: false,
57-
iit: false,
58-
it: false,
59-
spyOn: false,
60-
xdescribe: false,
61-
xit: false
62-
}
63-
})
64-
}
65-
]},
66-
6727
plugins: [],
6828

6929
watch: true
@@ -81,10 +41,6 @@ if (ENV === 'production') {
8141
'ui-scroll-grid.min': path.resolve(__dirname, '../src/ui-scroll-grid.js')
8242
},
8343

84-
module: {
85-
loaders: _loaders
86-
},
87-
8844
plugins: [
8945
new webpack.optimize.UglifyJsPlugin({
9046
sourceMap: true,
@@ -121,7 +77,27 @@ module.exports = {
12177

12278
devtool: 'source-map',
12379

124-
module: configEnv.module,
80+
module: {
81+
rules: [
82+
{
83+
test: /\.js$/,
84+
exclude: /node_modules/,
85+
loader: 'babel-loader',
86+
options: {
87+
presets: ['es2015']
88+
}
89+
},
90+
{
91+
enforce: 'pre',
92+
test: /\.js$/,
93+
include: path.resolve(__dirname, '../src'),
94+
use: [{
95+
loader: "jshint-loader",
96+
options: require(path.resolve(__dirname, '../.jshintrc.json'))
97+
}]
98+
}
99+
]
100+
},
125101

126102
resolve: {
127103
extensions: ['.js'],

0 commit comments

Comments
 (0)