Skip to content

Commit

Permalink
Ignore stylesheet imports when linting for side effects
Browse files Browse the repository at this point in the history
  • Loading branch information
talldan committed Apr 30, 2019
1 parent 6a56dda commit 9eea50b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/eslint-plugin/rules/package-side-effects.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,16 @@ module.exports = {

return {
ImportDeclaration( node ) {
// Only lint imports that don't specify variable names.
if ( node.specifiers && node.specifiers.length ) {
return;
}

// Ignore stylesheet imports.
if ( /\.scss$/.test( node.source.value ) ) {
return;
}

context.report(
node,
`Import of module may introduce package level side-effects. Consider adding '${ relativeFilePath }' to the package's package.json sideEffect property.`
Expand Down

0 comments on commit 9eea50b

Please sign in to comment.