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

@detra-lab/eslint-config

v3.2.0

Published

ESLint configuration for JavaScript, TypeScript, and React. Modular and opinionated.

Downloads

258

Readme

ESLint Config

NPM Version NPM Downloads CI Status

ESLint configurations for JavaScript, TypeScript, and React. Modular and opinionated.

Please note that this ESLint configuration does not include code formatting rules, as those are handled by Prettier. To handle code formatting, you can use @detra-lab/prettier.

Why use our configuration?

  • Up-to-date: Our configurations are designed to incorporate the latest updates from the ESLint ecosystem.
  • Modular: We support a variety of syntaxes beyond modern JavaScript, including TypeScript, and React.
  • Separation of Concerns: We focus on linting rules and do not include formatting rules, as those are better handled by Prettier.

Installation and usage

  1. Install the required dependencies:

    pnpm add -D @detra-lab/eslint-config eslint
  2. Create a .eslintrc.json file in the root of your project and extend it with our configuration:

    {
      "root": true,
      "extends": "@detra-lab/eslint-config"
    }

    If you need to support multiple environments and syntaxes, such as TypeScript or React, we provide pre-built configurations. You can extend them as shown below:

    {
      "root": true,
      "extends": [
        "@detra-lab/eslint-config",
        "@detra-lab/eslint-config/react"
      ]
    }
    {
      "root": true,
      "extends": [
        "@detra-lab/eslint-config",
        "@detra-lab/eslint-config/typescript"
      ],
      "parserOptions": {
        // Be sure to update the `project` value with the exact location of your `tsconfig.json` file.
        // For mono-repos, the location may be `./packages/*/tsconfig.json`.
        // Check https://typescript-eslint.io/packages/parser/#project for more guidance.
        "project": ["./tsconfig.json"]
      }
    }
    {
      "root": true,
      "extends": [
        "@detra-lab/eslint-config",
        "@detra-lab/eslint-config/typescript"
        "@detra-lab/eslint-config/react"
      ],
      "parserOptions": {
        // Be sure to update the `project` value with the exact location of your `tsconfig.json` file.
        // For mono-repos, the location may be `./packages/*/tsconfig.json`.
        // Check https://typescript-eslint.io/packages/parser/#project for more guidance.
        "project": ["./tsconfig.json"]
      }
    }
  3. Use the ESLint CLI to check supported files. Add the following line to your package.json under the scripts property:

    {
      "scripts": [
    +   "check:src": "eslint . --ignore-path .gitignore"
      ]
    }

    To support multiple file extensions, modify the script to match the correct files:

    {
      "scripts": [
    +   "check:src": "eslint . --ext .js,.jsx,.ts,.tsx --ignore-path .gitignore"
      ]
    }
  4. Lint your code with ESLint:

    pnpm run check:src

Extending the configuration

Extend and override specific rules by adding them to the rules property in the .eslintrc.json file.

{
  "extends": [
    "@detra-lab/eslint-config",
    "@detra-lab/eslint-config/typescript"
  ],
  "parserOptions": {
    "project": true
  },
  "env": [
    // Your environments (which contains several predefined global variables)
    //
    // browser: true,
    // node: true,
    // mocha: true,
    // jest: true,
    // jquery: true
  ],
  "globals": {
    // Your global variables (setting to `false` means it's not allowed to be reassigned)
    //
    // myGlobal: false
  },
  "rules": {
    // Standard rules customisation
  }
}

Integration with IDEs/editors

  1. Add the following code to your .vscode/settings.json file:
    "editor.codeActionsOnSave": {
      "source.fixAll.eslint": "explicit"
    },
    "eslint.validate": ["javascript"] // Add the types of files you want to validate (e.g. "typescript", "javascriptreact", "typescriptreact"])

Code of Conduct

Help us keep the project open and inclusive. Please read and follow our Code of Conduct.

Contributing

Read our contributing guide to learn about our development process, how to propose bug fixes and improvements, and how to build and test your changes.

Acknowledgments

Thanks to the following projects for their contributions:

License

Apache License 2.0