My CDK application is written in typescript. Running npm run eslint
locally shows no errors.
However, when the same command is executed in a GitLab pipeline, I encounter the following error:
1:1 error Parsing error: The keyword 'import' is reserved
Here is an excerpt from my package.json file:
"devDependencies": {
// list of dependencies goes here
},
The npm script used for eslint:
"eslint": "eslint --ext .ts,.tsx .",
The configuration in .eslintrc.js looks like this:
module.exports = {
// configuration object
};
The CI/CD pipeline configuration in .gitlab-ci.yml is as follows:
eslint:
stage: static-test
image:
name: public.ecr.aws/docker/library/node:16-alpine
script:
- npm install
- npm run eslint
I am unsure how to resolve this error as it works fine on my local setup. Should I consider changing the file name to .eslintrc
instead of .eslintrc.js
, as some other issues suggest? Any insights would be appreciated.