npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@truenine/eslint9-config

v1.0.19

Published

ESLint 9 configuration package for Compose Client projects with TypeScript, Vue, and modern JavaScript support

Downloads

236

Readme

ESLint 9 配置包

这是一个针对 Compose Client 项目优化的 ESLint 9 配置包,提供了缓存优化、性能调优和规则优化功能。

功能特性

🚀 性能优化

  • 智能缓存: 支持 metadata 和 content 两种缓存策略
  • 并行处理: 自动利用多核 CPU 进行并行检查
  • 规则优化: 可选择跳过性能影响大的规则
  • 渐进式检查: 优先检查关键文件

📋 预设配置

  • performance: 性能优先,适用于大型项目或 CI 环境
  • quality: 质量优先,适用于小型项目或开发环境
  • balanced: 平衡配置,默认推荐
  • ci: CI 环境专用配置
  • dev: 开发环境友好配置
  • library: 库项目严格配置

🎯 智能忽略

  • 自动忽略构建产物、缓存目录、压缩文件等
  • 可配置的关键文件优先检查
  • 支持自定义忽略模式

使用方法

基础用法

// eslint.config.mjs
import eslint9 from '@truenine/eslint9-config'

export default eslint9({
  type: 'lib',
  typescript: {
    strictTypescriptEslint: true,
    tsconfigPath: './tsconfig.json',
  },
})

使用预设配置

// eslint.config.mjs
import eslint9, { applyPreset } from '@truenine/eslint9-config'

export default eslint9({
  type: 'lib',
  typescript: {
    strictTypescriptEslint: true,
    tsconfigPath: './tsconfig.json',
  },
  // 使用平衡预设
  ...applyPreset('balanced'),
})

自定义配置

// eslint.config.mjs
import eslint9, { applyPreset } from '@truenine/eslint9-config'

export default eslint9({
  type: 'lib',
  vue: true,
  typescript: {
    strictTypescriptEslint: true,
    tsconfigPath: './tsconfig.json',
  },
  // 自定义缓存配置
  cache: {
    location: '.eslintcache',
    strategy: 'metadata',
  },
  // 性能优化配置
  performance: {
    parallel: true,
    skipExpensiveRules: false,
  },
  // 规则优化配置
  ruleOptimization: {
    progressive: true,
    criticalFirst: true,
    customOverrides: {
      'ts/no-explicit-any': 'warn',
      'complexity': ['warn', { max: 15 }],
    },
  },
})

配置选项

缓存配置 (cache)

cache?: boolean | {
  /** 缓存位置,默认为 .eslintcache */
  location?: string
  /** 缓存策略,默认为 metadata */
  strategy?: 'metadata' | 'content'
}

性能配置 (performance)

performance?: {
  /** 启用并行处理,默认为 true */
  parallel?: boolean
  /** 最大并行数,默认为 CPU 核心数 */
  maxParallel?: number
  /** 忽略性能影响大的规则 */
  skipExpensiveRules?: boolean
}

规则优化配置 (ruleOptimization)

ruleOptimization?: {
  /** 是否启用渐进式检查 */
  progressive?: boolean
  /** 关键文件优先检查 */
  criticalFirst?: boolean
  /** 跳过性能影响大的规则 */
  skipExpensive?: boolean
  /** 自定义规则覆盖 */
  customOverrides?: Record<string, string>
}

预设配置详情

Performance 预设

适用于大型项目或 CI 环境,优先考虑检查速度:

  • 启用 metadata 缓存策略
  • 跳过性能影响大的规则
  • 启用渐进式检查

Quality 预设

适用于小型项目或开发环境,优先考虑代码质量:

  • 启用 content 缓存策略
  • 保留所有质量检查规则
  • 严格的错误级别

Balanced 预设

默认推荐配置,平衡性能和质量:

  • metadata 缓存策略
  • 适中的规则严格程度
  • 启用关键文件优先检查

CI 预设

专为持续集成环境优化:

  • 跳过耗时规则
  • 只保留关键错误检查
  • 忽略测试文件

Dev 预设

开发环境友好配置:

  • 更宽松的规则设置
  • 允许 console 和 debugger
  • 警告级别而非错误级别

Library 预设

适用于开源库或组件库:

  • 最严格的规则设置
  • 要求完整的类型注解
  • 强制文档注释

性能优化建议

1. 启用缓存

# package.json
{
  "scripts": {
    "lint": "eslint --fix --cache --cache-location .eslintcache"
  }
}

2. 使用合适的预设

  • 开发环境使用 dev 预设
  • CI 环境使用 ci 预设
  • 生产库使用 library 预设

3. 配置忽略模式

确保 .eslintignore 或配置中包含不需要检查的文件:

dist/
build/
coverage/
.turbo/
node_modules/
*.min.js

4. 渐进式检查

对于大型项目,启用渐进式检查:

ruleOptimization: {
  progressive: true,
  criticalFirst: true,
}

故障排除

缓存问题

如果遇到缓存相关问题,可以清理缓存:

rm -rf .eslintcache

性能问题

如果检查速度过慢,可以:

  1. 启用 skipExpensiveRules 选项
  2. 使用 performance 预设
  3. 增加忽略模式

规则冲突

如果遇到规则冲突,可以通过 customOverrides 覆盖:

ruleOptimization: {
  customOverrides: {
    'conflicting-rule': 'off',
  },
}

更新日志

v1.0.0

  • 初始版本
  • 支持缓存优化
  • 提供预设配置
  • 集成规则优化器