diff --git a/index.js b/index.js index 2473976..470b905 100644 --- a/index.js +++ b/index.js @@ -7,7 +7,7 @@ var os = require('os') var path = require('path') var pkgConf = require('pkg-conf') -var HOME_OR_TMP = os.homedir() || os.tmpdir() +var CACHE_HOME = require('xdg-basedir').cache || os.tmpdir() var DEFAULT_PATTERNS = [ '**/*.js', @@ -38,8 +38,8 @@ function Linter (opts) { var m = opts.version && opts.version.match(/^(\d+)\./) var majorVersion = (m && m[1]) || '0' - // Example cache location: .standard-v12-cache/ - var cacheLocation = path.join(HOME_OR_TMP, `.${this.cmd}-v${majorVersion}-cache/`) + // Example cache location: ~/.cache/standard/v12/ + var cacheLocation = path.join(CACHE_HOME, this.cmd, `v${majorVersion}/`) this.eslintConfig = Object.assign({ cache: true, diff --git a/package.json b/package.json index b1260cc..9cabfe5 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,8 @@ "deglob": "^4.0.1", "get-stdin": "^7.0.0", "minimist": "^1.2.5", - "pkg-conf": "^3.1.0" + "pkg-conf": "^3.1.0", + "xdg-basedir": "^4.0.0" }, "devDependencies": { "babel-eslint": "^10.1.0",