
Security News
PolinRider: North Korea-Linked Supply Chain Campaign Expands Across Open Source Ecosystems
PolinRider expands across npm, Packagist, Go modules, and Chrome extensions, using hidden loaders to target developer environments.
@huaiyou/config-eslint
Advanced tools
基于 ESLint 9.x Flat Config 的共享 ESLint 配置,支持 TypeScript 和 React。
pnpm add -D @huaiyou/config-eslint eslint typescript
创建 eslint.config.js 文件:
import { base } from '@huaiyou/config-eslint';
export default base;
对于 React 项目:
import { react } from '@huaiyou/config-eslint';
export default react;
继承 Base 配置,额外包含:
| 规则 | 设置 | 说明 |
|---|---|---|
@typescript-eslint/no-unused-vars | error | 禁止未使用的变量(忽略 _ 开头) |
@typescript-eslint/no-explicit-any | warn | 警告使用 any 类型 |
@typescript-eslint/consistent-type-imports | error | 强制使用 type import |
@typescript-eslint/no-misused-promises | error | 防止错误使用 Promise |
| 规则 | 设置 | 说明 |
|---|---|---|
import/order | error | 强制 import 顺序和分组 |
import/no-duplicates | error | 禁止重复 import |
import/newline-after-import | error | import 后需要空行 |
| 规则 | 设置 | 说明 |
|---|---|---|
react/prop-types | off | 关闭 PropTypes(使用 TS) |
react/react-in-jsx-scope | off | React 17+ 不需要 |
react-hooks/rules-of-hooks | error | Hooks 使用规则 |
react-hooks/exhaustive-deps | warn | Hooks 依赖检查 |
import { base } from '@huaiyou/config-eslint';
export default [
...base,
{
rules: {
// 你的自定义规则
'@typescript-eslint/no-explicit-any': 'error',
},
},
];
import { base } from '@huaiyou/config-eslint';
export default [
...base,
{
ignores: ['dist/**', 'build/**', '*.config.js'],
},
];
import { react } from '@huaiyou/config-eslint';
export default [
...react,
{
files: ['**/*.test.{ts,tsx}'],
rules: {
'@typescript-eslint/no-explicit-any': 'off',
},
},
];
{
"scripts": {
"lint": "eslint .",
"lint:fix": "eslint . --fix"
}
}
ESLint 9.x 使用全新的 Flat Config 格式,主要变化:
.eslintrc.* → eslint.config.js欢迎提交 Issue 和 Pull Request 来改进配置。
MIT
FAQs
Shared ESLint configuration with flat config (ESLint 9.x)
We found that @huaiyou/config-eslint demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
PolinRider expands across npm, Packagist, Go modules, and Chrome extensions, using hidden loaders to target developer environments.

Security News
Open source attacks are accelerating as AI coding agents pull in dependencies faster, with less human review.

Research
/Security News
Malicious Chrome and Firefox extensions posed as free VPNs while stealing clipboard data through later extension updates.