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

@illumini/eslint-config

v0.7.0

Published

Illumini's base ESLint configuration.

Downloads

2

Readme

eslint-config

This package provides Illumini's base ESLint configuration.

Pairs well with our Prettier configuration.

Table of Contents

Installation

This package has several peer dependencies.

Run npm info "@illumini/eslint-config@latest" peerDependencies to list the peer dependencies and versions.

  1. Install all dependencies

    • Option 1: With npx

      npx install-peerdeps --dev @illumini/eslint-config

      Note: npx is a package runner that comes with npm 5.2 and higher that makes installing peer dependencies easier

    • Option 2: Without npx

      npm install --save-dev @illumini/eslint-config eslint babel-eslint prettier eslint-config-prettier eslint-plugin-import
      
      # or
      
      yarn add --dev @illumini/eslint-config eslint babel-eslint prettier eslint-config-prettier eslint-plugin-import
  2. Create an .eslintrc file at the root of your project with the following:

    {
      "extends": "@illumini"
    }

Configurations

We export four ESLint configurations for your usage:

  1. Default
  2. TypeScript
  3. React
  4. React Native

Default Config

npm install --save-dev @illumini/eslint-config eslint babel-eslint prettier eslint-config-prettier eslint-plugin-import

In your .eslintrc:

{
  "extends": "@illumini"
}

NOTE: Make sure to specify your environment based on your project

TypeScript Config

Includes everything in the default config, plus environment specification and typescript-specific rules with

npm install --save-dev @illumini/eslint-config eslint babel-eslint prettier eslint-config-prettier eslint-plugin-import typescript @typescript-eslint/parser @typescript-eslint/eslint-plugin

In your .eslintrc:

{
  "extends": "@illumini/eslint-config/typescript"
}

React Config

Includes everything in the default and TypeScript config, plus environment specification and react-specific rules with

npm install --save-dev @illumini/eslint-config eslint babel-eslint prettier eslint-config-prettier eslint-plugin-import eslint-plugin-react-hooks typescript @typescript-eslint/parser @typescript-eslint/eslint-plugin eslint-plugin-react eslint-plugin-jsx-a11y

In your .eslintrc:

{
  "extends": "@illumini/eslint-config/react"
}

React Native Config

Includes everything in the default, TypeScript and React config, plus environment specification and react-native specific rules with

npm install --save-dev @illumini/eslint-config eslint babel-eslint prettier eslint-config-prettier eslint-plugin-import eslint-plugin-react-hooks typescript @typescript-eslint/parser @typescript-eslint/eslint-plugin eslint-plugin-react eslint-plugin-jsx-a11y @react-native-community/eslint-config

In your .eslintrc:

{
  "extends": "@illumini/eslint-config/react-native"
}

Specifying Environments

Our default config purposefully does not specify a certain environment as to not make any assumptions about your project. The only environment we do specify be default is es6. You can see all the default settings here.

Therefore, you should specify your project's environment yourself in your ESLint config. For example:

{
  "extends": "@illumini",
  "env": {
    "browser": true,
    "node": true
  }
}

View all available environments in the ESLint Docs

Editor Integration & Autoformatting

Once you've installed the config, you probably want your editor to lint and fix your code for you.

VS Code

  1. Install the ESLint extension: View → Extensions then find and install ESLint

  2. Reload the editor

  3. In your VS Code user settings Code/File → Preferences → Settings or CMD/CTRL + , click the {} icon in the top right corner to modify your settings.json file

    "eslint.alwaysShowStatus": true,
    // An array of language identifiers specify the files to be validated
    "eslint.validate": [
      { "language": "html", "autoFix": true },
      { "language": "javascript", "autoFix": true },
      { "language": "javascriptreact", "autoFix": true },
      { "language": "typescript", "autoFix": true },
      { "language": "typescriptreact", "autoFix": true }
    ],
    // Turn off prettier extension for js, jsx, ts, tsx files since we're handling that with ESLint
    "prettier.disableLanguages": [
      "javascript",
      "javascriptreact",
      "typescript",
      "typescriptreact"
     ],

Pre-commit Hook

As another line of defence, if you want ESLint to automatically fix your errors on commit, you can use lint-staged with husky, which manages git hooks.

  1. npm install --save-dev lint-staged husky

  2. In your package.json:

    {
      "lint-staged": {
        "*.js": ["eslint --fix"]
      },
      "husky": {
        "hooks": {
          "pre-commit": "lint-staged"
        }
      }
    }

Publishing to npm

Read npm's docs on How to Update a Package.

  1. npm login
    • Make sure you're logged into illumini's npm account with the credentials from 1pass. npm whoami will tell you if you're already logged in.
  2. npm version <update_type>
    • update_type can be patch, minor, or major. If you don't know which one to use, read up about semantic versioning.
  3. npm publish

Overriding Rules

If you'd like to override any rules, you can add the rules to your .eslintrc file.

{
  "extends": "@illumini",
  "rules": {
    "no-console": "off"
  }
}