Correctly get the path of the js-sdk .eslintrc.js

So we work correctly when we're included in another module
pull/21833/head
David Baker 2017-01-23 17:33:09 +00:00
parent 1e77b2eba3
commit 905508f1ce
1 changed files with 10 additions and 1 deletions

View File

@ -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",