diff --git a/packages/scripts/CHANGELOG.md b/packages/scripts/CHANGELOG.md index 40210edd4b139..9e297b5b652d2 100644 --- a/packages/scripts/CHANGELOG.md +++ b/packages/scripts/CHANGELOG.md @@ -5,6 +5,10 @@ - Added support for `build` script ([#12837](https://github.com/WordPress/gutenberg/pull/12837)) - Added support for `start` script ([#12837](https://github.com/WordPress/gutenberg/pull/12837)) +### Bug Fix + +- Avoid inheriting from ESLint configurations in ancestor directories when using the default configuration ([#13483](https://github.com/WordPress/gutenberg/pull/13483)) + ## 2.5.0 (2019-01-09) ### New Features diff --git a/packages/scripts/config/.eslintrc.js b/packages/scripts/config/.eslintrc.js index 5b59ed86f4d2e..4fa347677ff52 100644 --- a/packages/scripts/config/.eslintrc.js +++ b/packages/scripts/config/.eslintrc.js @@ -1,3 +1,4 @@ module.exports = { + root: true, extends: [ 'plugin:@wordpress/eslint-plugin/recommended' ], }; diff --git a/packages/scripts/scripts/lint-js.js b/packages/scripts/scripts/lint-js.js index 64b6cb2036ffc..c7346fb76ad88 100644 --- a/packages/scripts/scripts/lint-js.js +++ b/packages/scripts/scripts/lint-js.js @@ -26,8 +26,11 @@ const hasLintConfig = hasCliArg( '-c' ) || hasProjectFile( '.eslintrc' ) || hasPackageProp( 'eslintConfig' ); +// When a configuration is not provided by the project, use from the default +// provided with the scripts module. Instruct ESLint to avoid discovering via +// the `--no-eslintrc` flag, as otherwise it will still merge with inherited. const config = ! hasLintConfig ? - [ '--config', fromConfigRoot( '.eslintrc.js' ) ] : + [ '--no-eslintrc', '--config', fromConfigRoot( '.eslintrc.js' ) ] : []; const result = spawn(