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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@ngvihoa/eslint-config-best-practices

v0.1.3

Published

Reusable ESLint flat config presets for JavaScript, TypeScript, React, Next.js, and Node projects.

Readme

ESLint Config Best Practices

Reusable ESLint flat config presets for JavaScript, TypeScript, React, Next.js, and Node projects.

Install

npm install --save-dev eslint @ngvihoa/eslint-config-best-practices

Usage

Create eslint.config.cjs in your project:

const { base } = require("@ngvihoa/eslint-config-best-practices")

module.exports = base

For Node projects:

const { node } = require("@ngvihoa/eslint-config-best-practices")

module.exports = node

For TypeScript projects:

const { typescript } = require("@ngvihoa/eslint-config-best-practices")

module.exports = typescript

For React + TypeScript projects:

const { react } = require("@ngvihoa/eslint-config-best-practices")

module.exports = react

For Next.js projects:

const { next } = require("@ngvihoa/eslint-config-best-practices")

module.exports = next

If your Next.js project uses eslint.config.mjs:

import { defineConfig, globalIgnores } from "eslint/config"
import config from "@ngvihoa/eslint-config-best-practices"

const eslintConfig = defineConfig([
  globalIgnores([".next/**", "out/**", "build/**", "next-env.d.ts"]),
  ...config.next,
])

export default eslintConfig

Do not combine this preset with eslint-config-next/core-web-vitals or eslint-config-next/typescript in the same flat config. The next preset already includes React, TypeScript, and official Next.js rules, so combining both configs can redefine plugins such as jsx-a11y. Use globalIgnores for app-specific ignore patterns instead.

Fix On Save

Install the VS Code ESLint extension:

dbaeumer.vscode-eslint

Then add this to your project-level .vscode/settings.json:

{
  "eslint.workingDirectories": [
    {
      "mode": "auto"
    }
  ],
  "[javascript][javascriptreact][typescript][typescriptreact]": {
    "editor.codeActionsOnSave": {
      "source.fixAll.eslint": "always"
    }
  },
  "eslint.validate": [
    "javascript",
    "javascriptreact",
    "typescript",
    "typescriptreact"
  ]
}

This lets ESLint fix auto-fixable rules whenever you save a file, such as sorting imports with best-practices/sort-imports, removing semicolons from semi, cleaning unused imports from unused-imports/no-unused-imports, and applying other safe ESLint fixes.

If you are updating this package, you should run ESLint: Restart ESLint Server from the VS Code Command Palette. Use View > Output > ESLint to diagnose extension or working-directory errors.

If you also use Prettier on save, make sure Prettier does not add semicolons back after ESLint removes them. Add a project-level .prettierrc:

{
  "semi": false
}

If you prefer to run fixes manually, use:

npx eslint . --fix

Running ESLint without --fix only reports problems:

npx eslint .

Import Sorting

The base, typescript, react, and next presets enable the auto-fixable best-practices/sort-imports rule. It works with import-x/order to apply this group order:

  1. Type imports
  2. Node built-ins
  3. External packages
  4. Internal aliases such as @/ and ~/
  5. Parent imports
  6. Sibling and index imports, including stylesheet side effects

Within a group, imports are arranged by single-line named, multiline named, and default/side-effect form. Named specifiers in multiline imports are sorted by descending length.

Save a file with imports scattered like this:

import "./product.css"
import ProductDetails from "./ProductDetails"
import Image from "next/image"
import { formatCurrency } from "../lib/currency"
import {
  Price,
  AddToWishlistButton,
  ProductGallery,
} from "@/features/catalog"
import { readFile } from "node:fs/promises"
import type { ProductPageProps } from "@/features/catalog/types"
import { notFound } from "next/navigation"

ESLint rewrites the entire import section into a predictable dependency map:

import type { ProductPageProps } from "@/features/catalog/types"

import { readFile } from "node:fs/promises"

import { notFound } from "next/navigation"
import Image from "next/image"

import {
  AddToWishlistButton,
  ProductGallery,
  Price,
} from "@/features/catalog"

import { formatCurrency } from "../lib/currency"

import ProductDetails from "./ProductDetails"
import "./product.css"

Presets

  • base: JavaScript recommended rules, custom import sorting, unused import cleanup, and general code-quality rules.
  • node: base plus Node globals and console-friendly defaults.
  • typescript: base plus typescript-eslint recommended and type-aware rules.
  • react: typescript plus React, React Hooks, JSX runtime, and accessibility rules.
  • next: react plus official Next.js recommended and Core Web Vitals rules.

Per-File Documentation

Each .cjs file has Vietnamese and English documentation explaining its purpose, rules, and tradeoffs.

| File | Vietnamese | English | | ------------------------ | ------------------------------ | ------------------------------ | | index.cjs | VI | EN | | eslint.config.cjs | VI | EN | | configs/base.cjs | VI | EN | | configs/node.cjs | VI | EN | | configs/typescript.cjs | VI | EN | | configs/react.cjs | VI | EN | | configs/next.cjs | VI | EN |

Type-Aware TypeScript

The TypeScript preset uses projectService: true, so it expects a tsconfig.json in the consuming project. If you lint generated files or config files outside your TypeScript project, add an override in that project's eslint.config.cjs.

Release

Before publishing a new version:

npm test
npm run lint
npm run pack:check

Review the generated package contents, update CHANGELOG.md, and commit the source changes. Then bump the version, push the commit and tag, and publish:

npm version patch
git push origin main --follow-tags
npm publish

Use npm version minor or npm version major when the release contains new features or breaking changes. The package is configured as public in package.json; run npm login first if the npm session is not authenticated.