Skip to content

Commit 9f24246

Browse files
committed
feature #774 feat: add support for ESLint 7, drop support ESLint 5 (Kocal)
This PR was squashed before being merged into the main branch. Discussion ---------- feat: add support for ESLint 7, drop support ESLint 5 - bump eslint from `^5.15.2 || ^6.0.0` to `^6.0.0 || ^7.0.0`: https://eslint.org/blog/2020/05/eslint-v7.0.0-released - bump eslint-loader from `^3.0.0` to `^4.0.0`, which drop support for Node <10.13.0 and set minimum ESLint support to version 6: https://github.com/webpack-contrib/eslint-loader/blob/master/CHANGELOG.md#400-2020-04-03 - had to fix some linting issues **EDIT:** Ok so ESLint 7 is not compatible with Node 11. This version is in end of life ([End-of-Life releasese](https://github.com/nodejs/Release#end-of-life-releases), should we drop support for Node 11 too? And maybe add support for Node 13 and Node 14? WDYT? **EDIT 2:** PR opened at #775 **EDIT 3:** PR rebased since #775 has been merged Commits ------- 5a1cfb6 feat: add support for ESLint 7, drop support ESLint 5
2 parents 65e2b64 + 5a1cfb6 commit 9f24246

File tree

5 files changed

+199
-78
lines changed

5 files changed

+199
-78
lines changed

.eslintrc.js

+20-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
/*
2+
* This file is part of the Symfony Webpack Encore package.
3+
*
4+
* (c) Fabien Potencier <[email protected]>
5+
*
6+
* For the full copyright and license information, please view the LICENSE
7+
* file that was distributed with this source code.
8+
*/
9+
110
module.exports = {
211
"root": true,
312
"plugins": ["node", "header"],
@@ -39,7 +48,7 @@ module.exports = {
3948
"after": true
4049
}],
4150
"no-console": "off",
42-
"valid-jsdoc": ["error", {"requireParamDescription": false, "requireReturnDescription": false}],
51+
"valid-jsdoc": ["error", { "requireParamDescription": false, "requireReturnDescription": false }],
4352
"node/no-unsupported-features": ["error", { version: 8 }],
4453
"node/no-deprecated-api": "error",
4554
"node/no-missing-import": "error",
@@ -54,6 +63,14 @@ module.exports = {
5463
"node/no-unpublished-bin": "error",
5564
"node/no-unpublished-require": "error",
5665
"node/process-exit-as-throw": "error",
57-
"header/header": [2, "block", {"pattern": "This file is part of the Symfony Webpack Encore package"}]
58-
}
66+
"header/header": [2, "block", { "pattern": "This file is part of the Symfony Webpack Encore package" }]
67+
},
68+
"overrides": [
69+
{
70+
"files": [".eslintrc.js"],
71+
"rules": {
72+
"quotes": ["error", "double"],
73+
},
74+
}
75+
],
5976
};

lib/loaders/eslint.js

+1-8
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
const WebpackConfig = require('../WebpackConfig'); //eslint-disable-line no-unused-vars
1313
const loaderFeatures = require('../features');
1414
const applyOptionsCallback = require('../utils/apply-options-callback');
15-
const logger = require('../logger');
1615

1716
function isMissingConfigError(e) {
1817
if (!e.message || !e.message.includes('No ESLint configuration found')) {
@@ -36,13 +35,7 @@ module.exports = {
3635
});
3736

3837
try {
39-
if (typeof engine.getConfigForFile === 'function') {
40-
logger.debug('Checking ESLint 6+ configuration...');
41-
engine.getConfigForFile('webpack.config.js');
42-
} else {
43-
logger.debug('Checking ESLint 5 configuration...');
44-
engine.config.getConfigHierarchy(webpackConfig.runtimeConfig.context);
45-
}
38+
engine.getConfigForFile('webpack.config.js');
4639
} catch (e) {
4740
if (isMissingConfigError(e)) {
4841
const chalk = require('chalk');

package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"main": "index.js",
66
"scripts": {
77
"test": "mocha --reporter spec test --recursive",
8-
"lint": "eslint lib test index.js",
8+
"lint": "eslint lib test index.js .eslintrc.js",
99
"travis:lint": "npm run lint"
1010
},
1111
"bin": {
@@ -72,8 +72,8 @@
7272
"chai-fs": "^2.0.0",
7373
"chai-subset": "^1.6.0",
7474
"core-js": "^3.0.0",
75-
"eslint": "^5.15.2 || ^6.0.0",
76-
"eslint-loader": "^3.0.0",
75+
"eslint": "^6.0.0 || ^7.0.0",
76+
"eslint-loader": "^4.0.0",
7777
"eslint-plugin-header": "^1.0.0",
7878
"eslint-plugin-import": "^2.8.0",
7979
"eslint-plugin-node": "^8.0.1",

test/.eslintrc.js

+9
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
/*
2+
* This file is part of the Symfony Webpack Encore package.
3+
*
4+
* (c) Fabien Potencier <[email protected]>
5+
*
6+
* For the full copyright and license information, please view the LICENSE
7+
* file that was distributed with this source code.
8+
*/
9+
110
module.exports = {
211
"env": {
312
"node": true,

0 commit comments

Comments
 (0)