Skip to content

m1rn/eslint-config

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@m1rn/eslint-config

ESLint

Version License

ESLint preset configuration library.

Features

  • Best Practices: Ensures accurate and reliable type checking.
  • Strict Configurations: Keeps your code quality at a high standard.
  • Automatic Formatting: No need to use Prettier.
  • Flexible Setup: Adapts to various project needs.

Prerequisites

Node.js

  • Version >= 18.20.0
  • ESM Project

ESLint

  • Version >= 9.6.0
  • Flat Config

Installation

npm install @m1rn/eslint-config --save-dev

Usage

Typically, you can import m1rn preset and use it directly:

import { m1rn } from '@m1rn/eslint-config'

export default m1rn()

Alternatively, you can configure each integration separately:

import { m1rn } from '@m1rn/eslint-config'

export default m1rn({
  ignores: {
    gitignore: true
  },
  node: true,
  browser: true,
  javascript: {
    jsx: true,
    style: true
  },
  typescript: {
    tsx: true,
    style: true,
    typeAware: true
  },
  jsx: {
    tsx: true,
    style: true
  },
  react: {
    tsx: true
  },
  html: {
    a11y: true,
    style: true
  },
  json: {
    style: true
  },
  markdown: {
    codeBlocks: true
  }
})

You can also import specific presets for granular configuration and combine them as you wish:

import {
  ignores,
  node,
  browser,
  javascript,
  typescript,
  jsx,
  react,
  html,
  json,
  markdown
} from '@m1rn/eslint-config'

export default [
  ...ignores(/* Options */),
  ...node(),
  ...browser(),
  ...javascript(/* Options */),
  ...typescript(/* Options */),
  ...jsx(/* Options */),
  ...react(/* Options */),
  ...html(/* Options */),
  ...json(/* Options */),
  ...markdown(/* Options */)
]

Presets

  • m1rn(options?)

    A comprehensive configuration preset that combines multiple configurations based on the provided options. By default, it enables certain presets based on the project environment and dependencies.

  • ignores(options?)

    Globally ignore certain files and directories that are commonly excluded, as well as those specified in the .gitignore file.

  • node()

    Specific rules and settings for Node.js environments.

  • browser()

    Specific rules and settings for Browser environments.

  • javascript(options?)

    Specific rules and settings for JavaScript.

  • typescript(options?)

    Specific rules and settings for TypeScript.

  • jsx(options?)

    Specific rules and settings for JSX.

  • react(options?)

    Specific rules and settings for React.

  • html(options?)

    Specific rules and settings for HTML.

  • json(options?)

    Specific rules and settings for JSON、JSONC and JSON5.

  • markdown(options?)

    Specific rules and settings for Markdown.

Plugins Name

I renamed plugins to make the overall naming more consistent and easier to write.

Plugin Name
@eslint/markdown md
@eslint-react/eslint-plugin react
@html-eslint/eslint-plugin html
@stylistic/eslint-plugin stylistic
@typescript-eslint/eslint-plugin ts
eslint-plugin-import-x import
eslint-plugin-jsonc json
eslint-plugin-perfectionist sort
eslint-plugin-unicorn unicorn

When you want to override rules, or disable them inline, you need to update to the new prefix:

-// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
+// eslint-disable-next-line ts/consistent-type-definitions
type foo = { bar: 2 }

See Also

License

MIT License © 2024-PRESENT m1rn