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

eslint-config-magenta

v3.0.0

Published

ESLint configuration for TypeScript best practices

Downloads

16

Readme

eslint-config-magenta

This shared ESLint config for TypeScript + Node.js is a strict, opinionated set of rules enforcing best practices.

NPM Version License Supported ESLint Versions Supported TypeScript Versions Unit Test Results

eslint-config-magenta helps you…

  • :rocket: …write readable code with enforced complexity limits and consistent style.
  • :pencil: …avoid common pitfalls like dynamic delete and unguarded for…in loops.
  • :construction: …remove debugging artifacts like console.log and FIXME comments before you commit.
  • :mag: …discover ways to optimize your code for type safety and speed.

Installation

This package has several peer dependencies that must be present for it to work properly.

  • eslint (linter)
  • @typescript-eslint/
    • parser (typescript parser for ESLint)
    • eslint-plugin (linter rules for ESLint)
  • typescript (type checker)
  • eslint-plugin-unicorn
  • eslint-plugin-node
  • eslint-plugin-deprecation

Use your favorite package manager to install. If your package manager does not install peer dependencies automatically (default behavior with pnpm and yarn), you can copy one of these commands to install everything at once.

pnpm add -D eslint-config-magenta eslint-plugin-deprecation eslint-plugin-unicorn eslint-plugin-node @typescript-eslint/parser @typescript-eslint/eslint-plugin eslint typescript
# or
yarn add -D eslint-config-magenta eslint-plugin-deprecation eslint-plugin-unicorn eslint-plugin-node @typescript-eslint/parser @typescript-eslint/eslint-plugin eslint typescript
# or
npm i -D eslint-config-magenta eslint-plugin-deprecation eslint-plugin-unicorn eslint-plugin-node @typescript-eslint/parser @typescript-eslint/eslint-plugin eslint typescript

Usage

Add one of the following to your ESLint config:

// .eslintrc.cjs
module.exports = {
    extends: ["magenta"],
    parserOptions: {
        project: "./tsconfig.json",
    },
};
// .eslintrc.json
{
    "extends": ["magenta"],
    "parserOptions": {
        "project": "./tsconfig.json"
    }
}
# .eslintrc.yaml
extends:
    - magenta
parserOptions:
    project: ./tsconfig.json

Can I disable all of the node/unicorn rules?

Yes. You can use rulesets independently by extending magenta/base, magenta/unicorn, and/or magenta/node in your ESLint config. For example, to only enforce the base rules and eslint-plugin-unicorn rules:

{
    "extends": ["magenta/base", "magenta/unicorn"],
    // ...
}

If you're not using the configuration for one of eslint-plugin-unicorn or eslint-plugin-node, you can uninstall that plugin.

Why can't I import Node.js core modules (fs, util, child_process, etc)?

This linter config prefers using the node: protocol to import core modules. Consider adding this prefix (e.g. node:fs, node:assert/strict) or disabling @typescript-eslint/no-restricted-imports.