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

@parkhub/eslint-config-parkhub-base

v1.2.3

Published

Parkhub's Canonical base Javascript eslint rules!

Downloads

20

Readme

eslint-config-parkhub-base

Parkhub's very own canonical Javascript style guide. Well, some of it :D. Based off airbnb's style guide with some minor modifications. This are the base rules(non-React)

Build Status Code Coverage Dependencies version MIT License PRs Welcome Roadmap Semantic Release Commitizen

Watch on GitHub Star on GitHub Tweet

Install

You must install peerDependencies.

To list them:

npm info @parkhub/eslint-config-parkhub-base peerDependencies

Then install them by running:

npm install -D <dependency:version>

Or, in your OSX/Linux:

(
  export PKG=@parkhub/eslint-config-parkhub-base;
  npm info "$PKG@latest" peerDependencies --json | command sed 's/[\{\},]//g ; s/: /@/g' | xargs npm install -D "$PKG@latest"
)

Usage

In your .eslintrc or .eslintrc.js add:

"extends": "parkhub-base"

Differences

newline-per-chained-call

Reasoning: a depth of 4 is too deep. Much cleaner at two Parkhub's configs:

"newline-per-chained-call": ["error", { ignoreChainWithDepth: 2 }]

These will FAIL(from ESlint docs):


_.chain({}).map(foo).filter(bar).value();

// Or
_.chain({}).map(foo).filter(bar);

// Or
_
  .chain({}).map(foo)
  .filter(bar);

// Or
obj.method().method2().method3();

These will PASS(from ESlint docs):

_
  .chain({})
  .map(foo)
  .filter(bar)
  .value();

// Or
_
  .chain({})
  .map(foo)
  .filter(bar);

// Or
_.chain({})
  .map(foo)
  .filter(bar);

// Or
obj
  .prop
  .method().prop;

// Or
obj
  .prop.method()
  .method2()
  .method3().prop;

###comma-dangle Reasoning: Although the benefits of comma-dangles shine in diffs. They don't in looks. Parkhub's configs:

"comma-dangle": ["error", "never"]

These will FAIL(from ESlint docs)

const foo = {
    bar: "baz",
    qux: "quux",
};

const arr = [1,2,];

foo({
  bar: "baz",
  qux: "quux",
});

These will PASS(from ESlint docs):

const foo = {
    bar: "baz",
    qux: "quux"
};

const arr = [1,2];

foo({
  bar: "baz",
  qux: "quux"
});

###import/no-commonjs Reasoning: This is Airbnb's. We only enforce the rule. Parkhub's configs:

    "import/no-commonjs": "error"

Additional Rules

Our chosen test runner of choice is [Jest][jest] due to its compatibility with [React][react]. Therefore, we added some additional rules that apply to tests using eslint-plugin-jest

Parkhub's configs:

  "rules": {
    "jest/no-disabled-tests": "warn",
    "jest/no-focused-tests": "error",
    "jest/no-identical-title": "error"
  },
  "env": {
    "jest/globals": true
  }

You can read about each rule in the plugin's docs.

Want changes?

These rules were agreed upon once upon a time and can be changed with valid reasoning. They will be updated as newer versions of Javascript features are released. If you want to request a change, create a PR and make the change and include your reasoning.

Tips

USE Prettier! It will fix your code for you. Trust me. Check out this repo to learn how to set it up.

LICENSE

MIT