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

@bsokol/eslint-config

v7.0.1

Published

Configures your React/Native/Node + TypeScript project for ESLint and Prettier

Downloads

56

Readme

@bsokol/eslint-config

npm Version License Monthly Downloads Known Vulnerabilities

I created this library to make it easier for me to stand up a new project. It uses sensible recommended defaults, in addition to some of my personal preferences. You can override the various rules by altering your ESLint config file.

This project uses itself for linting and formatting.

Documentation

The full list of activated rules can be found here.

This library adheres to semantic versioning. This means that any change to a rule could be a breaking change for your projects. Therefore, any rule changes will be published as a new major version.

Prerequisites

You must install the following peer dependencies:

  • ESLint @ ^8
  • Prettier @ >=2
  • TypeScript @ >=4

The exact versions may depend on your existing installation or needs. Here are example commands to install the latest versions:

npm install eslint@^8 prettier typescript --save-dev
yarn add eslint@^8 prettier typescript --dev

Installation

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

React + TypeScript

This will configure ESLint with the following presets/plugins:

The list of configured rules can be found here.

ESLint Configuration

Create a file called .eslintrc.js (or the file format of your choosing) with this config:

module.exports = {
    extends: ['@bsokol/eslint-config/react-typescript'],
};

Node + TypeScript

This will configure ESLint with the following presets/plugins:

The list of configured rules can be found here.

ESLint Configuration

Create a file called .eslintrc.js (or the file format of your choosing) with this config:

module.exports = {
    extends: ['@bsokol/eslint-config/node-typescript'],
};

React Native + TypeScript

NOTE: This configuration is EXPERIMENTAL. I haven't had a chance to really use it in a React Native project. The plugin is configured and rules are set to sensible defaults. See the docs for more information on how to change the rules.

This will configure ESLint with the following presets/plugins:

The list of configured rules can be found here.

ESLint Configuration

Create a file called .eslintrc.js (or the file format of your choosing) with this config:

module.exports = {
    extends: ['@bsokol/eslint-config/react-native-typescript'],
};

Jest

This will configure ESLint with the following presets/plugins:

  • Jest rules & globals

The list of configured rules can be found here.

ESLint Configuration

This preset is an add-on to one of the other preset packages and it assumes your test files will be written in TypeScript. To use this preset, add it to the extends property of your config after the main preset. For example:

module.exports = {
    extends: ['@bsokol/eslint-config/react-typescript', '@bsokol/eslint-config/jest'],
};

Prettier Configuration

By default, Prettier will use its own defaults, but you can override them by creating a Prettier config file. The following is an example configuration.

Create a file called prettier.config.js (or the file format of your choosing) with a config similar to this:

module.exports = {
    tabWidth: 4,
    printWidth: 100,
    trailingComma: 'es5',
    singleQuote: true,
    overrides: [
        {
            files: '*.json',
            options: {
                tabWidth: 2,
            },
        },
    ],
};

See the configuration guide for more configuration options.

Browserslist Configuration

By default, the language features you use in your code will be linted against the available features in the following browserslist configuration ("defaults"):

> 0.5%, last 2 versions, Firefox ESR, not dead

For more advanced setup and overrides, follow the instructions in the browserslist documentation.