Skip to content

Commit

Permalink
Use cmd and version in cache folder name
Browse files Browse the repository at this point in the history
So for standard, the cache location would be:

  .standard-v12-cache/
  • Loading branch information
feross committed May 10, 2018
1 parent 2b34c67 commit afca0bf
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions index.js
Expand Up @@ -26,21 +26,23 @@ function Linter (opts) {
if (!(this instanceof Linter)) return new Linter(opts)
if (!opts) opts = {}

this.cmd = opts.cmd
if (!this.cmd) throw new Error('opts.cmd option is required')

this.version = opts.version
if (!this.version) throw new Error('opts.version option is required')
if (!opts.cmd) throw new Error('opts.cmd option is required')
if (!opts.eslint) throw new Error('opts.eslint option is required')

this.cmd = opts.cmd
this.eslint = opts.eslint
if (!this.eslint) throw new Error('opts.eslint option is required')

this.cwd = opts.cwd || process.cwd()
this.customParseOpts = opts.parseOpts

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/`)

this.eslintConfig = Object.assign({
cache: true,
cacheLocation: path.join(HOME_OR_TMP, '.standard-cache/'),
cacheLocation: cacheLocation,
envs: [],
fix: false,
globals: [],
Expand Down

0 comments on commit afca0bf

Please sign in to comment.