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 🙏

© 2026 – Pkg Stats / Ryan Hefner

eslint-config-cmyr

v2.3.0

Published

草梅友仁个人使用的 eslint 检测规范

Readme

eslint-config-cmyr

草梅友仁个人使用的 eslint 检测规范

支持 ESLint v9+ 的扁平化配置(Flat Config)

"lint": "cross-env NODE_ENV=production eslint src --fix"

风格理念

  1. 若无必要,勿增实体。
  2. 如果某元素可有可无,则无
  3. 若移除某元素会导致 bug ,则留,否则无

安装

# 前置依赖
npm install typescript eslint --save-dev
# 安装 eslint-config-cmyr
npm install eslint-config-cmyr --save-dev

配置

ESLint v9+ (推荐)

使用新的扁平化配置格式:

// eslint.config.js
import { defineConfig } from "eslint/config";
import cmyr from "eslint-config-cmyr";

export default defineConfig([cmyr]);

不同环境的配置

TypeScript 项目(默认)

// eslint.config.js
import { defineConfig } from "eslint/config";
import cmyr from "eslint-config-cmyr";

export default defineConfig([cmyr]);

TypeScript 项目(严格模式)

严格模式入口适用于对类型安全和代码质量要求更高的项目。该入口会启用基于类型信息的 TypeScript 检查,并对 any、不安全调用、不安全赋值等问题给出提示。

// eslint.config.js
import { defineConfig } from "eslint/config";
import cmyrStrict from "eslint-config-cmyr/strict";

export default defineConfig([cmyrStrict]);

默认入口与严格模式的区别:

  1. 默认入口保留通用且必要的规则,兼容性优先。
  2. 严格模式会启用 typescript-eslint 的类型感知严格规则。
  3. 严格模式下新增规则以 warning 为主,便于存量项目渐进治理。
  4. 只有少量开发期噪音较高的规则会按 NODE_ENV 在 production 中启用,例如 no-consoleno-debugger 与行数限制。

Vue 项目

npm install typescript eslint eslint-plugin-vue eslint-config-cmyr --save-dev
// eslint.config.js
import { defineConfig } from "eslint/config";
import cmyr from "eslint-config-cmyr/vue";

export default defineConfig([cmyr]);

Vue 项目(严格模式)

// eslint.config.js
import { defineConfig } from "eslint/config";
import cmyrVueStrict from "eslint-config-cmyr/vue/strict";

export default defineConfig([cmyrVueStrict]);

React 项目

npm install typescript eslint eslint-plugin-react eslint-config-cmyr --save-dev
// eslint.config.js
import { defineConfig } from "eslint/config";
import cmyr from "eslint-config-cmyr/react";

export default defineConfig([cmyr]);

React 项目(严格模式)

// eslint.config.js
import { defineConfig } from "eslint/config";
import cmyrReactStrict from "eslint-config-cmyr/react/strict";

export default defineConfig([cmyrReactStrict]);

Browser 项目

// eslint.config.js
import { defineConfig } from "eslint/config";
import cmyr from "eslint-config-cmyr/browser";

export default defineConfig([cmyr]);

Nuxt 项目

npm install typescript eslint eslint-plugin-vue eslint-config-cmyr @nuxt/eslint --save-dev
// nuxt.config.ts;
export default defineNuxtConfig({
    modules: ["@nuxt/eslint"],
    eslint: {
        config: {
            standalone: false,
        },
    },
});
// eslint.config.js
import cmyrConfig from "eslint-config-cmyr/nuxt";
import withNuxt from "./.nuxt/eslint.config.mjs";

export default withNuxt(cmyrConfig, {
    rules: {},
});

Nuxt 项目(严格模式)

// eslint.config.js
import cmyrNuxtStrict from "eslint-config-cmyr/nuxt/strict";
import withNuxt from "./.nuxt/eslint.config.mjs";

export default withNuxt(cmyrNuxtStrict, {
    rules: {},
});

严格模式入口一览

  1. eslint-config-cmyr/strict
  2. eslint-config-cmyr/react/strict
  3. eslint-config-cmyr/vue/strict
  4. eslint-config-cmyr/nuxt/strict

这些入口都会在对应环境规则之上,额外启用类型感知的 TypeScript 严格检查;新增规则以 warning 为主,适合渐进式治理。