lint-staged 7.2.1 → 7.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -2
  2. package/src/findBin.js +11 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lint-staged",
3
- "version": "7.2.1",
3
+ "version": "7.2.2",
4
4
  "description": "Lint files staged by git",
5
5
  "license": "MIT",
6
6
  "repository": "https://github.com/okonet/lint-staged",
@@ -28,7 +28,6 @@
28
28
  "test:watch": "jest --watch"
29
29
  },
30
30
  "dependencies": {
31
- "app-root-path": "^2.0.1",
32
31
  "chalk": "^2.3.1",
33
32
  "commander": "^2.14.1",
34
33
  "cosmiconfig": "^5.0.2",
package/src/findBin.js CHANGED
@@ -1,14 +1,22 @@
1
1
  'use strict'
2
2
 
3
3
  const parse = require('string-argv')
4
- const appRoot = require('app-root-path')
5
4
  const npmWhich = require('npm-which')(process.cwd())
6
5
  const checkPkgScripts = require('./checkPkgScripts')
7
6
 
8
- // Find and load the package.json at the root of the project.
9
- const pkg = require(appRoot.resolve('package.json')) // eslint-disable-line import/no-dynamic-require
10
7
  const debug = require('debug')('lint-staged:find-bin')
11
8
 
9
+ // Find and load the package.json at the root of the project.
10
+ let pkg
11
+ try {
12
+ // eslint-disable-next-line import/no-dynamic-require, global-require
13
+ pkg = require(`${process.cwd()}/package.json`)
14
+ debug('Loaded package.json using `process.cwd()`')
15
+ } catch (ignore) {
16
+ debug('Could not load package.json using `process.cwd()`')
17
+ pkg = {}
18
+ }
19
+
12
20
  const cache = new Map()
13
21
 
14
22
  module.exports = function findBin(cmd) {