ESLint not resolving absolute file path for extends

I’m attempting to get a local eslintrc (in my project root) to extend my global eslintrc (located at ~/.eslintrc).

Here’s the local eslintrc:

{
  "extends": "~/.eslintrc"
}

Here’s the error I’m getting when running eslint foo.js:

Cannot read config file: /Users/cbickel1/dev/learning/webpack-demo/~/.eslintrc
Error: ENOENT: no such file or directory, open '/Users/cbickel1/dev/learning/webpack-demo/~/.eslintrc'
Referenced from: /Users/cbickel1/dev/learning/webpack-demo/.eslintrc
Error: Cannot read config file: /Users/cbickel1/dev/learning/webpack-demo/~/.eslintrc
Error: ENOENT: no such file or directory, open '/Users/cbickel1/dev/learning/webpack-demo/~/.eslintrc'
Referenced from: /Users/cbickel1/dev/learning/webpack-demo/.eslintrc
    at Object.fs.openSync (fs.js:558:18)
    at Object.fs.readFileSync (fs.js:468:33)
    at readFile (/Users/cbickel1/.nvm/versions/node/v7.4.0/lib/node_modules/eslint/lib/config/config-file.js:70:24)
    at loadLegacyConfigFile (/Users/cbickel1/.nvm/versions/node/v7.4.0/lib/node_modules/eslint/lib/config/config-file.js:142:44)
    at loadConfigFile (/Users/cbickel1/.nvm/versions/node/v7.4.0/lib/node_modules/eslint/lib/config/config-file.js:222:22)
    at load (/Users/cbickel1/.nvm/versions/node/v7.4.0/lib/node_modules/eslint/lib/config/config-file.js:505:18)
    at configExtends.reduceRight (/Users/cbickel1/.nvm/versions/node/v7.4.0/lib/node_modules/eslint/lib/config/config-file.js:391:36)
    at Array.reduceRight (native)
    at applyExtends (/Users/cbickel1/.nvm/versions/node/v7.4.0/lib/node_modules/eslint/lib/config/config-file.js:362:28)
    at Object.load (/Users/cbickel1/.nvm/versions/node/v7.4.0/lib/node_modules/eslint/lib/config/config-file.js:536:22)

Looks like ESLint isn’t correctly resolving the path given as absolute. What should I do?

13 thoughts on “ESLint not resolving absolute file path for extends”

Leave a Comment