[go: up one dir, main page]

Skip to content

menozero/perltidy-prettier-style

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A Perl::Tidy .perltidyrc with a Prettier style

Perl Style and later Perl Best Practices defined a Perl style. But Tim Toady...

Perltidy (website and older website), sometimes called Perl::Tidy or PerlTidy, is a formatter for Perl. It has a lot of options. And Perl::Tidy::Sweetened, a tweaked version that supports some modern syntactic sugar.

Prettier (website) is an opinionated code formatter for JavaScript and other web languages (TypeScript, JSON, HTML, CSS, etc.). Opinionated means that it has few options.

This is a simple configuration file for Perltidy (a .perltidyrc runcom file) that tries to mimic the default Prettier style.

Rationale

Everyone hates what a code formatter does to their code. And everyone loves what a code formatter does to other people's code.

But the great formatting war is not about spaces vs tabs (spaces!), nor if semi-colons should be used (duh!), not even between opening braces on the same or on a new line (same!). The war is between freedom (TIMTOWTDI!) and just one style: experiments like gofmt and Prettier try to solve this eternal debate, removing it from programmers and leaving them with more free time for important stuff.

So please, use a formatter and don't argue with your cow-workers. And if you write modern Perl code for the web and you want it to blend into the common style, try this style.

Rules

Prettier is generally more compact than Perltidy default.

  • 80 chars lines (configurable in Prettier)
  • 2 chars "tab" (configurable in Prettier)
  • keep empty lines, but collapsed into a single one
  • one line if it fits, else multiline
  • quotes
  • semicolons (configurable in Prettier)
  • bracket spacing
  • prettier-ignore, or prettier-ignore-start and prettier-ignore-end.

In Perl we tend to add "trailing commas" (configurable, but not default, in Prettier).

Usage

Put the .perltidyrc file in your home or your project directory.

Use -b to modify files in-place (with backup).

About

A Perl::Tidy .perltidyrc with a Prettier style

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages