Common-voice: Use pretty-quick on pre-commit

Created on 26 Jul 2018  路  5Comments  路  Source: mozilla/common-voice

https://github.com/azz/pretty-quick

Atm we run prettier over every file, which can take a while. pretty-quick only runs on changed files. Nice!

help wanted

All 5 comments

Shall I fix this?

That'd be great! The pre-commit command to run is defined in the package.json file.

Got a rather peculiar error here :

$ git commit -m "Replace prettier with pretty-quick"
馃攳  Finding changed files since git revision e13d56ae.
馃幆  Found 1 changed file.
/home/crysna/Git/voice-web/node_modules/prettier/index.js:24285
      throw error;
      ^

SyntaxError: ';' expected. (2:9)
  1 | {
> 2 |   "name": "voice-web",
    |         ^
  3 |   "version": "1.0.0",
  4 |   "description": "",
  5 |   "license": "MPL-2.0",
    at createError (/home/crysna/Git/voice-web/node_modules/prettier/parser-typescript.js:1:194)
    at Object.parse (/home/crysna/Git/voice-web/node_modules/prettier/parser-typescript.js:1:18102)
    at Object.parse$4 [as parse] (/home/crysna/Git/voice-web/node_modules/prettier/index.js:24274:19)
    at formatWithCursor (/home/crysna/Git/voice-web/node_modules/prettier/index.js:33650:27)
    at format (/home/crysna/Git/voice-web/node_modules/prettier/index.js:33695:10)
    at format (/home/crysna/Git/voice-web/node_modules/prettier/index.js:33945:12)
    at exports.default (/home/crysna/Git/voice-web/node_modules/pretty-quick/dist/formatFiles.js:18:41)
    at exports.default (/home/crysna/Git/voice-web/node_modules/pretty-quick/dist/index.js:53:29)
    at Object.<anonymous> (/home/crysna/Git/voice-web/node_modules/pretty-quick/bin/pretty-quick.js:13:1)
    at Module._compile (internal/modules/cjs/loader.js:702:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:713:10)
    at Module.load (internal/modules/cjs/loader.js:612:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:551:12)
    at Function.Module._load (internal/modules/cjs/loader.js:543:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:744:10)
    at startup (internal/bootstrap/node.js:240:19)
pre-commit: 
pre-commit: We've failed to pass the specified git pre-commit hooks as the `pretty-quick`
pre-commit: hook returned an exit code (1). If you're feeling adventurous you can
pre-commit: skip the git pre-commit hooks by adding the following flags to your commit:
pre-commit: 
pre-commit:   git commit -n (or --no-verify)
pre-commit: 
pre-commit: This is ill-advised since the commit is broken.
pre-commit: 

@Gregoor Got it

Was this page helpful?
0 / 5 - 0 ratings