Skip to content

Commit

Permalink
feat: add support for ESLint 7, drop support ESLint 5
Browse files Browse the repository at this point in the history
  • Loading branch information
Kocal authored and weaverryan committed Dec 3, 2020
1 parent e4ccb9c commit 5a1cfb6
Show file tree
Hide file tree
Showing 5 changed files with 199 additions and 78 deletions.
23 changes: 20 additions & 3 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
/*
* This file is part of the Symfony Webpack Encore package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

module.exports = {
"root": true,
"plugins": ["node", "header"],
Expand Down Expand Up @@ -39,7 +48,7 @@ module.exports = {
"after": true
}],
"no-console": "off",
"valid-jsdoc": ["error", {"requireParamDescription": false, "requireReturnDescription": false}],
"valid-jsdoc": ["error", { "requireParamDescription": false, "requireReturnDescription": false }],
"node/no-unsupported-features": ["error", { version: 8 }],
"node/no-deprecated-api": "error",
"node/no-missing-import": "error",
Expand All @@ -54,6 +63,14 @@ module.exports = {
"node/no-unpublished-bin": "error",
"node/no-unpublished-require": "error",
"node/process-exit-as-throw": "error",
"header/header": [2, "block", {"pattern": "This file is part of the Symfony Webpack Encore package"}]
}
"header/header": [2, "block", { "pattern": "This file is part of the Symfony Webpack Encore package" }]
},
"overrides": [
{
"files": [".eslintrc.js"],
"rules": {
"quotes": ["error", "double"],
},
}
],
};
9 changes: 1 addition & 8 deletions lib/loaders/eslint.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
const WebpackConfig = require('../WebpackConfig'); //eslint-disable-line no-unused-vars
const loaderFeatures = require('../features');
const applyOptionsCallback = require('../utils/apply-options-callback');
const logger = require('../logger');

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

try {
if (typeof engine.getConfigForFile === 'function') {
logger.debug('Checking ESLint 6+ configuration...');
engine.getConfigForFile('webpack.config.js');
} else {
logger.debug('Checking ESLint 5 configuration...');
engine.config.getConfigHierarchy(webpackConfig.runtimeConfig.context);
}
engine.getConfigForFile('webpack.config.js');
} catch (e) {
if (isMissingConfigError(e)) {
const chalk = require('chalk');
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"main": "index.js",
"scripts": {
"test": "mocha --reporter spec test --recursive",
"lint": "eslint lib test index.js",
"lint": "eslint lib test index.js .eslintrc.js",
"travis:lint": "npm run lint"
},
"bin": {
Expand Down Expand Up @@ -67,8 +67,8 @@
"chai-fs": "^2.0.0",
"chai-subset": "^1.6.0",
"core-js": "^3.0.0",
"eslint": "^5.15.2 || ^6.0.0",
"eslint-loader": "^3.0.0",
"eslint": "^6.0.0 || ^7.0.0",
"eslint-loader": "^4.0.0",
"eslint-plugin-header": "^1.0.0",
"eslint-plugin-import": "^2.8.0",
"eslint-plugin-node": "^8.0.1",
Expand Down
9 changes: 9 additions & 0 deletions test/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
/*
* This file is part of the Symfony Webpack Encore package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

module.exports = {
"env": {
"node": true,
Expand Down
Loading

0 comments on commit 5a1cfb6

Please sign in to comment.