@echristian/eslint-config

中文文档
0.0.54发布于 2025/08/29TypeScriptES Module近 30 天下载 3090

ericc-ch ESLint config

原始使用文档
文档目录12 节
  1. Installation
  2. Usage
  3. Configuration Options
  4. Example Configurations
  5. Basic TypeScript Project
  6. TypeScript Project without Type Checking
  7. React Project with Hooks
  8. Full-Stack Project with CSS
  9. Documentation Project with Markdown
  10. Complete Project with All Features
  11. Dependencies
  12. License

@echristian/eslint-config

A modern and opinionated ESLint configuration with TypeScript, JSX, CSS, and Markdown support.

Installation

Using npm:

npm install -D @echristian/eslint-config eslint

Using yarn:

yarn add -D @echristian/eslint-config eslint

Using pnpm:

pnpm add -D @echristian/eslint-config eslint

Usage

Create an eslint.config.js file in your project root:

import eslintConfig from "@echristian/eslint-config";

export default eslintConfig({
  // Configuration options here
});

Configuration Options

The configuration function accepts an options object with the following structure:

interface ESLintConfigOptions {
  // Glob patterns to ignore
  ignores?: Array<string>;

  // TypeScript configuration
  typescript?: {
    options?: {
      typeChecked?: boolean; // defaults to true
    };
  };

  // React configuration
  react?: {
    enabled?: boolean; // defaults to false
    options?: {
      typeChecked?: boolean; // defaults to true
    };
  };

  // React Hooks configuration
  reactHooks?: {
    enabled: boolean; // defaults to false
  };

  // JSX configuration
  jsx?: {
    enabled?: boolean; // defaults to false
    a11y?: boolean; // defaults to true
  };

  // Markdown configuration
  markdown?: {
    enabled?: boolean; // defaults to false
    options?: {
      language?: "commonmark" | "gfm"; // defaults to "gfm"
      frontMatter?: "yaml" | "toml" | "json" | false; // defaults to false
    };
  };

  // Prettier configuration
  prettier?: {
    experimentalOperatorPosition?: "start" | "end";
    experimentalTernaries?: boolean;
    semi?: boolean;
    // More prettier config
  };

  // Package.json rules configuration
  packageJson?: {
    package?: boolean; // defaults to false
  };
}

Example Configurations

Basic TypeScript Project

import eslintConfig from "@echristian/eslint-config";

export default eslintConfig({
  ignores: ["dist/"],
});

TypeScript Project without Type Checking

import eslintConfig from "@echristian/eslint-config";

export default eslintConfig({
  typescript: {
    options: {
      typeChecked: false,
    },
  },
});

React Project with Hooks

import eslintConfig from "@echristian/eslint-config";

export default eslintConfig({
  react: {
    enabled: true,
  },
  reactHooks: {
    enabled: true,
  },
  jsx: {
    enabled: true,
  },
});

Full-Stack Project with CSS

import eslintConfig from "@echristian/eslint-config";

export default eslintConfig({
  ignores: ["dist/", "build/"],
  react: {
    enabled: true,
  },
  reactHooks: {
    enabled: true,
  },
  jsx: {
    enabled: true,
  },
  css: {
    enabled: true,
  },
});

Documentation Project with Markdown

import eslintConfig from "@echristian/eslint-config";

export default eslintConfig({
  markdown: {
    enabled: true,
    options: {
      language: "gfm", // GitHub Flavored Markdown
      frontMatter: "yaml", // Enable YAML frontmatter support
    },
  },
});

Complete Project with All Features

import eslintConfig from "@echristian/eslint-config";

export default eslintConfig({
  ignores: ["dist/", "build/"],
  react: {
    enabled: true,
  },
  reactHooks: {
    enabled: true,
  },
  jsx: {
    enabled: true,
  },
  markdown: {
    enabled: true,
    options: {
      language: "gfm",
      frontMatter: "yaml",
    },
  },
});

Dependencies

This config includes the following major dependencies:

  • @eslint/js: Core ESLint rules
  • @eslint/json: JSON support
  • @eslint/css: CSS support
  • @eslint/markdown: Markdown support
  • typescript-eslint: TypeScript support
  • @stylistic/eslint-plugin: Style-related rules
  • eslint-plugin-unused-imports: Unused imports management
  • eslint-plugin-perfectionist: Additional best practices
  • eslint-plugin-prettier: Prettier integration
  • eslint-plugin-regexp: Regular expression linting
  • eslint-plugin-de-morgan: Logical expression optimization
  • eslint-plugin-package-json: Package.json validation
  • eslint-plugin-react-hooks: React Hooks linting rules
  • @eslint-react/eslint-plugin: React component linting

License

MIT - See LICENSE for more information.

版本与发布记录

@echristian/eslint-config 共发布 44 个版本,首次发布于 2024/11/26;过去 12 个月发布了 0 个版本。

版本发布日期距今
0.0.54latest2025/08/291.2 年前
0.0.532025/08/151.2 年前
0.0.522025/08/051.3 年前
0.0.502025/08/021.3 年前
0.0.492025/07/201.3 年前
0.0.462025/07/101.3 年前

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

@echristian/eslint-config 是什么?

ericc-ch ESLint config

如何安装 @echristian/eslint-config?

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

@echristian/eslint-config 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

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

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

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

@echristian/eslint-config 使用 未声明 许可。package.json 没有声明许可证。没有许可证的代码默认保留全部权利,商用前请联系作者或查看仓库中的 LICENSE 文件。以上为概括,不构成法律意见,请以许可原文为准。

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

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

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

最新版本 0.0.54 发布于 2025/08/29(1.2 年前);至今共发布 44 个版本,其中过去 12 个月发布了 0 个;首次发布于 2024/11/26。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。