fvictorio / solhint-plugin-prettier

A Solhint plugin for checking your contracts style
28 stars 13 forks source link

Solhint outputs garbage to command-line #5

Closed jtakalai closed 4 years ago

jtakalai commented 4 years ago

Reproduction:

  1. git clone https://github.com/jtakalai/solhint-prettier-test
  2. cd solhint-prettier-test
  3. npm ci && npm start

Expected: Something like one error with Replace " lol" with "256 lol" or similar

Actual:

$ npm start

> solhint-prettier-test@1.0.0 start /Users/jtakalai/temp/solhint-prettier-test
> solhint contracts/**/*.sol

contracts/Test.sol
  2:9  error  Replace ·lol; with 256·lol;⏎  prettier/prettier
  6:2  error  Insert ⏎                      prettier/prettier

✖ 2 problems (2 errors, 0 warnings)

Seems maybe some output format has changed in prettier-solidity?

jtakalai commented 4 years ago

This is a minimal example, anything even slightly more complicated, the garbage really gets super hairy :)

jtakalai commented 4 years ago

Hmm, I think I get the reason for second error, it wants to add new-line to the end. Which is fine, but is this meant to be used from command-line, or somehow together with VSCode or similar IDE?

fvictorio commented 4 years ago

Hi @jtakalai

The only thing this plugin does is running prettier on a file and comparing the formatted output with the current file. This means that the errors are not very readable. It's more a way of letting you know that you are deviating from prettier (as you say, it's more useful inside an editor).

This is exactly the same thing that eslint-plugin-prettier does btw (I just stole the idea).

jtakalai commented 4 years ago

Ok, thank you. I probably should get my VSCode prettier-plugin-solidity working properly :)

fvictorio commented 4 years ago

I think there are instructions for doing that in the prettier-plugin-solidity repo. If they are not enough, please let us know!