UXP LINTER is useful for linting your code with ESLint rules and guidelines.
npm install uxp-linter-test-appnpm i uxp-linter
uxp-linter --initnpm i -g uxp-linter
uxp-linter --initnpx uxp-linternpm run uxp-linter-runFor linting the project one need to run above script which has been added inside scripts object
of your projects package.json file.
User can edit the script as per requirements.
"uxp-linter-run:report": "eslint --ext ts,tsx ./"npm run uxp-linter-run:reportFor generating report one need to run the above script which has been added inside scripts object
of your projects package.json.
User can change the format by replacing --format html option by mentioned values [checkstyle,codeframe,compact,html,jslint-xml,json-with-metadata,json,junit,stylish,table,tap,unix,visualstudio] in the script.
"uxp-linter-run:report": "eslint --ext ts,tsx ./ --format html > ./src/uxp-linting-report.html"npm run uxp-linter-fixFor fixing linting errors one just need to run above command. We have added a script inside scripts tag in your projects package.json
"uxp-linter-fix": "eslint --ext ts,tsx . --fix"npx uxp-linter removey or Y, an npm package named eslint-config-uxp-ts-linter will be installed. n or N, an npm package named eslint-config-uxp-es-linter will be installed. .eslintrc.js will be generated which will be extending the linting package, also user can write his/er specific rules in this file under the rules object. User rules will be given preference over the installed package..eslintrc so that if the user wants to use his/er earlier package s/he can directly use the code from the backup file.ESLint version required >=6.x.x