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

@brutalway/oxlint-config-typescript

v0.8.3

Published

Oxlint config for TypeScript projects: no comments, no barrel files, files named after their export, types and constants in dedicated files.

Readme

@brutalway/oxlint-config-typescript

Oxlint config for TypeScript projects. The other @brutalway/oxlint-config-* packages extend it.

Install

npm install --save-dev oxlint @brutalway/oxlint-config-typescript
import { typescriptConfig } from '@brutalway/oxlint-config-typescript';
import { defineConfig } from 'oxlint';

export default defineConfig({
  extends: [typescriptConfig],
});

Two plugins it loads (eslint-plugin-check-file, eslint-plugin-no-comments) depend on ESLint 10.14, which pulls minimatch 10 (GHSA-g3hv-75wg-m249). npm only reads overrides from the root package.json, so add this to yours:

"overrides": {
  "eslint-plugin-no-comments": { "minimatch": "^11.0.1" }
}

Usage

Run the type-aware rules

The typescript/no-floating-promises family of rules needs oxlint --type-aware and the oxlint-tsgolint package. The rules marked "needs --type-aware" below only run with it.

Allow console in a CLI

console is limited to console.error, except in logger.ts and xLogger.ts, where a project writes the one logger the rest of its code goes through. A CLI turns no-console off in an override.

Keep a narrowing inside a declared function

A declared function is hoisted, so TypeScript drops the narrowing of a captured variable inside it. Move the null check into a helper that returns the narrowed value.

Rules

It turns on the correctness and suspicious categories, a set of typescript/ and import/ rules, and these conventions:

  • no comments, except tool directives (oxlint-, eslint-, @ts-expect-error, triple-slash references, shebang)
  • no index.ts and no barrel file
  • no types.ts: name it xTypes.ts
  • nothing in a shared feature, at any depth, that belongs to a feature: no orchestrator component (XContainer.tsx, XLayout.tsx, XPage.tsx) and no xRoutes.ts
  • no xConfig.tsx: a config is plain data in xConfig.ts, and its JSX goes in a component. xContent.tsx stays allowed for content written in JSX.
  • file names in camelCase or PascalCase
  • a file with a single export is named after it (@brutalway/eslint-plugin-file-named-after-export)
  • no export default (import/no-default-export), so a module is imported under the name it exports and never renamed at the import. The files a tool loads by their default export are exempt: *.config.ts and *.config.mts (Vite, Vitest, Playwright, tsdown, Oxlint, i18next), plugin.ts and xPlugin.ts (Oxlint jsPlugins, ESLint plugins), .d.ts files, which describe a module, and fixtures/. React.lazy reads a default export too: map the named export in the import, lazy(() => import('#src/x/SettingsPage.tsx').then((module) => ({ default: module.SettingsPage })))
  • named functions are declarations (function area() {}), arrow functions stay for callbacks
  • an if without braces fits on one line (curly set to multi-line)
  • object shapes use type, interface is only accepted to augment a global such as Window inside declare global, or a package such as fastify inside declare module 'fastify'
  • a switch over a union covers every case (typescript/switch-exhaustiveness-check, needs --type-aware)
  • exported types live in xTypes.ts files, exported constants in xConfig.ts files. An xTypes.ts only exports types, an xConfig.ts (or xContent.ts) only exports constants. Exported functions, classes, and objects that hold a function at any depth ({ notes: { all: () => ['notes'] } }, with or without as const or satisfies) can live anywhere, and so can export const x = defineX(...). An xSchemas.ts only exports Zod schemas, which are constants too: it is exempt from that rule and from the file-name rule, and the types inferred from it go in an xTypes.ts.
  • one way to write each thing: function members of a type as properties (area: () => number), no public keyword (write private and protected, leave public implicit), for...of instead of forEach, replaceAll for a global regex, Number.parseFloat and Number.NaN instead of the globals, import type { X } instead of import { type X }
  • regexes carry the u flag, ternaries are not nested, !!x and +x are written as explicit comparisons or calls, parameters are not reassigned
  • console only for console.error
  • no @ts-ignore and no @ts-nocheck, and a @ts-expect-error says why (// @ts-expect-error: the types of hls.js omit isSupported): an error silenced without a reason stays silenced after the code changes (typescript/ban-ts-comment)
  • no code in a string: eval, new Function('...'), and setTimeout('...') or setInterval('...'), which take a function instead (no-eval, no-new-func, typescript/no-implied-eval, the last one needs --type-aware)
  • class members never reassigned are readonly, deprecated APIs are reported, and a void expression is only accepted as the body of an arrow (() => save()). These three need --type-aware.
  • a function whose cognitive complexity is above 15 is reported, with Sonar's own rule: sonarjs/cognitive-complexity, the S3776 rule of eslint-plugin-sonarjs
  • a function holds 25 lines at most, blank lines and comments not counted (max-lines-per-function), and blocks and callbacks nest 3 levels deep at most (max-depth, max-nested-callbacks). The limits come from the Norminette of 42, which caps a function at 25 lines. Tests have no length limit, since a describe block holds all of its cases
  • a function takes 4 parameters at most (max-params) and declares 5 local variables at most (function-size/max-variables, a rule of this package). Each name bound by a destructuring counts, a nested function is counted on its own, and tests are exempt. Both limits come from the Norminette
  • a file declares 5 top-level functions at most (function-size/max-functions): function declarations and functions assigned to a top-level const, exported or not. A function nested in another one, a callback and an object method do not count. The limit comes from the Norminette, which caps a .c file at 5 functions

Tests (*.test.ts, *.spec.ts, e2e/) skip the naming and placement rules, the length limit and the variable limit.

Why

The whole file-name blocklist for shared/ lives in this config, so a preset that extends several configs cannot lose part of it.

The whole eslint-plugin-sonarjs plugin does not load under Oxlint with TypeScript 7 (its ts-api-utils finds the project's TypeScript, which has no JavaScript API), so src/cognitiveComplexityPlugin.ts loads the file of sonarjs/cognitive-complexity alone. eslint-plugin-sonarjs is pinned to an exact version, since the path is internal to it, and a fixture test fails if it moves.