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

@finga/eslint-config

v1.2.2

Published

Eslint pack for Typescript web apps or libs

Downloads

1,102

Readme

@finga/eslint-config

This is a ready-for-action Eslint pack for TypeScript web projects and libs.

This pack verifies both syntax and semantics sanity, and formatting. So you do not need to use Prettier.

Install

npm i -D eslint @typescript-eslint/eslint-plugin@^5 \
github:fingerartur/eslint-plugin-import \
@finga/eslint-config

Configure

Create .eslintrc.js file with the following config:

// ./.eslintrc.js

module.exports = {
    root: true,
    extends: [ "@finga" ],
}

Create a dedicated tsconfig.eslint.json file, which will be used solely to tell Eslint what files it should process.

// ./tsconfig.eslint.json

{
  "include": [
    "**/*.ts",
    "**/*.js"
  ],
}

This tsconfig file is be used by default. If it does not exist, ESlint will still work, it will fall back to using tsconfig.json.

What does it do anyway?

It applies basic Eslint rules for JS and TS recommended by the authors of Eslint.

{
  extends: [
    "eslint:recommended",
    "plugin:@typescript-eslint/recommended",
    "plugin:@typescript-eslint/recommended-requiring-type-checking",
  ]
}

It applies awesome Eslint rules for import sorting and deduplication, with is a really powerful tool for resolving merge conflicts of module exports. (Just accept both changes and let Eslint do its magic.) Import sorting is powered by github:fingerartur/eslint-plugin-import.

{
  extends: [
    "plugin:import/errors",
    "plugin:import/warnings",
    "plugin:import/typescript",
  ]
}

It applies more relaxed Eslint rules for your JS config files, such as webpack.config.js, jest.config.js, etc.

(In general any JS file in the top level of your project is treated as a config file which runs in node environment, and it is not checked so strictly as source code.)

And lastly it applies a extra bunch of formatting rules

  • indent with 2 spaces
  • no semicolons
  • max line length 160 chars
  • enforce dangling comma
  • use single quotes only
  • enforce curly braces for if statements
  • enforce that object keys are not in quotes unless absolutely necessary
  • allow empty functions
  • allow rich auto-inference of TS types across functions and files

To learn precisely what configs are applied go and check out the config file.

Changelog

  • v1.2.2
    • Un-ignore directories lib, out, docs, doc.
  • v1.2.1
  • v1.2.0
    • Added support for JS config files such as webpack.config.js and jest.config.js
    • Automatically uses ./tsconfig.eslint.json if possible, the fallback is ./tsconfig.json if it exists, otherwise the TSconfig file must be configured manually
  • v1.1.0
    • Added rule to remove quotes around object keys
  • v1.0.0
    • TS, JS rules, import ordering, formatting rules