Skip to content

Commit 52ac365

Browse files
authored
chore(lint): fix linter settings (#467)
This narrows down to a single eslint configuration and fixes existing linter issues. This also updates to the latest webpack-contrib eslint recommendations. Fixes N/A
1 parent 6369729 commit 52ac365

File tree

7 files changed

+15
-33
lines changed

7 files changed

+15
-33
lines changed

.eslintignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
lib/*
21
/node_modules
32
/dist

.eslintrc

Lines changed: 0 additions & 19 deletions
This file was deleted.

.eslintrc.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,16 @@ module.exports = {
33
plugins: ['prettier'],
44
extends: ['@webpack-contrib/eslint-config-webpack'],
55
rules: {
6+
"consistent-return": "off",
7+
"no-console": "off",
8+
"no-param-reassign": "off",
9+
"no-underscore-dangle": "off",
10+
"prefer-destructuring": ["error", {"object": false, "array": false}],
11+
"prefer-rest-params": "off",
12+
"strict": ["error", "safe"],
613
'prettier/prettier': [
714
'error',
815
{ singleQuote: true, trailingComma: 'es5', arrowParens: 'always' },
916
],
1017
},
11-
};
18+
};

lib/KarmaWebpackController.js

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
/* eslint-disable no-console */
2-
31
const path = require('path');
42
const fs = require('fs');
53
const os = require('os');
@@ -21,12 +19,10 @@ class KarmaSyncPlugin {
2119
// read generated file content and store for karma preprocessor
2220
this.controller.bundlesContent = {};
2321
stats.toJson().assets.forEach((webpackFileObj) => {
24-
const filePath = `${compiler.options.output.path}/${
25-
webpackFileObj.name
26-
}`;
22+
const filePath = `${compiler.options.output.path}/${webpackFileObj.name}`;
2723
this.controller.bundlesContent[webpackFileObj.name] = fs.readFileSync(
2824
filePath,
29-
'utf-8',
25+
'utf-8'
3026
);
3127
});
3228

@@ -88,7 +84,7 @@ class KarmaWebpackController {
8884
new KarmaSyncPlugin({
8985
karmaEmitter: emitter,
9086
controller: this,
91-
}),
87+
})
9288
);
9389
}
9490

@@ -135,13 +131,13 @@ class KarmaWebpackController {
135131
if (this.webpackOptions.watch === true) {
136132
console.log('Webpack starts watching...');
137133
this.compiler = webpack(this.webpackOptions, (err, stats) =>
138-
this.handleBuildResult(err, stats, resolve),
134+
this.handleBuildResult(err, stats, resolve)
139135
);
140136

141137
this.setupExitHandler(this.compiler);
142138
} else {
143139
this.compiler = webpack(this.webpackOptions).run((err, stats) =>
144-
this.handleBuildResult(err, stats, resolve),
140+
this.handleBuildResult(err, stats, resolve)
145141
);
146142
}
147143
});

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
"@commitlint/cli": "^7.1.1",
4545
"@commitlint/config-conventional": "^7.1.1",
4646
"@webpack-contrib/defaults": "^2.5.0",
47-
"@webpack-contrib/eslint-config-webpack": "^2.0.4",
47+
"@webpack-contrib/eslint-config-webpack": "^3.0.0",
4848
"babel-cli": "^6.26.0",
4949
"babel-jest": "^23.4.2",
5050
"babel-plugin-transform-object-rest-spread": "^6.26.0",

test/integration/scenarios/basic-setup/basic-setup.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ describe('A basic karma-webpack setup', () => {
2929
plugins: [karmaWebpack, karmaChromeLauncher, karmaMocha, karmaChai],
3030
port: 2389,
3131
logLevel: 'ERROR',
32-
singleRun: true,
32+
singleRun: true
3333
};
3434

3535
beforeAll((done) => {

test/integration/utils/ScenarioUtils.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* eslint-disable no-console */
21
const karma = require('karma');
32

43
const ScenarioUtils = { run };

0 commit comments

Comments
 (0)