1.2.0 • Published 2 months ago

@13onthecode/eslint-config v1.2.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 months ago

@13OnTheCode/ESLint-Config

Version License

English | 简体中文

A versatile ESLint configuration library that follows best practices, offering foundational setups for JavaScript, TypeScript, Node.js, and React projects

Features

  • Follow best practices to achieve accurate and reliable code inspection
  • Flexible configuration options to cater to different project needs
  • Automatically fixing formatting without the need for Prettier
  • Integrating mainstream plugins to provide extensive functionality enhancements for projects
  • Continuously maintained and updated to support the latest versions and features

Prerequisites

Node.js

  • Version >= 16.0.0
  • ESM Project

ESLint

  • Version >= 8.23.0
  • Using Flat Config

Install

npm install @13onthecode/eslint-config --save-dev

Usage

First, ensure you're using ESM (set "type": "module" in your package.json)

Then, create ESLint configuration file eslint.config.js in the project's root directory, and import the preset configurations you need based on your project requirements:

Base

Preset configuration for pure JavaScript and TypeScript projects, excluding Node environment and .jsx and .tsx files

import { base } from '@13onthecode/eslint-config'

export default [
  ...base
]

Node

This configuration extends the Base configuration

Preset configuration for Node.js projects, providing Node environment support for JavaScript and TypeScript files

import { node } from '@13onthecode/eslint-config'

export default [
  ...node
]

React

This configuration extends the Node configuration

Preset configuration for React projects, providing support for .jsx and .tsx files

import { react } from '@13onthecode/eslint-config'

export default [
  ...react
]

Override

To override things, just concat the config you want together, for example:

import { base } from '@13onthecode/eslint-config'

export default [
  ...base,
  {
    files: ["src/**/*.js"],
    rules: {
      "no-console": "off"
    }
  }
]

FAQ

Why not Prettier?

Why not CommonJS?

Check Also

License

MIT License © 2023-PRESENT 13OnTheCode