Skip to content

Commit 69ecce9

Browse files
committed
Removing deprecated Encore.enableEslintLoader()
1 parent 993e364 commit 69ecce9

File tree

11 files changed

+4
-516
lines changed

11 files changed

+4
-516
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ which you may have installed to enable extra features:
3636
* `stylus-loader` Minimum version increased from `3` to `6` [CHANGELOG](https://github.com/webpack-contrib/stylus-loader/blob/master/CHANGELOG.md#400-2020-09-29)
3737
* `vue-loader` Minimum version increased from `16` to `17` [CHANGELOG](https://github.com/vuejs/vue-loader/blob/next/CHANGELOG.md#1700-2021-12-12)
3838

39+
* Removed `Encore.enableEslintLoader()`: use `Encore.enableEslintPlugin()`.
40+
3941
## [v1.8.2](https://github.com/symfony/webpack-encore/releases/tag/v1.8.2)
4042

4143
*Mar 17th, 2022*

index.js

Lines changed: 2 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1260,53 +1260,6 @@ class Encore {
12601260
return this;
12611261
}
12621262

1263-
/**
1264-
* If enabled, the eslint-loader is enabled.
1265-
*
1266-
* https://github.com/MoOx/eslint-loader
1267-
*
1268-
* ```
1269-
* // enables the eslint loaded using the default eslint configuration.
1270-
* Encore.enableEslintLoader();
1271-
*
1272-
* // You can also pass in an object of options
1273-
* // that will be passed on to the eslint-loader
1274-
* Encore.enableEslintLoader({
1275-
* emitWarning: false
1276-
* });
1277-
*
1278-
* // For a more advanced usage you can pass in a callback
1279-
* // https://github.com/webpack-contrib/eslint-loader#options
1280-
* Encore.enableEslintLoader((options) => {
1281-
* options.extends = 'airbnb';
1282-
* options.emitWarning = false;
1283-
* });
1284-
*
1285-
* // configure Encore-specific options
1286-
* Encore.enableEslintLoader(() => {}, {
1287-
* // set optional Encore-specific options, for instance:
1288-
*
1289-
* // lint `.vue` files
1290-
* lintVue: true
1291-
* });
1292-
* ```
1293-
*
1294-
* Supported options:
1295-
* * {boolean} lintVue (default=false)
1296-
* Configure the loader to lint `.vue` files
1297-
* ```
1298-
*
1299-
* @deprecated Prefer using "Encore.enableEslintPlugin()" instead.
1300-
* @param {string|object|function} eslintLoaderOptionsOrCallback
1301-
* @param {object} encoreOptions
1302-
* @returns {Encore}
1303-
*/
1304-
enableEslintLoader(eslintLoaderOptionsOrCallback = () => {}, encoreOptions = {}) {
1305-
webpackConfig.enableEslintLoader(eslintLoaderOptionsOrCallback, encoreOptions);
1306-
1307-
return this;
1308-
}
1309-
13101263
/**
13111264
* If enabled, the eslint-webpack-plugin is enabled.
13121265
*
@@ -1546,15 +1499,11 @@ class Encore {
15461499
*
15471500
* https://webpack.js.org/concepts/loaders/#configuration
15481501
*
1549-
* For example, if you are using Vue and ESLint loader,
1550-
* this is how you can configure ESLint to lint Vue files:
1551-
*
15521502
* ```
15531503
* Encore
1554-
* .enableEslintLoader()
15551504
* .enableVueLoader()
1556-
* .configureLoaderRule('eslint', (loaderRule) => {
1557-
* loaderRule.test = /\.(jsx?|vue)/;
1505+
* .configureLoaderRule('vue', (loaderRule) => {
1506+
* // some custom config for vue-loader
15581507
* });
15591508
* ```
15601509
*

lib/WebpackConfig.js

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,6 @@ class WebpackConfig {
119119
this.useReact = false;
120120
this.usePreact = false;
121121
this.useVueLoader = false;
122-
this.useEslintLoader = false;
123122
this.useEslintPlugin = false;
124123
this.useTypeScriptLoader = false;
125124
this.useForkedTypeScriptTypeChecking = false;
@@ -151,9 +150,6 @@ class WebpackConfig {
151150
version: null,
152151
runtimeCompilerBuild: null
153152
};
154-
this.eslintOptions = {
155-
lintVue: false,
156-
};
157153
this.persistentCacheBuildDependencies = {};
158154

159155
// Features/Loaders options callbacks
@@ -171,7 +167,6 @@ class WebpackConfig {
171167
this.watchOptionsConfigurationCallback = () => {};
172168
this.devServerOptionsConfigurationCallback = () => {};
173169
this.vueLoaderOptionsCallback = () => {};
174-
this.eslintLoaderOptionsCallback = () => {};
175170
this.eslintPluginOptionsCallback = () => {};
176171
this.tsConfigurationCallback = () => {};
177172
this.handlebarsConfigurationCallback = () => {};
@@ -804,46 +799,7 @@ class WebpackConfig {
804799
}
805800
}
806801

807-
enableEslintLoader(eslintLoaderOptionsOrCallback = () => {}, eslintOptions = {}) {
808-
logger.deprecation('Encore.enableEslintLoader() is deprecated, please use Encore.enableEslintPlugin() instead.');
809-
810-
if (this.useEslintPlugin) {
811-
throw new Error('Encore.enableEslintLoader() can not be called when Encore.enableEslintPlugin() has been called.');
812-
}
813-
814-
this.useEslintLoader = true;
815-
816-
if (typeof eslintLoaderOptionsOrCallback === 'function') {
817-
this.eslintLoaderOptionsCallback = eslintLoaderOptionsOrCallback;
818-
} else if (typeof eslintLoaderOptionsOrCallback === 'string') {
819-
logger.deprecation('enableEslintLoader: Extending from a configuration is deprecated, please use a configuration file instead. See https://eslint.org/docs/user-guide/configuring for more information.');
820-
821-
this.eslintLoaderOptionsCallback = (options) => {
822-
options.extends = eslintLoaderOptionsOrCallback;
823-
};
824-
} else if (typeof eslintLoaderOptionsOrCallback === 'object') {
825-
this.eslintLoaderOptionsCallback = (options) => {
826-
Object.assign(options, eslintLoaderOptionsOrCallback);
827-
};
828-
} else {
829-
throw new Error('Argument 1 to enableEslintLoader() must be either a string, object or callback function.');
830-
}
831-
832-
// Check allowed keys
833-
for (const key of Object.keys(eslintOptions)) {
834-
if (!(key in this.eslintOptions)) {
835-
throw new Error(`"${key}" is not a valid key for enableEslintLoader(). Valid keys: ${Object.keys(this.eslintOptions).join(', ')}.`);
836-
}
837-
}
838-
839-
this.eslintOptions = eslintOptions;
840-
}
841-
842802
enableEslintPlugin(eslintPluginOptionsOrCallback = () => {}) {
843-
if (this.useEslintLoader) {
844-
throw new Error('Encore.enableEslintPlugin() can not be called when Encore.enableEslintLoader() has been called.');
845-
}
846-
847803
this.useEslintPlugin = true;
848804

849805
if (typeof eslintPluginOptionsOrCallback === 'function') {

lib/config-generator.js

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ const babelLoaderUtil = require('./loaders/babel');
2222
const tsLoaderUtil = require('./loaders/typescript');
2323
const vueLoaderUtil = require('./loaders/vue');
2424
const handlebarsLoaderUtil = require('./loaders/handlebars');
25-
const eslintLoaderUtil = require('./loaders/eslint');
2625
// plugins utils
2726
const miniCssExtractPluginUtil = require('./plugins/mini-css-extract');
2827
const deleteUnusedEntriesPluginUtil = require('./plugins/delete-unused-entries');
@@ -400,16 +399,6 @@ class ConfigGenerator {
400399
}));
401400
}
402401

403-
if (this.webpackConfig.useEslintLoader) {
404-
rules.push(applyRuleConfigurationCallback('eslint', {
405-
test: eslintLoaderUtil.getTest(this.webpackConfig),
406-
loader: require.resolve('eslint-loader'), //eslint-disable-line node/no-unpublished-require
407-
exclude: /node_modules/,
408-
enforce: 'pre',
409-
options: eslintLoaderUtil.getOptions(this.webpackConfig)
410-
}));
411-
}
412-
413402
if (this.webpackConfig.useTypeScriptLoader) {
414403
rules.push(applyRuleConfigurationCallback('typescript', {
415404
test: /\.tsx?$/,

lib/features.js

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -117,15 +117,6 @@ const features = {
117117
],
118118
description: 'use Vue with JSX support'
119119
},
120-
eslint: {
121-
method: 'enableEslintLoader()',
122-
// eslint is needed so the end-user can do things
123-
packages: [
124-
{ name: 'eslint' },
125-
{ name: 'eslint-loader', enforce_version: true },
126-
],
127-
description: 'Enable ESLint checks'
128-
},
129120
eslint_plugin: {
130121
method: 'enableEslintPlugin()',
131122
// eslint is needed so the end-user can do things

lib/loaders/eslint.js

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

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@
7070
"chai-subset": "^1.6.0",
7171
"core-js": "^3.0.0",
7272
"eslint": "^8.0.0",
73-
"eslint-loader": "^4.0.0",
7473
"eslint-plugin-header": "^3.0.0",
7574
"eslint-plugin-import": "^2.8.0",
7675
"eslint-plugin-node": "^11.1.0",

test/WebpackConfig.js

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1549,37 +1549,6 @@ describe('WebpackConfig object', () => {
15491549
});
15501550
});
15511551

1552-
describe('enableEslintLoader', () => {
1553-
it('Should validate Encore-specific options', () => {
1554-
const config = createConfig();
1555-
1556-
expect(() => {
1557-
config.enableEslintLoader(() => {}, {
1558-
notExisting: false,
1559-
});
1560-
}).to.throw('"notExisting" is not a valid key for enableEslintLoader(). Valid keys: lintVue.');
1561-
});
1562-
1563-
it('ESLint loader can not be enabled if ESLint Webpack Plugin is already enabled', () => {
1564-
const config = createConfig();
1565-
config.enableEslintPlugin();
1566-
1567-
expect(function() {
1568-
config.enableEslintLoader();
1569-
}).to.throw('Encore.enableEslintLoader() can not be called when Encore.enableEslintPlugin() has been called.');
1570-
});
1571-
});
1572-
describe('enableEslintPlugin', () => {
1573-
it('ESLint loader can not be enabled if ESLint Webpack Plugin is already enabled', () => {
1574-
const config = createConfig();
1575-
config.enableEslintLoader();
1576-
1577-
expect(function() {
1578-
config.enableEslintPlugin();
1579-
}).to.throw('Encore.enableEslintPlugin() can not be called when Encore.enableEslintLoader() has been called.');
1580-
});
1581-
});
1582-
15831552
describe('validateNameIsNewEntry', () => {
15841553
it('Providing a new name does not throw an error', () => {
15851554
const config = createConfig();

0 commit comments

Comments
 (0)