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

@thomaschaplin/eslint-config

v1.0.1

Published

Thomas Chaplin's eslint config

Downloads

13

Readme

eslint-config

Preferring ES6, readability and low ambiguities. Extends the recommended ruleset with some useful additions.

Setup Guide

Follow the below steps to setup ESLint using this custom configuration

JavaScript

  • npm install eslint --save-dev
  • npm install @thomaschaplin/eslint-config --save-dev
  • touch .eslintrc
  • Add the below snippet into your .eslintrc file
  • Add the below script snippet into your package.json file

.eslintrc snippet

{
    "extends": ["@thomaschaplin"]
}

package.json snippet

"scripts": {
    "lint:js": "./node_modules/eslint/bin/eslint.js 'src/**/*.js'",
    "lintFull": "npm run lint:js -- --fix"
}

TypeScript

Follow all of the steps for the JavaScript setup

  • npm install typescript --save-dev
  • npm install @typescript-eslint/eslint-plugin --save-dev
  • npm install @typescript-eslint/parser --save-dev
  • Add the below snippet into your .eslintrc file
  • Add the below script snippet into your package.json file

.eslintrc snippet

{
    "extends": ["@thomaschaplin"],
    "plugins": ["@typescript-eslint"],
    "parser": "@typescript-eslint/parser",
    "parserOptions": {
        "ecmaVersion": 6,
        "sourceType": "module",
        "ecmaFeatures": {
            "modules": true
        }
    }
}

package.json snippet

"scripts": {
    "lint:ts": "./node_modules/eslint/bin/eslint.js 'src/**/*.ts'",
    "lintFull": "npm run lint:ts -- --fix"
}

Rules in detail

Environments: node, es6, browser

Unless noted, all rules are errors.

| Rule | Description | | ------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------- | | arrow-parens | Always wrap function arguments in brackets. | | brace-style | Curly brackets start after the keyword, not underneath. | | comma-dangle | Dangling commas in multiline objects, functions, arrays. | | complexity | Maximum cyclomatic complexity of 3 to enforce highly maintaineable code (warning). | | curly | Curly brackets after if statements to avoid ambiguity when line breaks occur. | | eol-last | Empty line at the end of the file. | | func-call-spacing | Brackets () to invoke a function have to stand right next to the function name. | | global-require | require() statements should be at the top of the file (warning). | | linebreak-style | UNIX linebreaks. | | no-await-in-loop | Disallow await in loops (should use Promise.all() instead). | | no-default-export | Only allow named exports for increased consistency and clarity when importing modules. | | no-floating-decimal | Numbers have to be clear, i.e. 0.4 instead of .4. | | no-implicit-coercion | Converting types from one to another have to be explicit. | | no-lone-blocks | No curly brackets unless necessary. | | no-lonely-if | Use else if instead of a lonely if wrapped inside an else. | | no-loop-func | Functions cannot be declared inside loops, they should be declared outside. | | no-template-curly-in-string | Avoid confusion whether a string is templated or not. | | no-throw-literal | Throw errors explicitly, not just strings or values. | | no-var | Use ES6 block-scopedconst and let, never var. | | one-var | Don't declare multiple variables in one line. | | prefer-const | let should only be used where reassignment is necessary. | | prefer-promise-reject-errors | Promises should be rejected with a clear error, not a simple value. | | prefer-spread | Use ES6 spread operator instead of difficult to understand ES5 .apply(). | | prefer-template | Use template strings instead of string concatenation (warning). | | quotes | Use unescaped double quotes. | | require-await | async functions should perform an await, otherwise async keyword is unnecessary. | | semi | Don't use semicolons. | | yoda | Don't use unintuitive conditions. |