@nyxb/eslint-define-config
TypeScript icon, indicating that this package has built-in type declarations

1.24.1-1 • Public • Published

@nyxb/eslint-define-config

A fork of eslint-define-config to experiment better Flat Config support.

Changes In This Fork

1. Re-export Rules for Each Plugin

import {
  VitestRules,
  VueRules,
  // ...
} from '@nyxb/eslint-define-config'

2. Allow Overriding Rules

import pluginVitest from 'eslint-plugin-vitest'
import {
  defineFlatConfig,
  VitestRules
} from '@nyxb/eslint-define-config'

export default defineFlatConfig<VitestRules, /* Strict */ true>({
  plugins: {
    vitest: pluginVitest,
  },
  rules: {
    // only `vitest/` rules are allowed and will be auto-completed
    'vitest/no-async': 'error',

    // @ts-expect-error not allowed
    'indent': 'error'
  },
})

3. Support Renaming Rules

import {
  RenamePrefix,
  TypeScriptRules // { '@typescript-eslint/indent': 'error', ... }
} from '@nyxb/eslint-define-config'

type RenamedRules = RenamePrefix<TypeScriptRules, '@typescript-eslint/', 'ts/'>
// { 'ts/indent': 'error', ... }

This way it could work for Flat Config plugin renaming:

import pluginTypeScript from '@typescript-eslint/eslint-plugin'
import {
  defineFlatConfig,
  RenamePrefix,
  TypeScriptRules
} from '@nyxb/eslint-define-config'

type RenamedRules = RenamePrefix<TypeScriptRules, '@typescript-eslint/', 'ts/'>

export default defineFlatConfig<RenamedRules>({
  plugins: {
    ts: pluginTypeScript, // renames to `ts/`
  },
  rules: {
    'ts/indent': 'error',

    // now we have auto-completion for `ts/` rules
  },
})

Package Sidebar

Install

npm i @nyxb/eslint-define-config

Weekly Downloads

3

Version

1.24.1-1

License

MIT

Unpacked Size

2.97 MB

Total Files

1471

Last publish

Collaborators

  • dennisollhoff