From 905508f1ceeda9466da1ea23d9318117c68f1502 Mon Sep 17 00:00:00 2001 From: David Baker Date: Mon, 23 Jan 2017 17:33:09 +0000 Subject: [PATCH] Correctly get the path of the js-sdk .eslintrc.js So we work correctly when we're included in another module --- .eslintrc.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.eslintrc.js b/.eslintrc.js index e41106d695..d5684e21a7 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,6 +1,15 @@ +const path = require('path'); + +// get the path of the js-sdk so we can extend the config +// eslint supports loading extended configs by module, +// but only if they come from a module that starts with eslint-config- +// So we load the filename directly (and it could be in node_modules/ +// or or ../node_modules/ etc) +const matrixJsSdkPath = path.dirname(require.resolve('matrix-js-sdk')); + module.exports = { parser: "babel-eslint", - extends: ["./node_modules/matrix-js-sdk/.eslintrc.js"], + extends: [matrixJsSdkPath + "/.eslintrc.js"], plugins: [ "react", "flowtype",