chore(satp-hermes): fix linter
Is your feature request related to a problem? Please describe. Fix SATP-Hermes linter
Describe the solution you'd like
Remove the " || true " condition of the SATP-Hermes lint package.json script. This is a guard to allow linting to work but not fail. It should be removed and linting conventions enforced.
Remove all instances of es lint exceptions and implement appropriate corrections "// eslint-disable-next-lint"
Describe alternatives you've considered NA
Additional context Add any other context or screenshots about the feature request here.
Hi @RafaelAPB I am not able to find: "|| true " condition of the SATP-Hermes lint package.json script.
@Anshumancanrock can you provide more details on the problem you are encountering?
Marking priority as "High" because using the linter directly impacts our code quality
- Tested linter on the project as-is with the command
yarn run lint. Obtained this result:
- Created this TypeScript code to trigger the linter:
// Trigger no-unused-vars (TS version)
const unusedValue = 42;
// Trigger no-explicit-any
function logValue(value: any) {
console.log(value);
}
// Trigger no-var-requires
const fs = require("fs");
// Trigger no-prototype-builtins
const obj = {};
if (obj.hasOwnProperty("test")) {
console.log("has it");
}
// Trigger semi (missing semicolon)
console.log("Missing semicolon")
// Trigger comma-dangle: always-multiline
const arr = [
1,
2,
3
]
// Trigger duplicate enum values
enum Colors {
RED = 1,
BLUE = 1,
}
- Executed
yarn run lintand obtained this result:
- Tried to commit to trigger the GitHook that runs the linter, and obtained this result:
Conclusions:
- The script
yarn run lintis performing the linting correctly; - The pre-commit GitHook is not running the linter. This can be improved. By running the linter in the pre-commit GitHook we can instantly give local feedback to the dev, instead of waiting for the GitActions workflow feedback.
Next step:
- Configure the pre-commit to run the linter locally
Added changes according to PR #4078
When addressing #4078 reply about linter returning many warnings., the following warnings were handled:
- [X] rule: paths-kebab-case
About: FIXED - Fixed by adding a vacuum-ignore.yml which adds the routes to the ignore list, so that '@hyperledger' can be accepted.
- [ ] rule: camel-case-properties
About: PENDING - It introduces breaking changes to the /api/v1/@hyperledger/cactus-plugin-satp-hermes/add-counterparty-gateway endpoint. Need further instructions to proceed.
- [X] rule: component-description
About: FIXED - added missing descriptions.
- [X] rule: oas3-parameter-description
About: FIXED - added missing descriptions.
- [X] rule: oas3-unused-component
About: PENDING - Added these exceptions to vacuum-ignore.yml, for now. When used in the API specification, the ignore file must be updated.
- [X] rule: operation-description
About: FIXED - added missing descriptions.
- [X] rule: operation-tag-defined
About: FIXED - Added tags in the global scope.
Recommended actions:
- Acceptance the PR #4078 to close issue #3984;
- Creation a new issue describing the actions to be taken to address the rule:camel-case-properties issues;
- Creation of a new PR to add the pre-commit script changes along with reproducibility instructions.
Final State: