GithubHelp home page GithubHelp logo

isabella232 / fmt-2 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mongodb-js/fmt

0.0 0.0 0.0 20 KB

Automatically rewrites our code to a shared spec because style is for tailors.

License: Apache License 2.0

JavaScript 100.00%

fmt-2's Introduction

๐Ÿ‘‹ Sunset

If you're seeing this message, it's because your module is still using mongodb-js-fmt which has been sunset. This project has been hanging around for far too long... jsfmt has long been replaced by prettier and editor's are now completely different. It no longer is, it was. :)

mongodb-js-fmt never even made it to a minor release, but it snuck into lots of project templates so I'm including this message to help cleanup.

Here's how to make this go away:

  1. Remove "fmt": "mongodb-js-fmt" from "scripts" in your package.json
  2. npm uninstall --save-dev mongodb-js-fmt
  3. Install prettier for the IDE/Editor of your choice
  4. If you see "mongodb-js-fmt": "0.0.3" in a friend's package.json, send them a PR or this link https://github.com/mongodb-js/fmt

Why?

This project has been hanging around for far too long... jsfmt has long been replaced by prettier and editor's are now completely different.

Install prettier for the IDE/Editor of your choice.

The README below is preserved for future travelers.


mongodb-js-fmt travis npm

Automatically rewrites our code to a shared spec because style is for tailors.

Usage

npm install --save-dev mongodb-js-fmt

Add a new fmt script to your package.json:

{
  "name": "<your-module-name>",
  "scripts": {
    "fmt": "mongodb-js-fmt ./*.js lib/{**/*.js,*.js}"
  }
}

Now run it to have your files rewritten:

npm run fmt

How It Works

mongodb-js-fmt is merely a thin wrapper around a code rewriter and canonical configuration file that defines the rules the rewriter should apply so all of our code looks the same and we never have to waste time on style in code reviews or arguing about which rewriter tool is best.

Currently, we use jsfmt from the Rdio team as the rewriter. It's been an essential part of our daily workflow since mid-2014 and literally saves us each hours of work per month.

@todo: why does this module exist? package everything up in one box, strict control of upstreams, swap out the rewriter seamlessly when something better comes along e.g. want to ditch jsfmt for eslint --autofix + fb's amazing http://npm.im/jscodeshift

Todo

--dry          Display diffs instead of rewriting files  [Default: `false`].
--changed      Populate `<file>...` based on local changes via `git status` [Default: `false`].

--changed

Use git ls-files to populate opts.files

--dry

Display diffs only and don't overwrite files.

Atom Package

Just need to publish to apm? Just want one source of truth and to be able to delete the 100's of duplicate .jsfmtrc files across our projects.

esformatter-collapse-objects

It's really nice, but needs a little time to tweak configs a bit to aggree w/ eslint rules. This allows for:

var res = {formatted: [], unchanged: []};

instead of always forcing:

var res = {
  formatted: [],
  unchanged: []
};

License

Apache 2

fmt-2's People

Contributors

greenkeeper[bot] avatar imlucas avatar shum avatar

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.