Skip to content

Commit

Permalink
Scripts: Add missing root flag to the default Eslint config (#13483)
Browse files Browse the repository at this point in the history
* Scripts: Add missing root flag to the default Eslint config

* scripts: Instruct ESLint to avoid config discovery in defaulting
  • Loading branch information
gziolo authored and youknowriad committed Mar 6, 2019
1 parent 70f4a10 commit a052b3f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
4 changes: 4 additions & 0 deletions packages/scripts/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions packages/scripts/config/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
module.exports = {
root: true,
extends: [ 'plugin:@wordpress/eslint-plugin/recommended' ],
};
5 changes: 4 additions & 1 deletion packages/scripts/scripts/lint-js.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit a052b3f

Please sign in to comment.