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

@gwsbhqt/eslint-config

v0.0.18

Published

A flexible and powerful factory for creating ESLint and Prettier configurations.

Readme

@gwsbhqt/eslint-config

简体中文

A flexible and powerful factory for creating ESLint and Prettier configurations.

npm version License

Features

  • Flat Config: Utilizes ESLint's latest flat config format.
  • Comprehensive Defaults: Integrates popular plugins for TypeScript, React, React Hooks, Import-x, and Perfectionist out-of-the-box.
  • Highly Customizable: Easily extend, override, or disable rules and configurations with a simple and intuitive API.
  • Prettier Integration: Comes with a Prettier config factory that includes plugins for Tailwind CSS and package.json sorting.
  • Automatic Sorting: Sorts imports, object keys, and more using Perfectionist.
  • TypeScript First: Built with TypeScript, providing excellent type safety for your configurations.

Installation

Install the package and its peer dependencies using your favorite package manager.

npm install -D @gwsbhqt/eslint-config eslint prettier typescript

Basic Usage

ESLint Configuration

In your eslint.config.js:

// eslint.config.js
import { defineESLintConfig } from '@gwsbhqt/eslint-config'

// Export the configuration array
export default defineESLintConfig({
  // Basic customizations can go here
  noUnresolvedIgnore: ['^@/'], // Handle '@/*' path aliases
  globalIgnores: ['dist/**'] // Ignore the output directory
})

Prettier Configuration

In your prettier.config.js:

// prettier.config.js
import { definePrettierConfig } from '@gwsbhqt/eslint-config'

export default definePrettierConfig({
  printWidth: 100,
  semi: true
})

API Reference

defineESLintConfig(options)

Defines a complete ESLint flat configuration array. All options are optional.

configs: FlatConfig[]

Merge additional ESLint flat config objects. This is useful for adding plugins or configurations not included in the base setup.

Example: Add the eslint-plugin-unicorn plugin.

import unicorn from 'eslint-plugin-unicorn'

export default defineESLintConfig({
  configs: [
    unicorn.configs['flat/recommended'],
    {
      rules: {
        'unicorn/prevent-abbreviations': 'off'
      }
    }
  ]
})

globalIgnores: string[]

Provide an array of glob patterns for files and directories that ESLint should completely ignore.

Example: Ignore all test files and generated files.

export default defineESLintConfig({
  globalIgnores: ['**/*.test.ts', '**/*.spec.ts', 'src/generated/**']
})

disableRules: string[]

Provide an array of rule names to disable globally.

Example: Disable the no-console and no-debugger rules.

export default defineESLintConfig({
  disableRules: ['no-console', 'no-debugger']
})

enableRules: string[]

Provide an array of rule names to enable. This is useful for activating rules that are not enabled by default in the base configuration.

Example: Enforce the use of === and !== by enabling eqeqeq.

export default defineESLintConfig({
  enableRules: ['eqeqeq']
})

noUnresolvedIgnore: string[]

An array of patterns passed to the import-x/no-unresolved rule. This is essential for making the import resolver aware of path aliases.

Example: Ignore aliases starting with ^@/ and ^~_.

export default defineESLintConfig({
  noUnresolvedIgnore: ['^@/', '~/']
})

rules: Record<string, any>

A map of custom rules specifically for eslint-plugin-perfectionist. This allows you to fine-tune sorting behavior.

Example: Change the sorting order for object keys.

export default defineESLintConfig({
  rules: {
    'perfectionist/sort-objects': [
      'error',
      {
        type: 'natural',
        order: 'asc',
        'partition-by-comment': true
      }
    ]
  }
})

sortImportsGroups: string[]

Define the grouping and order for perfectionist/sort-imports.

Example: Define custom groups for imports.

export default defineESLintConfig({
  sortImportsGroups: [
    'type',
    'react',
    ['builtin', 'external'],
    'internal',
    ['parent', 'sibling', 'index'],
    'side-effect',
    'style',
    'object',
    'unknown'
  ]
})

sortImportsInternalPattern: string[]

Define glob patterns that perfectionist/sort-imports should consider as "internal" modules. This should align with your project's path aliases.

Example: Treat aliased paths as internal.

export default defineESLintConfig({
  sortImportsInternalPattern: ['@/**', '~/**']
})

definePrettierConfig(options)

Defines a Prettier configuration object. It accepts all standard Prettier options, plus the following enhancements.

Standard Prettier Options

You can pass any standard option like printWidth, semi, singleQuote, etc.

Example: Customize basic formatting rules.

export default definePrettierConfig({
  printWidth: 100,
  semi: false,
  singleQuote: true,
  tabWidth: 2,
  useTabs: false
})

plugins: string[]

Provide an array of additional Prettier plugins. prettier-plugin-packagejson and prettier-plugin-tailwindcss are already included by default.

Example: Add a plugin to organize imports (if not handled by ESLint).

export default definePrettierConfig({
  plugins: ['prettier-plugin-organize-imports']
})

overrides: Record<string, Config>

Define file-specific overrides. The key is a glob pattern and the value is a Prettier config object.

Example: Use a wider print width for JSON files and enable prose wrapping for Markdown.

export default definePrettierConfig({
  overrides: {
    '*.json': {
      printWidth: 200
    },
    '*.md': {
      proseWrap: 'always'
    }
  }
})

Contributing

Contributions are welcome! Please open an issue or submit a pull request.

License

This project is licensed under the MIT License.