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

@disphere/code-quality-config

v0.4.0

Published

Provides opinionated configuration for npm plugins that deal with code quality.

Readme

@disphere/code-quality-config

Opinionated, shared ESLint (flat config) and Prettier configuration. It bundles the plugins it uses, so a project only needs the peer dependencies.

What you get:

  • ESLint: @eslint/js recommended, type-checked typescript-eslint, eslint-plugin-n for Node code, React (@eslint-react + hooks), Vue (eslint-plugin-vue), import-x with cycle detection, Cypress, and Jest/Vitest/Mocha. Rules that would conflict with Prettier are turned off.
  • Prettier: 120 columns, single quotes, trailing commas, import sorting, SQL formatting inside tagged template literals, and one sentence per line in Markdown.
  • CLI helpers: lint-report and which-modules, which summarise ESLint output.

Requirements

  • Node.js >= 24
  • eslint ^10.8, prettier ^3.9.6, typescript >=5.1.6 <6.1.0. TypeScript is needed even in JavaScript-only projects, because typescript-eslint loads it.

Installation

npm install --save-dev @disphere/code-quality-config eslint prettier typescript@6

TypeScript 7 is not supported yet, because typescript-eslint does not support it.

Declare the Node version in your package.json. eslint-plugin-n reads it to decide which Node APIs are allowed:

{
  "engines": {
    "node": ">=24.0.0"
  }
}

npm audit and minimatch (GHSA-g3hv-75wg-m249)

npm audit may report GHSA-g3hv-75wg-m249, a ReDoS in minimatch <11.0.1. It comes in through eslint, @eslint/config-array and @typescript-eslint/typescript-estree, which require minimatch 10 themselves, so this package can't fix it. npm overrides only take effect in the root project, so the package can't apply one for you either.

The risk is low: in a lint setup, minimatch only matches the glob patterns from your own ESLint config and ignore files, not untrusted input. To clear the audit anyway, add an override to your package.json:

{
  "overrides": {
    "minimatch": "^11.0.5"
  }
}

ESLint and typescript-eslint both work with minimatch 11; their own fixes require ^11.0.5 and ^11.0.1. Remove the override once releases of both that depend on minimatch 11 are installed.

ESLint

Create eslint.config.mjs:

import appConfig from '@disphere/code-quality-config/eslint';

export default appConfig({
  env: 'node',
  tsconfigRootDir: import.meta.dirname, // TypeScript projects only
});

All options are optional:

| Option | Values | Default | Description | | ----------------- | ----------------------------------------------------------- | ----------- | -------------------------------------------------------------------------------------------------------------------------------- | | env | 'browser' | 'node' | 'both' | 'browser' | Where your code runs. Sets globals; node/both also enable eslint-plugin-n. | | modules | 'esm' | 'cjs' | 'esm' | How bare .js files are parsed. Must match the type in your package.json. | | testRunner | 'jest' | 'vitest' | 'mocha' | 'node' | 'none' | 'vitest' | Picks the plugin and globals for test files. 'node' is Node's built-in node:test (see below). 'none' skips the test block. | | jestVersion | number | 30 | Major Jest version; only read when testRunner is 'jest'. | | tsconfigRootDir | string | – | Pass import.meta.dirname in TypeScript projects. Type-aware rules use the nearest tsconfig.json. | | ignores | string[] | [] | Extra ignore globs. dist/, build/, coverage/ and *.min.js are always ignored. |

These globs decide which rules apply to a file:

  • TypeScript: *.ts, *.mts, *.cts, *.tsx
  • React: *.jsx, *.tsx
  • Vue: *.vue (see Vue)
  • Tests: *.test.*, *.spec.*, and files under __tests__/, test/ or tests/
  • Cypress: *.cy.* and files under cypress/
  • Tooling: *.config.* and scripts/**. These are treated as Node code even in browser projects.

With testRunner: 'node', test files get Node globals, and calls of test, describe, it and suite (including .skip, .todo and .only) imported from node:test are exempt from @typescript-eslint/no-floating-promises, because the runner awaits their promises itself. Other floating promises in test files are still reported. Jest, Vitest and Mocha need no such exemption: their test()/describe()/it() don't return promises.

Variables, arguments and caught errors prefixed with _ are exempt from the unused-variable rules.

curly is enforced with its default all option: every if, else, for, while and do body needs braces. Existing code can be fixed with eslint --fix.

With TypeScript 6, compilerOptions.types defaults to [], so @types/* packages are no longer included automatically. If you see type-aware errors such as no-unsafe-call on Node APIs, list the packages explicitly in your tsconfig.json, e.g. "types": ["node"].

Vue

Vue single-file components are linted automatically, with no extra option. Like the React rules, the Vue rules only apply to matching files (*.vue), so other projects are unaffected.

  • eslint-plugin-vue's flat/recommended preset (Vue 3) applies to the whole file. Template formatting rules are turned off, because Prettier formats templates.
  • <script> and <script setup> are parsed by the typescript-eslint parser, so the same type-checked rules as in .ts files apply. Blocks without lang="ts" are linted the same way.
  • Type-aware rules need the .vue files in a tsconfig.json (e.g. "include": ["src"] or "src/**/*.vue"). To import components from .ts files, declare the usual *.vue module shim; see shims-vue.d.ts.
  • Custom elements such as Ionic's <ion-button> are not flagged. vue/no-undef-components stays off, because it can't see globally registered or auto-imported components. Enable it yourself with ignorePatterns: ['^ion-'] if it fits your project.

Prettier formats .vue files out of the box. Sorting the imports inside <script> needs @vue/compiler-sfc, which every Vue project already has as a dependency of vue.

Prettier

Create .prettierrc.mjs:

import base from '@disphere/code-quality-config/prettier';

export default base;

Use .mjs, not .js, so the file is ESM whether or not your package.json sets "type": "module". Add a .prettierignore as needed.

To extend the config, spread it: export default { ...base, printWidth: 100 };.

Imports are sorted in this order: Node built-ins, third-party packages, @/ aliases, then relative imports.

One sentence per line in Markdown

In *.md files, Prettier puts each sentence on its own line, via prettier-plugin-sentences-per-line. Changing a sentence then touches one line in the diff. Paragraphs are never reflowed (proseWrap: 'preserve'): lines are only split, never joined.

- First sentence. Second sentence.
+ First sentence.
+ Second sentence.
  • A line is split where a word ends in ., ! or ? and the next word starts with a capital letter (A–Z). Sentences that start with inline code, a link, emphasis or an umlaut, or follow a bare number (Node 26. Then), are not split, so format:check won't flag them.
  • Headings and table rows are never split. List items and blockquotes are.
  • Abbreviations don't end a sentence: e.g., i.e., etc., vs., English titles (Dr., Mr.), common German abbreviations (bzw., ca., ggf., vgl., Nr.) and single letters, which covers initials and z. B., d. h. or u. a.. Version numbers such as 1.2.3 are not split either.
  • To add abbreviations, override sentencesPerLineAdditionalAbbreviations for *.md files. Keep the shared list, because the option replaces it:
import base from '@disphere/code-quality-config/prettier';

const markdown = base.overrides.find((override) => override.files === '*.md');
markdown.options.sentencesPerLineAdditionalAbbreviations.push('resp.');

export default base;

Adopting this reformats existing Markdown once; consider doing it in a dedicated formatting commit.

SQL in template literals

SQL inside template literals tagged mysqlFormat (MySQL dialect) or mssqlFormat (T-SQL) is formatted:

const query = mysqlFormat`
  SELECT
    id
  FROM
    users
  WHERE
    name = :name
`;

The tags are only markers for Prettier. This package doesn't ship them: it is a dev dependency, and the tags are runtime code. Copy them into your project, e.g. as src/sql.ts:

/*
 * Markers for prettier-plugin-embed: templates tagged with these are formatted as SQL. At runtime they only join the
 * template back together; `null`/`undefined` values become empty strings.
 */
type SqlValue = string | number | bigint | boolean | null | undefined;

const joinTemplate = (strings: TemplateStringsArray, ...values: SqlValue[]): string =>
  strings.reduce((sql, str, i) => sql + str + String(values[i] ?? ''), '');

export const mysqlFormat = joinTemplate;
export const mssqlFormat = joinTemplate;

In JavaScript, drop the type annotations and the SqlValue type. Values are interpolated as-is and are not escaped, so pass user input as query parameters (:name), not via ${}.

Suggested npm scripts

{
  "scripts": {
    "lint": "eslint",
    "lint:report": "eslint --format json | lint-report",
    "format": "prettier --write .",
    "format:check": "prettier --check ."
  }
}

lint-report

Reads ESLint JSON output from stdin (or from a file path argument) and prints a summary instead of every message.

  • Default: grouped by rule, with error, warning and file counts, and how many are autofixable.
  • --by=file: ranks the files with the most problems.
  • --max-warnings=N: fails when there are more than N warnings.

It exits with code 1 when there are errors, so it can end a pipeline.

which-modules

Groups the messages of one rule by the module or identifier they name. This shows whether a large count has one cause or many:

npx eslint --format json | npx which-modules no-undef

Example

test/consumer/ is a minimal TypeScript project set up as described above. The package's smoke test installs the packed artifact into a copy of it and runs Prettier, tsc, ESLint and Vitest there. It also contains the SQL tag snippet from above, in src/sql.ts, and a Vue component (src/GreetingCard.vue) imported from TypeScript.

License

0BSD