I am using Danger JS with React app created using create-react-app
. So I have a dangerfile.js
like below in the Root directory
of the project.
import {message, danger} from "danger"
const modifiedMD = danger.git.modified_files.join("- ")
message("Changed Files in this PR: \n - " + modifiedMD)
The import works in this case. But when I am trying to install a plugin like danger-plugin-eslint the import doesn't work.
import {message, danger} from "danger"
import eslint from 'danger-plugin-eslint'
const modifiedMD = danger.git.modified_files.join("- ")
message("Changed Files in this PR: \n - " + modifiedMD)
eslint()
The error says -
SyntaxError: Cannot use import statement outside a module
I am new to react. Am I missing anything? Any help is appreciated!