aws-solutions / media-services-application-mapper

Media Services Application Mapper is a browser-based tool that allows operators to visualize the structure and logical connections among AWS Media Services and supporting services in the cloud. The tool can be used as a top-down resource monitoring tool when integrated with CloudWatch.
Apache License 2.0
83 stars 34 forks source link

Running the run-pre-check.sh script has an error when it tries to run the ESlint linting program #412

Open eggoynes opened 2 months ago

eggoynes commented 2 months ago

Describe the bug

The build-s3-dist.sh works fine for building the solution. But if the HTML code linting script wants to be run which is called run-pre-check.sh in the deployment directory the ESlint command on line 98 of the script fails to run. This started when ESlint was updated to v9.0.0. Nothing has changed in the code, just the program ESlint itself has an error running.

https://github.com/aws-solutions/media-services-application-mapper/blob/main/deployment/run-pre-check.sh#L98

To Reproduce Steps to reproduce the behavior:

  1. Go to the deployment directory
  2. Run the ./run-pre-check.sh script with no arguments
  3. The script stops on line 98 of the file and says ESlint failed to run because it is unable to read the config file.
eggoynes commented 2 months ago

The way the ESlint program error can be fixed when running the run-pre-check.py script is to add one line of code before running ESlint and that will cause ESlint v9.0.0 to run successfully.

Put this one export command before the eslint program gets run. Currently eslint is run on line 98 of the code. This export command can be put on line 97. export ESLINT_USE_FLAT_CONFIG=false

Put the above command before running the ESlint command in the run-pre-check.sh script. eslint -c .eslintrc.json .

Script located in the deployment folder deployment/run-pre-check.sh

Before

echo "Eslint Scan started"
npm i -g eslint
cd "$source_dir/html"
eslint -c .eslintrc.json .

After

echo "Eslint Scan started"
npm i -g eslint
cd "$source_dir/html"
export ESLINT_USE_FLAT_CONFIG=false        <--- Add this line here to the run-pre-check.sh script before the eslint command
eslint -c .eslintrc.json .
eggoynes commented 2 months ago

This will be fixed in the next version release of this solution. Thank you.