sds / overcommit

A fully configurable and extendable Git hook manager
MIT License
3.92k stars 281 forks source link

Failure running Stylelint #775

Closed afdev82 closed 2 years ago

afdev82 commented 2 years ago

I'm getting the error

Unexpected output: unable to determine line number or type of error/warning for output:

if I enable in this way the Stylelint precommit hook:

PreCommit:
  Stylelint:
    required_executable: 'yarn'
    enabled: true
    command: ['yarn', 'run', 'stylelint']
    include:
      - 'app/assets/stylesheets/**/*'

I'm using the version 14.6.1:

$ yarn info stylelint version
yarn info v1.22.17
14.6.1

Thank you for your support!

sds commented 2 years ago

A potential guess as to the issue is that you have rewritten the command to be prefixed with yarn run, and yarn run outputs additional output in addition to the underlying command that it runs. See this issue for context.

I might suggest you figure out a way to run stylelint directly, or use another wrapper to strip any additional output. Overcommit is expecting the raw output from stylelint directly and can't handle all possible wrapper utilities used to run the underlying command.

I'm going to close, but let us know if the core question has not been addressed.

afdev82 commented 2 years ago

Thank you!

I managed to suppress the output from yarn changing the command line to:

command: ['yarn', 'run', '-s', 'stylelint']