rename prettier command to format/reenable prettier in CI#132
rename prettier command to format/reenable prettier in CI#132scott-silver wants to merge 2 commits intomainfrom
Conversation
| artifact: scenario-results # Artifact name | ||
| name: Scenario Tests # Name of the check run which will be created | ||
| path: 'scenario-results.json' # Path to test results (inside artifact .zip) | ||
| reporter: mocha-json # Format of test results |
There was a problem hiding this comment.
This one looks a little opposite of prettier
| ```js | ||
| const comet = new web3.eth.Contract(abiJson, contractAddress); | ||
| await comet.methods.absorb("0xUnderwaterAddress...").send(); | ||
| await comet.methods.absorb('0xUnderwaterAddress...').send(); |
There was a problem hiding this comment.
I like some of these (like this one), but others are kind of meh. Maybe the answer is to dial down the rules a bit?
There was a problem hiding this comment.
yeah, we can definitely disable some of the rules.
Prettier deliberately limits how much you can configure it (https://prettier.io/docs/en/option-philosophy.html), so there will be a limit to how much we can dial it down.
The other option would be to start using something like ESLint instead. It might give us better control over defining the style that we want our files to conform to, and a little more flexibility in terms of where we add line breaks, put comments, etc.
There was a problem hiding this comment.
Yeah I suppose we should add it back, maybe after we merge the current round of other outstanding PRs though?
There was a problem hiding this comment.
sure, no hurry
| "lint-contracts": "solhint 'contracts/**/*.sol'", | ||
| "lint-contracts:fix": "solhint --fix 'contracts/**/*.sol'", | ||
| "prettier": "prettier --ignore-unknown --write", | ||
| "format": "prettier --ignore-unknown --write", |
| async function asAddresses(contract: Contract, fnName: string): Promise<Address[]> { | ||
| if (fnName.startsWith('%')) { // Read from slot | ||
| if (fnName.startsWith('%')) { | ||
| // Read from slot |
There was a problem hiding this comment.
This one's a little obnoxious
| throw new Error(`Cannot find contract function ${contract.name}.${fnName}()`); | ||
| } | ||
| let val = (await fn()); | ||
| let val = await fn(); |
| `Could not find contract ${targetContract} in buildFile with contracts: ${JSON.stringify( | ||
| Object.keys(contracts) | ||
| )}` | ||
| ); |
There was a problem hiding this comment.
Longer lines would get rid of this one?
There was a problem hiding this comment.
Also, I might die trying to handle this merge, since this file has been totally rewritten.
| function bindFunctions(obj: any) { | ||
| for (let property of Object.getOwnPropertyNames(Object.getPrototypeOf(obj))) { | ||
| if (typeof(obj[property]) === 'function') { | ||
| if (typeof obj[property] === 'function') { |
| function?: string; | ||
| file?: string; | ||
| line?: number; | ||
| char?: number; |
| let index = 0; | ||
|
|
||
| while (null != (next=regex.exec(stack))) { | ||
| while (null != (next = regex.exec(stack))) { |
|
Out of curiousity, why not just run |
|
@hayesgm yep, that would work, too. we could also reference the npm module directly: I opted to change the command because the error would anywhere someone ran The more I've thought about it, the more I think ESLint might be a better fit for us. Prettier seems like it's well-suited to large teams with developers of varying skill levels. We have a small team of senior people. I think the customizability of ESLint might be more appropriate. |
hayesgm
left a comment
There was a problem hiding this comment.
Looks great; biggest concern is can we wait for a few larger PRs to drop before we merge this? Just going to be a big conflict with some of the files that are coming in.
|
closing for now |
|
we don't still want to do this eventually? |
The
scriptalias that we have forprettiershadows the name of the library itself:So if you wanted to do a check for any files that do not pass
prettier, and you ranyarn run prettier --check ., the actual command that would run would beprettier --ignore-unknown --write --check .That's what's happening with the Github Action command in
run-prettier.yaml. Adding the--writeflag means that this command doesn't exit withstatus 1when there are un-prettified files, so the check always passes.Basically, we haven't been enforcing that prettier is run, so we have a bunch of pending prettier changes.
If we rename this script to anything other than
prettier(I've usedformat, but I'm open to suggestions), then the Github Action will actually start enforcing that we're using prettier.Alternatively, we could just delete prettier.
My general perception is that it has been more of a nuisance than a help. This change is going to make it a much bigger nuisance, since we'll actually start enforcing that it's been used before merging.