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)