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

@hardlydifficult/ts-config

v0.0.26

Published

A centralized package providing strict TypeScript, ESLint, and Prettier configurations for modern JavaScript and Next.js projects.

Readme

@hardlydifficult/ts-config

A centralized package providing strict TypeScript, ESLint, and Prettier configurations for modern JavaScript and Next.js projects.

Installation

npm install @hardlydifficult/ts-config

Quick Start

Apply the shared ESLint and Prettier configurations to your project:

// eslint.config.js
import createEslintConfig from "@hardlydifficult/ts-config/eslint";
import prettierConfig from "@hardlydifficult/ts-config/prettier";

export default [
  ...createEslintConfig(import.meta.dirname),
  {
    rules: {
      // your overrides
    },
  },
];

// .prettierrc.js
import prettierConfig from "@hardlydifficult/ts-config/prettier";

export default prettierConfig;

TypeScript Configuration

Extend the base configuration in your tsconfig.json:

{
  "extends": "@hardlydifficult/ts-config/tsconfig.base.json",
  "compilerOptions": {
    "outDir": "./dist"
  },
  "include": ["src/**/*"]
}

ESLint Configuration

Exports a factory function that returns a flat ESLint configuration with strict TypeScript rules, import ordering, JSDoc requirements, and auto-fixable stylistic rules.

createEslintConfig(projectRoot)

Creates a fully-featured ESLint config for TypeScript projects.

| Parameter | Type | Description | |-----------|------|-------------| | projectRoot | string | Path to the project root directory; used by TypeScript ESLint for project service lookups |

import createEslintConfig from "@hardlydifficult/ts-config/eslint";

export default [
  ...createEslintConfig("path/to/project"),
];

Ignored Patterns

By default, ESLint ignores:

**/dist/**, **/node_modules/**, **/*.js,
**/tests/**, **/vitest.config.ts,
**/.next/**, **/.turbo/**, **/*.config.mjs

createNextEslintConfig(projectRoot, nextConfig)

Combines the base ESLint config with Next.js-specific rules.

| Parameter | Type | Description | |-----------|------|-------------| | projectRoot | string | Project root directory | | nextConfig | Linter.Config[] | Next.js ESLint config array (e.g., from @next/eslint-plugin-next) |

import createNextEslintConfig from "@hardlydifficult/ts-config/eslint-next";
import nextConfig from "@next/eslint-plugin-next/config";

export default [
  ...createNextEslintConfig(import.meta.dirname, nextConfig),
];

React Rules

| Rule | Level | Options | |------|-------|---------| | react/react-in-jsx-scope | off | — | | react/prop-types | off | — | | react/self-closing-comp | error | { component: true, html: true } | | react/jsx-boolean-value | error | "never" | | react/no-array-index-key | warn | — | | react/jsx-curly-brace-presence | error | { props: "never", children: "never" } |

Prettier Configuration

Exports a preconfigured Prettier settings object optimized for consistency across TypeScript/JavaScript projects.

prettierConfig

import prettierConfig from "@hardlydifficult/ts-config/prettier";

export default prettierConfig;
// {
//   semi: true,
//   singleQuote: false,
//   tabWidth: 2,
//   useTabs: false,
//   trailingComma: "es5",
//   bracketSpacing: true,
//   bracketSameLine: false,
//   arrowParens: "always",
//   endOfLine: "lf",
//   printWidth: 80,
//   quoteProps: "as-needed",
//   jsxSingleQuote: false,
//   proseWrap: "preserve",
//   htmlWhitespaceSensitivity: "css",
//   embeddedLanguageFormatting: "auto",
//   singleAttributePerLine: false,
// }

Usage with Prettier API

import prettierConfig from "@hardlydifficult/ts-config/prettier.js";
import { format } from "prettier";

const formatted = await format("console.log('Hello');", {
  ...prettierConfig,
  parser: "typescript",
});

TypeScript Configuration

Base compiler options for consistent builds across projects.

tsconfig.base.json

The base configuration includes strict type checking, ES2022 targeting, and modern module resolution:

{
  "compilerOptions": {
    "target": "ES2022",
    "module": "CommonJS",
    "moduleResolution": "node",
    "lib": ["ES2022"],
    "strict": true,
    "esModuleInterop": true,
    "skipLibCheck": true,
    "forceConsistentCasingInFileNames": true,
    "declaration": true,
    "declarationMap": true,
    "sourceMap": true,
    "resolveJsonModule": true,
    "isolatedModules": true
  }
}

Node Config (tsconfig.json)

Node-specific configuration extending the base config with:

  • module: "Node16" and moduleResolution: "node16"
  • outDir: "./dist" and rootDir: "./src"

Appendix

Rule Categories

The ESLint config enforces auto-fixable and non-auto-fixable rules:

| Auto-fixable | Non-auto-fixable | |--------------|------------------| | curly, no-useless-computed-key, prefer-const, quote-props | no-console (limited), no-restricted-globals, no-loop-func |

JSDoc Requirements

JSDoc is required for:

  • FunctionDeclaration
  • ClassDeclaration
  • Public methods are excluded
  • Constructors are not checked

Supported Node.js version: >=20.19.0
Peer dependencies required: eslint, typescript-eslint, eslint-plugin-import-x, eslint-plugin-jsdoc, eslint-plugin-unused-imports, eslint-config-prettier, @eslint/compat, @eslint/js