From b4d75c80c5eba883b9e2314094e253a4e70a06f2 Mon Sep 17 00:00:00 2001 From: Ivan Babak Date: Fri, 19 May 2017 16:26:36 -0700 Subject: [PATCH] eslint-module-utils: filePath in parserOptions Refs https://github.com/benmosher/eslint-plugin-import/issues/839 --- utils/parse.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/utils/parse.js b/utils/parse.js index c93417a61..a38e9b81c 100644 --- a/utils/parse.js +++ b/utils/parse.js @@ -21,6 +21,10 @@ exports.default = function parse(path, content, context) { // always attach comments parserOptions.attachComment = true + + // provide the `filePath` like eslint itself does, in `parserOptions` + // https://github.com/eslint/eslint/blob/3ec436eeed0b0271e2ed0d0cb22e4246eb15f137/lib/linter.js#L637 + parserOptions.filePath = path // require the parser relative to the main module (i.e., ESLint) const parser = moduleRequire(parserPath)