From 97aa9b7fdb0dee4464162664d677cf5858011b4b Mon Sep 17 00:00:00 2001 From: Jason Karns Date: Mon, 4 May 2020 10:25:45 -0400 Subject: [PATCH 1/3] Adds xdg-basedir dep --- package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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", From 0c920fa857306bebc062eba0b1fe9771d1c44959 Mon Sep 17 00:00:00 2001 From: Jason Karns Date: Fri, 20 Mar 2020 12:41:14 -0400 Subject: [PATCH 2/3] Respect XDG Basedir Spec for cache location --- index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 2473976..3a7f8fe 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', @@ -39,7 +39,7 @@ function Linter (opts) { var majorVersion = (m && m[1]) || '0' // Example cache location: .standard-v12-cache/ - var cacheLocation = path.join(HOME_OR_TMP, `.${this.cmd}-v${majorVersion}-cache/`) + var cacheLocation = path.join(CACHE_HOME, this.cmd, `v${majorVersion}/`) this.eslintConfig = Object.assign({ cache: true, From 1a9c85107e0f1270c49d5a79ae1e612cd88911e0 Mon Sep 17 00:00:00 2001 From: Jason Karns Date: Mon, 4 May 2020 10:21:14 -0400 Subject: [PATCH 3/3] Update index.js MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Linus Unnebäck --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 3a7f8fe..470b905 100644 --- a/index.js +++ b/index.js @@ -38,7 +38,7 @@ function Linter (opts) { var m = opts.version && opts.version.match(/^(\d+)\./) var majorVersion = (m && m[1]) || '0' - // Example cache location: .standard-v12-cache/ + // Example cache location: ~/.cache/standard/v12/ var cacheLocation = path.join(CACHE_HOME, this.cmd, `v${majorVersion}/`) this.eslintConfig = Object.assign({