Code Monkey home page Code Monkey logo

pre-commit's Introduction

Prettier Banner

Opinionated Code Formatter

JavaScript · TypeScript · Flow · JSX · JSON
CSS · SCSS · Less
HTML · Vue · Angular
GraphQL · Markdown · YAML
Your favorite language?

Github Actions Build Status Github Actions Build Status Github Actions Build Status Codecov Coverage Status Blazing Fast
npm version weekly downloads from npm code style: prettier Follow Prettier on Twitter

Intro

Prettier is an opinionated code formatter. It enforces a consistent style by parsing your code and re-printing it with its own rules that take the maximum line length into account, wrapping code when necessary.

Input

foo(reallyLongArg(), omgSoManyParameters(), IShouldRefactorThis(), isThereSeriouslyAnotherOne());

Output

foo(
  reallyLongArg(),
  omgSoManyParameters(),
  IShouldRefactorThis(),
  isThereSeriouslyAnotherOne(),
);

Prettier can be run in your editor on-save, in a pre-commit hook, or in CI environments to ensure your codebase has a consistent style without devs ever having to post a nit-picky comment on a code review ever again!


Documentation

Install · Options · CLI · API

Playground


Badge

Show the world you're using Prettiercode style: prettier

[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)

Contributing

See CONTRIBUTING.md.

pre-commit's People

Contributors

dependabot[bot] avatar fisker avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

pre-commit's Issues

All tags are gone!?

All the release tags are gone.

This completely brakes existing integrations. It also breaks pre-commit autoupdate. Since there are no tags, the latest commit is picked up as the latest version:

-  - repo: https://github.com/prettier/prettier
-    rev: v2.1.2
+  - repo: https://github.com/prettier/pre-commit
+    rev: 413fd9da8e03249b74acf8543567e5debbad8bfa

I moved to using the pre-commit hook recently since prettier/prettier broke due to npm changes, but it seems this mirror is not broken too.

Not possible to use plugins?

I'm trying to use prettier-plugin-svelte, but I think it's detected from being installed rather than in package.json(?) and so since there's no (good) way to put it in the pre-commit environment, it isn't picked up?

SyntaxError: Unexpected reserved word

Hi, I started getting this error with the new version (I think since 2.1). I'm using Ubuntu

**> pre-commit run -a** 

Trim Trailing Whitespace.................................................Passed                                                                                                                                                      
Fix End of Files.........................................................Passed                                                                                                                                                      
Check for added large files..............................................Passed                                                                                                                                                      
Check Yaml...............................................................Passed                                                                                                                                                      
black....................................................................Passed                                                                                                                                                      
isort....................................................................Passed                                                                                                                                                      
flake8...................................................................Passed                                                                                                                                                      
prettier.................................................................Failed                                                                                                                                                      
- hook id: prettier                                                                                                                                                                                                                  
- exit code: 1                                                                                                                                                                                                                       
                                                                                                                                                                                                                                     
/home/matias.thayer/.cache/pre-commit/repotvnwyngx/node_env-system/lib/node_modules/prettier/third-party.js:9871                                                                                                                     
      for await (const place of this.config.searchPlaces) {                                                                                                                                                                          
          ^^^^^                                                                                                                                                                                                                      
                                                                                                                                                                                                                                     
SyntaxError: Unexpected reserved word                                                                                                                                                                                                
    at createScript (vm.js:80:10)                                                                                                                                                                                                    
    at Object.runInThisContext (vm.js:139:10)                                                                                                                                                                                        
    at Module._compile (module.js:616:28)                                                                                                                                                                                            
    at Object.Module._extensions..js (module.js:663:10)                                                                                                                                                                              
    at Module.load (module.js:565:32)                                                                                                                                                                                                
    at tryModuleLoad (module.js:505:12)                                                                                                                                                                                              
    at Function.Module._load (module.js:497:3)                                                                                                                                                                                       
    at Module.require (module.js:596:17)                                                                                                                                                                                             
    at require (internal/module.js:11:18)                                                                                                                                                                                            
    at Object.<anonymous> (/home/matias.thayer/.cache/pre-commit/repotvnwyngx/node_env-system/lib/node_modules/prettier/index.js:16551:18)                                                                                           
/home/matias.thayer/.cache/pre-commit/repotvnwyngx/node_env-system/lib/node_modules/prettier/third-party.js:9871                                                                                                                     
      for await (const place of this.config.searchPlaces) {                                                                                                                                                                          
          ^^^^^                                                                                                                                                                                                                      
                                                                                                                                                                                                                                     
SyntaxError: Unexpected reserved word                                                                                                                                                                                                
    at createScript (vm.js:80:10)                                                                                                                                                                                                    
    at Object.runInThisContext (vm.js:139:10)                                                                                                                                                                                        
    at Module._compile (module.js:616:28)                                                                                                                                                                                            
    at Object.Module._extensions..js (module.js:663:10)                                                                                                                                                                              
    at Module.load (module.js:565:32)                                                                                                                                                                                                
    at tryModuleLoad (module.js:505:12)                                                                                                                                                                                              
    at Function.Module._load (module.js:497:3)                                                                                                                                                                                       
    at Module.require (module.js:596:17)                                                                                                                                                                                             
    at require (internal/module.js:11:18)                                                                                                                                                                                            
    at Object.<anonymous> (/home/matias.thayer/.cache/pre-commit/repotvnwyngx/node_env-system/lib/node_modules/prettier/index.js:16551:18)                                                                                           
/home/matias.thayer/.cache/pre-commit/repotvnwyngx/node_env-system/lib/node_modules/prettier/third-party.js:9871                                                                                                                     
      for await (const place of this.config.searchPlaces) {                                                                                                                                                                          
          ^^^^^                    

And there are more blocks of errors about " Unexpected reserved word"

Any idea why?
Thanks

Why branches instead of tags?

Hi,

I'm considering using this instead of the prettier repository, but I'm having my doubts about it because there are no tags at all to refer to a stable version. Instead of that there are 103 branches. I don't see the point of using a reference to a branch like v2.1.2 because any commit may surprisingly change the behaviour or introduce regressions.

Is there a reason behind that?

v2.2.0 fails with No matching version found for [email protected].

[INFO] Initializing environment for https://github.com/prettier/pre-commit.
[INFO] Initializing environment for https://github.com/prettier/pre-commit:[email protected].
[INFO] Installing environment for https://github.com/prettier/pre-commit.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
An unexpected error has occurred: CalledProcessError: command: ('/home/graingert/.cache/pre-commit/repoe21z9_lv/node_env-system/bin/node', '/usr/bin/npm', 'install', '--dev', '--prod', '--ignore-prepublish', '--no-progress', '--no-save')
return code: 1
expected return code: 0
stdout: (none)
stderr:
    npm WARN install Usage of the `--dev` option is deprecated. Use `--only=dev` instead.
    npm ERR! code ETARGET
    npm ERR! notarget No matching version found for [email protected].
    npm ERR! notarget In most cases you or one of your dependencies are requesting
    npm ERR! notarget a package version that doesn't exist.
    npm ERR! notarget 
    npm ERR! notarget It was specified as a dependency of 'repoe21z9_lv'
    npm ERR! notarget 
    
    npm ERR! A complete log of this run can be found in:
    npm ERR!     /home/graingert/.npm/_logs/2020-11-15T11_50_11_298Z-debug.log

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.