Skip to content

Commit c828b32

Browse files
committed
Deprecate Encore.enableEslintLoader('extends-name')
1 parent 9f31d95 commit c828b32

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

index.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1070,18 +1070,14 @@ class Encore {
10701070
* // enables the eslint loaded using the default eslint configuration.
10711071
* Encore.enableEslintLoader();
10721072
*
1073-
* // Optionally, you can pass in the configuration eslint should extend.
1074-
* Encore.enableEslintLoader('airbnb');
1075-
*
10761073
* // You can also pass in an object of options
10771074
* // that will be passed on to the eslint-loader
10781075
* Encore.enableEslintLoader({
1079-
* extends: 'airbnb',
10801076
* emitWarning: false
10811077
* });
10821078
*
10831079
* // For a more advanced usage you can pass in a callback
1084-
* // https://github.com/MoOx/eslint-loader#options
1080+
* // https://github.com/webpack-contrib/eslint-loader#options
10851081
* Encore.enableEslintLoader((options) => {
10861082
* options.extends = 'airbnb';
10871083
* options.emitWarning = false;

lib/WebpackConfig.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -686,6 +686,8 @@ class WebpackConfig {
686686
}
687687

688688
if (typeof eslintLoaderOptionsOrCallback === 'string') {
689+
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.');
690+
689691
this.eslintLoaderOptionsCallback = (options) => {
690692
options.extends = eslintLoaderOptionsOrCallback;
691693
};

test/config-generator.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,10 @@ describe('The config-generator function', () => {
372372
});
373373

374374
it('enableEslintLoader("extends-name")', () => {
375+
before(() => {
376+
logger.reset();
377+
});
378+
375379
const config = createConfig();
376380
config.addEntry('main', './main');
377381
config.publicPath = '/';
@@ -380,6 +384,7 @@ describe('The config-generator function', () => {
380384

381385
const actualConfig = configGenerator(config);
382386

387+
expect(JSON.stringify(logger.getMessages().deprecation)).to.contain('enableEslintLoader: Extending from a configuration is deprecated, please use a configuration file instead. See https://eslint.org/docs/user-guide/configuring for more information.');
383388
expect(JSON.stringify(actualConfig.module.rules)).to.contain('eslint-loader');
384389
expect(JSON.stringify(actualConfig.module.rules)).to.contain('extends-name');
385390
});

0 commit comments

Comments
 (0)