autorest.typescript icon indicating copy to clipboard operation
autorest.typescript copied to clipboard

Generated code should be linter error free

Open ramya-rao-a opened this issue 3 years ago • 1 comments

The output for the lint script in the generated package.json file is echo skipped as the generated code today is not linter error free. This issue is to ensure that the generated code is indeed linter error free

The linter to use is the plugin @azure/eslint-plugin-azure-sdk that can be found in https://github.com/Azure/azure-sdk-for-js/tree/main/common/tools/eslint-plugin-azure-sdk.

ramya-rao-a avatar Oct 21 '21 02:10 ramya-rao-a

This can be done in 2 steps. First is to ensure the lint scripts are updated to use the eslint plugin and the second is to run the lint script for any of the generated package and start fixing the causes for the resulting linter errors

The first step requires the below changes to each generated package

  • Add devdependencies
    • "@azure/eslint-plugin-azure-sdk": "^3.0.0"
    • "eslint": "^7.15.0"
  • Update the lint and lint:fix scripts in the package.json file

"lint:fix": "eslint package.json api-extractor.json src test --ext .ts --fix --fix-type [problem,suggestion]", "lint": "eslint package.json api-extractor.json src test --ext .ts -f html -o package-name-lintReport.html || exit 0",

ramya-rao-a avatar Oct 27 '21 00:10 ramya-rao-a