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

@nickkaramoff/eslint-config

v0.4.0

Published

Nikita Karamov's shareable ESLint config

Downloads

14

Readme

@nickkaramoff/eslint-config

My own shareable ESLint config.

This config enforces reasonable code style rules for style for JavaScript and TypeScript codebases. Each rule has a reason why it was added (see below).

Usage

npm install --save-dev @nickkaramoff/eslint-config
yarn add --dev @nickkaramoff/eslint-config

Then, in your ESLint config:

{
  "extends": "@nickkaramoff"
}

Rules

Every --fixable rule is always an error.

array-bracket-newline: consistent

Consistency is key to code readability. Placing a line break in arrays increases readability, but for arrays like [1, 2, 3] it is unnecessary.

camelcase

camelCase is used by most JavaScript developers. I also find it more beautiful than any other naming convention.

comma-dangle: always-multiline

Dangling commas at the end of multi-line literals (arrays, objects) can clean up your git diffs and save your from conflicts.

complexity

Reducing the cyclomatic complexity of the code improves readability and reduces error risk. This is not an enforcement though, but a recommendation.

curly: all

Not using curly braces in if, while and other statements decreases the code readability significantly. Nesting is fine, but I go for consistency in code.

dot-location: property

When the attribute dot is placed after the object, the subsequent property name on the new line seems out of place. Placing the dot at the property increases readability. Seeing, that there is neither a dot nor a semi near the object tells us to look at the next line, where the dot will explain the reason for the line break.

dot-notation

It is cleaner and more correct to access an object's properties via a dot. If you use JS objects as dictionaries, don't — there is a Map for that.

eol-last: always

Add an EOL at the end of the files to be able to concatenate them easily or output them to terminal without errors.

eqeqeq: always

=== is typesafe and will save you tons of headache when comparing things in JavaScript. null is not ignored for consistency.

for-direction

Saves you from for loops that run endlessly because of a faulty counter.

indent: tab

Using Tabs lets people choose their desired indent size while keeping the file size smaller. A double win!

  • offsetTernaryExpressions: true, because this is more correct visually
  • SwitchCase: 1, because this increases readability

linebreak-style: unix

Unix-style linebreaks are cleaner and take less space. IMO, LF should be a standard for line endings (and it de facto is). Every major editor (even notepad.exe) supports it as of 2020.

no-extra-semi

Extra semicolons are unnecessary and pollute source code.

no-implicit-coercion

Shorthands like !!foo and +bar for type casting can be clean at the first glance but they are unclear, especially for the beginners.

no-trailing-spaces

Trailing spaces are useless and only take space.

quotes: single

Single quotes are easier to type and look cleaner.

  • allowTemplateLiterals: false, because it's unnecessary when you don't use interpolation
  • avoidEscape: true, because escaping looks even less clean than double quotes

semi: always

Mandatory semicolons help people make less errors by not making them think about where JavaScript will automatically insert them.

semi-spacing

Spaces are only allowed after semicolons, just like in written languages.

wrap-iife: inside

IIFEs can be confusing, but wrapping the function separately from the call (and Function's methods) is IMO the cleanest solution.

  • functionPrototypeMethods: true, because methods of Function are, just like the function calls, separate from the function body

yoda: never

Yoda-style conditions are unnatural for the English language (which JS is based on)

Licence

ISC © 2020-2021, Nikita Karamov