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

@mlaursen/eslint-config

v5.2.0

Published

An eslint config used by mlaursen for most projects.

Downloads

261

Readme

eslint-config

A reusable eslint config that I use for most of my projects.

Starting at 5.0.0, I only support eslint@^9 or greater.

Installation

npm install -D eslint @mlaursen/eslint-config

Then create an eslint.config.mjs with the following:

// @ts-check
import { config, configs, gitignore } from "@mlaursen/eslint-config";

// choose the config you want to use:
// somewhat strict type checking
export default config(gitignore(import.meta.url), ...configs.frontend);

// strict type checking
export default config(gitignore(import.meta.url), ...configs.frontendTypeChecking(import.meta.dirname));

// NOTE: This is recommended for strict type checking. Callable as:
// `cross-env STRICT_TYPING=true eslint "**/*.{ts,tsx,mts,mtsx,js,jsx,mjs,cjs}`
//
// strict type checking with an environment variable. uncomment the following
// line to enable it in your editor
// const strict = true || process.env.STRICT_TYPING === 'true';
const strict = process.env.STRICT_TYPING === 'true';
const frontend = strict ? configs.frontendTypeChecking(import.meta.dirname) : configs.frontend
export default (gitignore(import.meta.url), ...frontend);

The config export is the typescript-eslint.config() function to provide type definitions and gitignore automatically ignores files from linting based on your .gitignore rules.

Configs

I normally just use the frontend or frontendTypeChecking configs, but the others can be used individually if needed.

base

The base config is automatically used by the typescript config and is just the eslint.configs.recommended and a few other stylistic changes.

This should not be used if the typescript or typescriptTypeChecking configs are used.

// @ts-check
import { config, configs } from "@mlaursen/eslint-config";

export default config(...configs.base);

typescript

This extends the base config and the tseslint.configs.strict config. It also includes a few stylistic choices for type behavior and disabled strict rules in test files.

Only this rule or typescripttypechecking should be used. They should not be used together.

// @ts-check
import { config, configs } from "@mlaursen/eslint-config";

export default config(...configs.typescript);

typescriptTypeChecking

This is the same as the typescript config but also includes the tseslint.configs.strictTypeCheckedOnly config.

Only this rule or typescript should be used. They should not be used together.

// @ts-check
import { config, configs } from "@mlaursen/eslint-config";

export default config(...configs.typescriptTypeChecking(import.meta.dirname));

jest

This only enables the eslint-plugin-jest.configs['flat/recommended] rules on tests files.

// @ts-check
import { config, configs } from "@mlaursen/eslint-config";

export default config(...configs.jest);

jestDom

This only enables the eslint-plugin-jest-dom.configs['flat/recommended] rules on tests files.

// @ts-check
import { config, configs } from "@mlaursen/eslint-config";

export default config(...configs.jestDom);

testingLibraryReact

This enables the eslint-plugin-testing-library/.configs["flat/react] plugin and rules on test files.

// @ts-check
import { config, configs } from "@mlaursen/eslint-config";

export default config(...configs.testingLibraryReact);

testingLibraryDom

This enables the eslint-plugin-testing-library/.configs["flat/dom] plugin and rules on test files.

This should not be used with the testingLibraryReact rules

// @ts-check
import { config, configs } from "@mlaursen/eslint-config";

export default config(...configs.testingLibraryDom);

react

This enables the eslint-plugin-react and eslint-plugin-react-hooks:

// @ts-check
import { config, configs } from "@mlaursen/eslint-config";

export default config(...configs.react);

jsxA11y

This enables eslint-plugin-jsx-a11y:

// @ts-check
import { config, configs } from "@mlaursen/eslint-config";

export default config(...configs.jsxA11y);

next

This is a small wrapper around the @next/eslint-plugin-next that works with eslint v9.

// @ts-check
import { config, configs } from "@mlaursen/eslint-config";

export default config(...configs.next);

frontend

This is my normal frontend repo setup with react, jsxA11y, jest, jest-dom, typescript, testing-library/react.

// @ts-check
import { config, configs } from "@mlaursen/eslint-config";

export default config(...configs.frontend);

frontendTypeChecking

Same as the frontend, but enables the strict type checking.

// @ts-check
import { config, configs } from "@mlaursen/eslint-config";

export default config(...configs.frontendTypeChecking(import.meta.dirname));