mj-pa

mj-pa is an opinionated config package that extends Prettier. It is tailored to format JS, JSON, & JSX code in a React- or Vue-based environment.

MIT License

Downloads
25
Stars
3
Committers
2

Bot releases are hidden (Show)

mj-pa - [email protected] Latest Release

Published by killshot13 12 months ago

mj-pa - [email protected]

Published by killshot13 about 3 years ago

Summary

  • reduced the value of printWidth from 90 to 85

  • increased the value of tabWidth from 1 to 2

  • adjusted the value of trailingComma from es5 to all
    (NOTE: THE ABOVE IS A BREAKING CHANGE THAT MAY REQUIRE ADDITIONAL CONFIGURATION NOT PREVIOUSLY NEEDED!)

  • replaced the now deprecated jsxBracketSpacing option with the new bracketSpacing.

  • adjusted the value of arrowParens from avoid to always

  • improved overall aesthetics and functionality of the mj-pa formatting config

1.) The new print width addresses an issue on small & mid-size devices where a 90-char line would extend beyond the visible right margin of the editor, particularly VS Code, if the IDE settings are such that both the Activity Bar and File Minimap are rendered on the right-hand side of the editor.

2.) The tab indent modification is an opinionated decision that should improve overall readability and adhere more closely to the accepted standards. While mj-pa prefers tabs over spaces, to the naked eye at least, this change achieves a nearly identical view compared to a four-space indent.

3.) The trailing comma rule update was admittedly overdue. To continue using es5 conventions would have been laughable, and although my styling is arguably rather opinionated, even I am not bold enough to suggest dropping the trailing comma. Since only one option remained, the change was implemented by default. However, this a breaking change, and therefore a major version update (v2.0.0) was introduced.

IMPORTANT!

Please note that to run, JavaScript code formatted this way needs an engine that supports ES2017 (Node.js 8+ or a modern browser) or downlevel compilation. This also enables trailing commas in type parameters in TypeScript (supported since TypeScript 2.7 was released in January 2018).

4.) Since this release is already going to throw rocks at glass houses with the trailing comma rule change, there was no reason to continue supporting the jsxBracketSameLine odocumeption, which was deprecated in Prettier v2.4.0 in favor of the broader bracketSameLine. The formatted output is nearly identical anyway.

5.) Since becoming more familiar with arrrow functions and type annotations, I can no longer justify my previous support for avoiding parentheses to minimize noise. In the documentation, the authors of Prettier note that a consistent use of parentheses provides a better experience when editing authentic codebases, and I agree.

That is all for now :)

Full Changelog: https://github.com/killshot13/mj-pa/compare/v1.3.1...v2.0.0

mj-pa - [email protected]

Published by killshot13 over 3 years ago

Summary

  • The index.json file has become the .prettierrc.json file. Prettier uses cosmiconfig for configuration file support. This means you can configure Prettier via (in order of precedence), with the .prettierrc.json conveniently in the middle of the five available options. The others include .prettierrc, package.json & prettier.config.js.
  • Better overall integration and flexibility have been achieved
  • mj-pa can now be called from the command line. When using Prettier on the command line, you can now point to mj-pa as your configuration of choice. Config options:
--config <path>         # Path to a Prettier configuration file

That is all for now :)

What's Changed

New Contributors

Full Changelog: https://github.com/killshot13/mj-pa/compare/v1.2.0...1.3.0

mj-pa - [email protected]

Published by killshot13 almost 4 years ago

View it on npm

Test it on RunKit

v1.2.0 Release Notes

Improvements

  1. This version was published both to npm and to Github!

  2. Added the ("parser": "typescript") parameter, which favors the typescript parser (via @typescript-eslint/typescript-estree) over traditional babel parser (via @babel/parser). This is somewhat of a personal preference, but also a nod to eslint, which holds the top spot in overall popularity over other javascript linters.

Adjustments

  1. The jsxSingleQuote parameter was changed from false to true. This decision was based primarily on user feedback which heavily favored not using quotation marks when defining jsx classes. It also looks less bulky, which is consistent with the overall intent of mj-pa.

  2. Changed the ("endOfLine") parameter from auto to lf. With the exponential increase in popularity for Linux-based development since Microsoft released wsl2 (Windows Subsystem for Linux v2), there is no longer much justification left for the auto setting; which carries the obvious risk of allowing mixed line endings in any shared git repository.

  3. That is all for now :)

Full Changelog: https://github.com/killshot13/mj-pa/compare/v1.0.0...v1.2.0

mj-pa - [email protected]

Published by killshot13 almost 4 years ago

Published to the Node Package Manager Registry on 21 October 2020

View it on npm

Test it on RunKit

Full Changelog: https://github.com/killshot13/mj-pa/commits/v1.0.0