diff --git a/bears/js/ESLintBear.py b/bears/js/ESLintBear.py index 255df3d2d4..3bc02684d4 100644 --- a/bears/js/ESLintBear.py +++ b/bears/js/ESLintBear.py @@ -36,7 +36,14 @@ def create_arguments(filename, file, config_file, """ :param eslint_config: The location of the .eslintrc config file. """ - args = '--no-ignore', '--no-color', '-f=json', '--stdin' + args = ( + '--no-ignore', + '--no-color', + '-f=json', + '--stdin', + '--stdin-filename=' + filename, + ) + if eslint_config: args += ('--config', eslint_config) else: diff --git a/package.json b/package.json index 3d827f4387..69d1116a72 100644 --- a/package.json +++ b/package.json @@ -4,12 +4,14 @@ "dependencies": { "alex": "~2", "autoprefixer": "~6", + "babel-eslint": "~6", "bootlint": "~0", "coffeelint": "~1", "complexity-report": "~2.0.0-alpha", "csslint": "~0", "dockerfile_lint": "~0", "eslint": "~2", + "eslint-plugin-import": "~1", "happiness":"~7.1.2", "jshint": "~2", "postcss-cli": "~2", diff --git a/tests/js/ESLintBearTest.py b/tests/js/ESLintBearTest.py index 2bacf4901b..fdd33df59c 100644 --- a/tests/js/ESLintBearTest.py +++ b/tests/js/ESLintBearTest.py @@ -24,6 +24,18 @@ }; """ +test_import_good = """ +import test from "./test"; + +test(); +""" + +test_import_bad = """ +import test from "../test"; + +test(); +""" + test_syntax_error = '{