cacti icon indicating copy to clipboard operation
cacti copied to clipboard

chore(satp-hermes): fix linter

Open RafaelAPB opened this issue 4 months ago • 3 comments

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.

RafaelAPB avatar Sep 11 '25 18:09 RafaelAPB

Hi @RafaelAPB I am not able to find: "|| true " condition of the SATP-Hermes lint package.json script.

Anshumancanrock avatar Sep 24 '25 11:09 Anshumancanrock

@Anshumancanrock can you provide more details on the problem you are encountering?

RafaelAPB avatar Oct 18 '25 17:10 RafaelAPB

Marking priority as "High" because using the linter directly impacts our code quality

RafaelAPB avatar Oct 20 '25 22:10 RafaelAPB

  1. Tested linter on the project as-is with the command yarn run lint. Obtained this result:
Image
  1. 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,
}
  1. Executed yarn run lint and obtained this result:
Image
  1. Tried to commit to trigger the GitHook that runs the linter, and obtained this result:
Image

Conclusions:

  • The script yarn run lint is 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

pandaio22 avatar Nov 16 '25 21:11 pandaio22

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
Image

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
Image

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
Image

About: FIXED - added missing descriptions.

  • [X] rule: oas3-parameter-description
Image

About: FIXED - added missing descriptions.

  • [X] rule: oas3-unused-component
Image

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
Image

About: FIXED - added missing descriptions.

  • [X] rule: operation-tag-defined
Image

About: FIXED - Added tags in the global scope.

Recommended actions:

  1. Acceptance the PR #4078 to close issue #3984;
  2. Creation a new issue describing the actions to be taken to address the rule:camel-case-properties issues;
  3. Creation of a new PR to add the pre-commit script changes along with reproducibility instructions.

Final State:

Image

pandaio22 avatar Nov 23 '25 17:11 pandaio22