@abhijithvijayan/eslint-config

中文文档
3.0.1发布于 2026/01/04MITES Module零依赖构建来源已验证近 30 天下载 2455

My shared ESLint & Prettier configuration for projects

原始使用文档
文档目录16 节
  1. 🙋‍♂️ Made by @abhijithvijayan
  2. Table of Contents
  3. Features
  4. Installation
  5. Usage
  6. Other Configs
  7. TypeScript
  8. Node.js
  9. React
  10. Optional
  11. Override
  12. With VS Code
  13. Issues
  14. 🐛 Bugs
  15. TypeScript Config
  16. License

eslint-config

My shared ESLint & Prettier configuration for projects

🙋‍♂️ Made by @abhijithvijayan

Donate: PayPal, Patreon

Buy Me a Coffee


❤️ it? ⭐️ it on GitHub or Tweet about it.

Table of Contents

Features

The config includes these plugins by default:

Installation

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

Install the required peer dependencies:

npm install --save-dev eslint eslint-config-prettier eslint-plugin-import-x eslint-plugin-prettier globals prettier

For TypeScript support, also install:

npm install --save-dev @typescript-eslint/eslint-plugin @typescript-eslint/parser typescript

For React support, also install:

npm install --save-dev eslint-plugin-jsx-a11y eslint-plugin-react eslint-plugin-react-hooks

For Node.js support, also install:

npm install --save-dev eslint-plugin-n

Usage

This package uses ESLint's flat config format. Create an eslint.config.js (or eslint.config.mjs) file in your project root:

import baseConfig from '@abhijithvijayan/eslint-config';

export default [
  ...baseConfig,
  // your overrides
];

Other Configs

This config also exposes react, node, and typescript configs that I use often.

TypeScript

import typescriptConfig from '@abhijithvijayan/eslint-config/typescript';

export default [
  ...typescriptConfig,
  // your overrides
];

Node.js

It is to be used in combination with the base config (recommended):

import baseConfig from '@abhijithvijayan/eslint-config';
import nodeConfig from '@abhijithvijayan/eslint-config/node';

export default [
  ...baseConfig, // or typescriptConfig
  ...nodeConfig,
  // your overrides
];

React

It is to be used in combination with the base config (recommended):

import baseConfig from '@abhijithvijayan/eslint-config';
import reactConfig from '@abhijithvijayan/eslint-config/react';

export default [
  ...baseConfig, // or typescriptConfig
  ...reactConfig,
  // your overrides
];

Optional

  • To lint your files, you can add the following scripts to your package.json:

    "scripts": {
        "lint": "eslint .",
        "lint:fix": "eslint . --fix"
    },
    
  • Add files/directories to ignore in your eslint.config.js:

    export default [
      {
        ignores: ['node_modules', 'dist', '.yarn', '.pnp.js'],
      },
      ...baseConfig,
    ];
    

Override

If you'd like to override eslint or prettier settings, you can add the rules in your eslint.config.js file:

import baseConfig from '@abhijithvijayan/eslint-config';

export default [
  ...baseConfig,
  {
    rules: {
      'no-console': 'off',
      'prettier/prettier': [
        'error',
        {
          bracketSpacing: true,
          printWidth: 120,
          semi: true,
          singleQuote: true,
          tabWidth: 4,
          trailingComma: 'all',
          useTabs: false,
        },
      ],
    },
  },
];

With VS Code

To show lint errors in your editor, you'll need to configure your editor.

  1. Install the ESLint package

  2. Install the Prettier package

  3. Now we need to setup some VS Code settings via Code/File → Preferences → Settings. It's easier to enter these settings while editing the settings.json file, so click the {} icon in the top right corner:

    "editor.formatOnSave": true,
    "[javascript]": {
      "editor.formatOnSave": false
    },
    "[javascriptreact]": {
      "editor.formatOnSave": false
    },
    "[typescript]": {
      "editor.formatOnSave": false
    },
    "[typescriptreact]": {
      "editor.formatOnSave": false
    },
    "editor.codeActionsOnSave": {
        "source.fixAll": "explicit",
        "source.fixAll.eslint": "explicit"
    },
    "prettier.disableLanguages": ["javascript", "javascriptreact", "typescript", "typescriptreact"],
    

Issues

Looking to contribute? Look for the Good First Issue label.

🐛 Bugs

Please file an issue here for bugs, missing documentation, or unexpected behavior.

See Bugs

TypeScript Config

License

MIT © Abhijith Vijayan

版本与发布记录

@abhijithvijayan/eslint-config 共发布 55 个版本,首次发布于 2020/04/14;过去 12 个月发布了 2 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
3.0.1latest2026/01/0410 个月前
3.0.02026/01/0310 个月前
2.8.12024/01/312 年前
2.8.02024/01/312 年前
2.7.32024/01/312 年前
2.7.22024/01/312 年前

关于 @abhijithvijayan/eslint-config 的常见问题

@abhijithvijayan/eslint-config 是什么?

My shared ESLint & Prettier configuration for projects

如何安装 @abhijithvijayan/eslint-config?

在项目目录运行 npm install @abhijithvijayan/eslint-config,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:eslint(>=9.0.0)、eslint-config-prettier(>=9.1.0)、eslint-plugin-import-x(>=4.0.0)、eslint-plugin-prettier(>=5.1.0)、globals(>=15.0.0)、prettier(>=3.0.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@abhijithvijayan/eslint-config 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/abhijithvijayan__eslint-config 是否存在。

@abhijithvijayan/eslint-config 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@abhijithvijayan/eslint-config 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=20。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@abhijithvijayan/eslint-config 可以商用吗?

@abhijithvijayan/eslint-config 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@abhijithvijayan/eslint-config 的下载量有多少?

根据 npm 官方下载统计,@abhijithvijayan/eslint-config 在 2026/10/05 – 2026/11/03 这 30 天内被下载 2,455 次,日均约 82 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@abhijithvijayan/eslint-config 还在维护吗?

最新版本 3.0.1 发布于 2026/01/04(10 个月前);至今共发布 55 个版本,其中过去 12 个月发布了 2 个;首次发布于 2020/04/14。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。