@exodus/eslint-config

中文文档
5.24.0发布于 2024/03/28MIT近 30 天下载 3426

Set of eslint plugins and rules to use in Exodus projects

原始使用文档
文档目录11 节
  1. Development
  2. Release
  3. Usage
  4. Javascript
  5. Javascript with Babel
  6. Javascript with React
  7. Typescript
  8. Typescript with React
  9. Typescript and Javascript
  10. Suppressing Current Violations
  11. Inspiration

@exodus/eslint-config

Config for eslint to use in Exodus projects

Development

For any addition or changes to the existing corpus of rules, please refer to the instructions in the pull request template.

Release

Any PR merged to master will be automatically versioned and published using semantic release. Therefore it is important that you stick to the conventional commits specification when writing your commit messages.

Usage

The config offers a few different flavors depending on your use-case:

Javascript

Config for vanilla JS projects

Use yarn add --dev @exodus/eslint-config eslint to install the required dependencies and the snippet below to initialize your .eslintrc.js

// .eslintrc.js
module.exports = {
  extends: ['@exodus/eslint-config/javascript'],
  // ... customization
}

Javascript with Babel

Config for JS projects using Babel.

Use yarn add --dev @exodus/eslint-config eslint @babel/eslint-parser to install the required dependencies and the snippet below to initialize your .eslintrc.js

// .eslintrc.js
module.exports = {
  extends: ['@exodus/eslint-config/javascript-babel'],
  // ... customization
}

Javascript with React

Config for JS projects using React and Babel.

Use

  yarn add --dev @exodus/eslint-config eslint \
            @babel/eslint-parser \
            @babel/preset-react \
            eslint-plugin-react \
            eslint-plugin-react-hooks

to install the required dependencies and the snippet below to initialize your .eslintrc.js

// .eslintrc.js
module.exports = {
  extends: ['@exodus/eslint-config/javascript-react-babel'],
  // ... customization
}

Typescript

Use

  yarn add --dev @exodus/eslint-config eslint \
            @typescript-eslint/parser \
            @typescript-eslint/eslint-plugin \
            eslint-import-resolver-typescript

and the snippet below to initialize your .eslintrc.js

// .eslintrc.js
module.exports = {
  extends: ['@exodus/eslint-config/typescript'],
  // ... customization
}

Typescript with React

Use

  yarn add --dev @exodus/eslint-config eslint \
            @typescript-eslint/parser \
            @typescript-eslint/eslint-plugin \
            eslint-plugin-react \
            eslint-import-resolver-typescript \
            @exodus/eslint-plugin-react-hooks

to install the required dependencies and the snippet below to initialize your .eslintrc.js

// .eslintrc.js
module.exports = {
  extends: ['@exodus/eslint-config/typescript-react'],
  // ... customization
}

Typescript and Javascript

Use

  yarn add --dev @exodus/eslint-config eslint \
            @typescript-eslint/parser \
            @typescript-eslint/eslint-plugin \
            eslint-import-resolver-typescript

and the snippet below to initialize your .eslintrc.js

// .eslintrc.js
module.exports = {
  overrides: [
    {
      files: ['*.{ts,tsx}'],
      extends: ['@exodus/eslint-config/typescript'],
    },
    {
      files: ['*.{js,jsx}'],
      extends: ['@exodus/eslint-config/javascript'],
    },
  ],
}

Suppressing Current Violations

When adding a new rule, you can capture the tech debt of fixing current violations by first whitelisting them with // eslint-disable-next-line <ruleName>. To generate these comments for an entire project, use our fork of suppress-eslint-errors:

# assuming you installed the tool globally
suppress-eslint-errors ./src/ --extensions=js,jsx --rules="no-restricted-imports"

This will generate comments of the form:

// eslint-disable-next-line no-restricted-imports -- TODO: Fix this the next time the file is edited.

For non-tech-debt exceptions to a rule, you can remove the TODO line.

Inspiration

版本与发布记录

@exodus/eslint-config 共发布 39 个版本,首次发布于 2021/04/11;过去 12 个月发布了 0 个版本。

版本发布日期距今
5.24.0latest2024/03/282 年前
5.23.02024/03/052 年前
5.22.12024/02/282 年前
5.22.02024/01/102 年前
5.21.02024/01/092 年前
5.20.02023/12/302 年前

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

@exodus/eslint-config 是什么?

Set of eslint plugins and rules to use in Exodus projects

如何安装 @exodus/eslint-config?

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

@exodus/eslint-config 支持 TypeScript 吗?

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

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

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

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

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

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

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