Skip to content

Commit

Permalink
Use config level overrides property to ignore test and benchmark fi…
Browse files Browse the repository at this point in the history
…les instead of condition within rule.
  • Loading branch information
talldan committed Mar 7, 2019
1 parent dfe154c commit 5c0045f
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 11 deletions.
6 changes: 6 additions & 0 deletions packages/eslint-plugin/configs/custom.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,10 @@ module.exports = {
},
],
},
overrides: {
files: [ '**/test/*.js', '**/benchmark/*.js' ],
rules: {
'@wordpress/package-side-effects': 'off',
},
},
};
7 changes: 0 additions & 7 deletions packages/eslint-plugin/rules/package-side-effects.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,6 @@ module.exports = {
},
create( context ) {
const filename = context.getFilename();

// Don't lint files in the test folder (otherwise `describe` is flagged).
// TODO - accept a list of file or function names to ignore as a configuration option.
if ( filename.includes( '/test/' ) ) {
return {};
}

const { pkg: packageJson, path: packageJsonPath } = readPkgUp.sync( { cwd: filename } );

// Unable to find a package.json, so don't lint this file.
Expand Down
2 changes: 0 additions & 2 deletions packages/hooks/benchmark/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* eslint-disable @wordpress/package-side-effects */

const Benchmark = require( 'benchmark' );
const hooks = require( '../' );

Expand Down
2 changes: 0 additions & 2 deletions packages/i18n/benchmark/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* eslint-disable @wordpress/package-side-effects */

const Benchmark = require( 'benchmark' );
const { __ } = require( '../' );

Expand Down
2 changes: 2 additions & 0 deletions packages/is-shallow-equal/test/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* eslint-disable @wordpress/package-side-effects */

/**
* Internal dependencies
*/
Expand Down

0 comments on commit 5c0045f

Please sign in to comment.