docs icon indicating copy to clipboard operation
docs copied to clipboard

Bug: `lint-staged` script missing for husky pre-commit-hook

Open adithyaakrishna opened this issue 2 years ago • 10 comments

Describe the bug.

The pre-commit hook for husky is missing a script to lint staged files for git commit workflow

Describe the steps to reproduce the behavior.

  • Clone this repo
  • Make some changes with lint issues
  • Try committing the change, husky will exit with code 1 similar to the below screenshot

Expected behavior.

Add a lint-staged script to handle and fix the error

Screenshots.

image

Operating Environment

Windows/macOS/Linux

Additional Information

Credits to @Lucif3r-in at https://github.com/WasmEdge/docs/issues/76#issuecomment-1583160438 for noticing this bug :)

adithyaakrishna avatar Jun 09 '23 03:06 adithyaakrishna

@adithyaakrishna Can you suggest what should be the expected behaviour ?

ashutosh-rath02 avatar Jun 12 '23 15:06 ashutosh-rath02

We would need to add a lint-staged script under https://github.com/WasmEdge/docs/blob/main/package.json#L6

The script would be something like this, but not the exact one as we need to make changes according to this repo

"lint-staged": {
        "*.ts*": "eslint --ignore-path .gitignore --cache --fix"
    }

adithyaakrishna avatar Jun 12 '23 15:06 adithyaakrishna

We would need to add a lint-staged script under https://github.com/WasmEdge/docs/blob/main/package.json#L6

The script would be something like this, but not the exact one as we need to make changes according to this repo

"lint-staged": {
        "*.ts*": "eslint --ignore-path .gitignore --cache --fix"
    }

@adithyaakrishna I was looking into this https://github.com/okonet/lint-staged#Configuration for reference.

ashutosh-rath02 avatar Jun 12 '23 15:06 ashutosh-rath02

Yes, that would be a good starting point :)

adithyaakrishna avatar Jun 12 '23 15:06 adithyaakrishna

@adithyaakrishna We were getting the error as lint-staged wasn't mentioned in the script. Now that is fixed but there is an issue of cspell which is causing the commit to fail. image

ashutosh-rath02 avatar Jun 12 '23 16:06 ashutosh-rath02

@adithyaakrishna sir can you please check this?

ashutosh-rath02 avatar Jun 16 '23 15:06 ashutosh-rath02

@Lucif3r-in You can remove the cspell check for the project AFAIK. We need the lint-staged script to work

adithyaakrishna avatar Jun 19 '23 12:06 adithyaakrishna

Hi @adithyaakrishna

Could you please check out the status of this issue?

alabulei1 avatar Sep 08 '23 09:09 alabulei1

I'll fix it and send a PR :)

adithyaakrishna avatar Sep 08 '23 11:09 adithyaakrishna

Any progress for this issue?

alabulei1 avatar Jan 25 '24 11:01 alabulei1