npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

js-babel-dev

v6.0.7

Published

Consolidated babel dev-dependencies.

Downloads

72

Readme

js-babel-dev

Consolidated Babel development dependencies.

The development tools comprise of:

  • Linting tools.
  • Babel CLI (for building to ES5 from scripts).

IMPORTANT

Do not reference this library unless you are happy staying in with the babel transpiler plugins used by my modules and other idiomatic decisions that I make.

Install

A single dependency will bring all the standard babel development dependencies:

npm install --D js-babel js-babel-dev

Typically you'll want to keep js-babel within the devDependencies, however the core Babel language libs are kept separate from the development tools enabling you to distribute the core language libraries with a module and avoid the extra weight of the linting and CLI tools.

Configuration

Example: package.json
{
  "scripts": {
    "test": "./node_modules/mocha/bin/mocha --recursive --compilers js:babel-register",
    "tdd": "./node_modules/mocha/bin/mocha --recursive --compilers js:babel-register --watch",
    "lint": "eslint ./src",
    "build": "babel src --out-dir lib --source-maps",
    "build:watch": "npm run build -- --watch",
    "prepublish": "npm test && npm run lint && npm run build"
  },
  "devDependencies": {
    "js-babel": "^6.0.0",
    "js-babel-dev": "^6.0.0"
  }
}

When linting modules with JSX use:

{
  "lint": "eslint --ext .js,.jsx ./src",  
}
Example: .babelrc
{
  "presets": ["es2015", "stage-0"],
  "plugins": ["transform-class-properties"]
}

Example: .eslint

{
  "parser": "babel-eslint",
  "extends": "airbnb",
  "rules": {
    "no-multiple-empty-lines": 0,
    "no-param-reassign": 0,
    "padded-blocks": 0    
  }
}

Additional rules for React:

{
  "rules": {
    "new-cap": [0, { "capIsNewExceptions": ["React.Component"] }],
    "react/jsx-closing-bracket-location": [2, { "location": "after-props" }]    
  }
}

Note: The babel-preset-react is not included. Reference the UIHarness for a compact and complete set of UI centric Babel presets.

Building ES6 =>ES5

npm run build
npm run build:watch

Linting

npm run lint

Linting uses the AirBnB style guide and corresponding Eslint based linter.

Why the AirBnB style guide?

When evaluating a number of JS styleguides the AirBnB guide was at the top of the list with respect to popularity. This was echoed in the number of stars on the Github repository (~29K at time or writing) compared to the second most popular style guide (ideomatic.js) which sat at ~10k.

Given styleguides are largely about attempting to standardize to the common norms ("code should look like it was authored by one person") unless the most popular option is flat-out insane, I feel the popularist decision has the most payoff.

Furthermore the AirBnB styleguide seemed to have the most up-to-date support for babel plugins to Eslint.

Tests

npm install
npm test

License: MIT