Skip to content

Commit

Permalink
Merge pull request #214 from jasonkarns/xdg-cache
Browse files Browse the repository at this point in the history
  • Loading branch information
feross authored Oct 27, 2020
2 parents f6c3762 + 1a9c851 commit afa026f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
6 changes: 3 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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,
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@
"deglob": "^4.0.1",
"get-stdin": "^8.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",
Expand Down

0 comments on commit afa026f

Please sign in to comment.