@croct/eslint-plugin

中文文档
0.9.2发布于 2026/05/26MITTypeScriptCommonJS构建来源已验证近 30 天下载 5208

ESLint rules and presets applied to all Croct JavaScript projects.

原始使用文档
文档目录10 节
  1. Installation
  2. JavaScript
  3. TypeScript
  4. React
  5. Cypress
  6. Custom rules
  7. Basic usage
  8. Contributing
  9. Testing
  10. Copyright Notice

Croct
JavaScript Coding Standard
A set of ESLint rules applied to all Croct JavaScript projects.

Version Build

📦 Releases · 🐞 Report Bug · ✨ Request Feature

Installation

The recommended way to install the package is via NPM. It pairs nicely with module bundlers such as Webpack or Browserify:

npm i -D @croct/eslint-plugin

This plugin uses ESLint's flat config format (ESLint v9+).

JavaScript

For JavaScript projects, create an eslint.config.mjs file:

import { defineConfig } from 'eslint/config';
import croct from '@croct/eslint-plugin';

export default defineConfig(
    croct.configs.javascript,
);

TypeScript

For TypeScript projects, create an eslint.config.mjs file:

import { defineConfig } from 'eslint/config';
import croct from '@croct/eslint-plugin';

export default defineConfig(
    croct.configs.typescript,
);

The TypeScript config includes the JavaScript preset, so there's no need to include both.

React

For React projects, create an eslint.config.mjs file:

import { defineConfig } from 'eslint/config';
import croct from '@croct/eslint-plugin';

export default defineConfig(
    croct.configs.react,
);

The React config includes the JavaScript preset, so there's no need to include both.

Cypress

For Cypress projects, create an eslint.config.mjs file:

import { defineConfig } from 'eslint/config';
import croct from '@croct/eslint-plugin';

export default defineConfig(
    croct.configs.cypress,
);

The Cypress config includes the JavaScript preset, so there's no need to include both.

Custom rules

You can add custom rules or override existing ones:

import { defineConfig } from 'eslint/config';
import croct from '@croct/eslint-plugin';

export default defineConfig(
    croct.configs.typescript,
    {
        files: ['src/**/*.ts'],
        rules: {
            '@typescript-eslint/explicit-function-return-type': 'off',
        },
    },
);

For the list of available presets and rules, see the reference documentation.

Basic usage

Run the following command to check if the project adheres to the coding standard:

eslint

Contributing

Contributions to the package are always welcome!

  • Report any bugs or issues on the issue tracker.
  • For major changes, please open an issue first to discuss what you would like to change.
  • Please make sure to update tests as appropriate.

Testing

Before running the test suites, the development dependencies must be installed:

npm i

Then, to run all tests:

npm run test

Copyright © 2015-2021 Croct Limited, All Rights Reserved.

All information contained herein is, and remains the property of Croct Limited. The intellectual, design and technical concepts contained herein are proprietary to Croct Limited s and may be covered by U.S. and Foreign Patents, patents in process, and are protected by trade secret or copyright law. Dissemination of this information or reproduction of this material is strictly forbidden unless prior written permission is obtained from Croct Limited.

版本与发布记录

@croct/eslint-plugin 共发布 28 个版本,首次发布于 2022/02/09;过去 12 个月发布了 7 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.9.2latest2026/05/265 个月前
0.9.12026/05/255 个月前
0.9.02026/05/255 个月前
0.8.32026/01/219 个月前
0.8.22026/01/159 个月前
0.8.12026/01/149 个月前

其他发布通道:next → 0.2.3-rc.1。

关于 @croct/eslint-plugin 的常见问题

@croct/eslint-plugin 是什么?

ESLint rules and presets applied to all Croct JavaScript projects.

如何安装 @croct/eslint-plugin?

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

@croct/eslint-plugin 支持 TypeScript 吗?

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

@croct/eslint-plugin 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@croct/eslint-plugin 可以商用吗?

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

@croct/eslint-plugin 的下载量有多少?

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

@croct/eslint-plugin 还在维护吗?

最新版本 0.9.2 发布于 2026/05/26(5 个月前);至今共发布 28 个版本,其中过去 12 个月发布了 7 个;首次发布于 2022/02/09。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。