Skip to content

Instantly share code, notes, and snippets.

@isaacs
Created August 26, 2021 18:07
Show Gist options
  • Save isaacs/047b22aa5bc76cec87f2f45445b3e127 to your computer and use it in GitHub Desktop.
Save isaacs/047b22aa5bc76cec87f2f45445b3e127 to your computer and use it in GitHub Desktop.
diff --cc lib/setup.js
index ebf498b,159dbda..0000000
--- a/lib/setup.js
+++ b/lib/setup.js
@@@ -1,9 -1,9 +1,16 @@@
#!/usr/bin/env node
const { resolve } = require('path')
+const cwd = process.cwd()
const { readdirSync, writeFileSync, existsSync } = require('fs')
++<<<<<<< Updated upstream
+const pjFile = resolve(cwd, 'package.json')
++||||||| constructed merge base
++const pjFile = resolve(process.cwd(), 'package.json')
++=======
+ const cwd = process.cwd()
+ const pjFile = resolve(cwd, 'package.json')
++>>>>>>> Stashed changes
const getPkg = () => {
try {
return require(pjFile)
@@@ -19,19 -19,15 +26,39 @@@ const force = process.argv.includes('--
pkg.scripts = pkg.scripts || {}
const { scripts } = pkg
const lintFiles = []
++<<<<<<< Updated upstream
const entries = readdirSync(cwd)
+if (entries.some(f => /\.[cm]?js$/.test(f))) {
++||||||| constructed merge base
++const entries = readdirSync('.')
+ if (entries.some(f => /\.[cm]?js$/.test(f)))
++=======
++const entries = readdirSync(cwd)
++if (entries.some(f => /\.[cm]?js$/.test(f)))
++>>>>>>> Stashed changes
lintFiles.push('"*.*js"')
++<<<<<<< Updated upstream
+}
+if (existsSync(resolve(cwd, 'lib'))) {
++||||||| constructed merge base
++if (existsSync('lib'))
++=======
+ if (existsSync(resolve(cwd, 'lib')))
++>>>>>>> Stashed changes
lintFiles.push('"lib/**/*.*js"')
++<<<<<<< Updated upstream
+}
+if (existsSync(resolve(cwd, 'test')) && lintFiles.length) {
++||||||| constructed merge base
++if (existsSync('test') && lintFiles.length)
++=======
+ if (existsSync(resolve(cwd, 'test')) && lintFiles.length)
++>>>>>>> Stashed changes
lintFiles.push('"test/**/*.*js"')
-if (!lintFiles.length)
+}
+if (!lintFiles.length) {
lintFiles.push('"*.*js" "lib/**/*.*js" "test/**/*.*js"')
+}
const additions = {
npmclilint: 'npmcli-lint',
diff --git a/lib/index.js b/lib/index.js
index 0bf91c1..70b9cbf 100644
--- a/lib/index.js
+++ b/lib/index.js
@@ -6,4 +6,4 @@ const { resolve } = require('path')
const eslintrc = resolve(__dirname, './.eslintrc.json')
const args = ['-c', eslintrc, ...process.argv.slice(2)]
const result = spawnSync(whichSync('eslint'), args, { stdio: 'inherit' })
-process.exitCode = result.exitCode
+process.exitCode = result.status
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment