diff --git a/remove-cache.js b/remove-cache.js index 56b3a0c..cc2b5cc 100644 --- a/remove-cache.js +++ b/remove-cache.js @@ -1,12 +1,14 @@ /* eslint-disable no-console */ const fs = require('fs'); const path = require('path'); - -const cache = path.join(process.cwd(), '.eslintcache'); +const findRoot = require('find-root'); try { - fs.unlinkSync(cache); - console.log('removed .eslintcache'); + const root = findRoot(process.env.INIT_CWD || process.cwd()); + const cachePath = path.join(root, '.eslintcache'); + + fs.unlinkSync(cachePath); + console.log(`removed ${cachePath}`); } catch (e) { // file doesn't exist or we cannot delete. }