Skip to content

Commit

Permalink
fix(eslint): readdirSync breaks if packages does not exist
Browse files Browse the repository at this point in the history
  • Loading branch information
JounQin committed Sep 13, 2019
1 parent 69af24f commit f10c8dd
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions packages/eslint-config/_util.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
const fs = require('fs')
const path = require('path')

exports.identity = function(_) {
return _
}

exports.isMonorepo =
fs.existsSync(path.resolve('lerna.json')) ||
!!require(path.resolve('package.json')).workspaces

exports.allowModules = exports.isMonorepo
? fs
? fs.statSync('packages').isDirectory() &&
fs
.readdirSync('packages')
.map(pkg => require(path.resolve(`packages/${pkg}/package.json`)).name)
: undefined

exports.identity = function(_) {
return _
}

0 comments on commit f10c8dd

Please sign in to comment.