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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@wang1212/eslint-config

v0.4.0

Published

Community-recommended best practices for [ESLint](https://eslint.org/) rule configuration.(Use with [Prettier](https://prettier.io/))

Downloads

41

Readme

ESLint Config

LICENSE NPM VERSION DOWNLOAD LAST COMMIT GITHUB PACKAGE CI Commitizen friendly Codacy Badge

English | 简体中文

这个包提供了社区推荐的 ESLint 规则配置,作为一个可扩展的共享配置。(与 Prettier 配合使用)

支持 ESLint V8,Node.js 需要版本 >=16。

用法

npm install --save-dev @wang1212/eslint-config
  1. 安装 peerDependencies

    npm install --save-dev eslint
    npm install --save-dev --save-exact prettier
  2. 在项目根目录创建一个 .prettierrc.yml 文件,配置以下内容:

    # see docs: https://prettier.io/docs/en/configuration.html
    
    # prettier config
    printWidth: 80
    tabWidth: 2
    useTabs: false
    singleQuote: true
    semi: true
    endOfLine: 'auto'

    这只是推荐配置,可以根据你的喜好进行调整。

  3. 然后你需要添加 @wang1212/eslint-config 到你的 .eslintrc.json 配置文件:

    {
    + "extends": ["@wang1212/eslint-config"]
    }

    ESLint 的规则配置是可以根据你自己的要求进行配置覆盖的,请参考官方文档

配置细节

@wang1212/eslint-config

该配置适用于基本的 JavaScript,基于 Airbnb JavaScript Style GuideSonarJSJSDoc,并借助 Browserslist 检测 API 兼容性。(See Source)

@wang1212/eslint-config/typescript

该配置适用于基本的 TypeScript,基于 Airbnb JavaScript Style GuideSonarJSTSDoc,并借助 Browserslist 检测 API 兼容性。(See Source)

这个配置也有一个别名 @wang1212/eslint-config/ts

使用这个配置还需要一些额外的工作。

  1. 安装额外的 peerDependencies:

    npm install --save-dev @typescript-eslint/parser @typescript-eslint/eslint-plugin

    注意: 按照官方的维护策略,以上依赖安装时应始终保证版本号相同。

  2. 然后你需要添加 @wang1212/eslint-config/typescript 到你的 .eslintrc.json 配置文件:

    {
    - "extends": ["@wang1212/eslint-config"],
    + "extends": ["@wang1212/eslint-config/typescript"],
    + "parser": "@typescript-eslint/parser",
    + "parserOptions": {
    +   "project": './tsconfig.json'
    + },
    }

@wang1212/eslint-config/react

该配置适用于 JavaScript 编写的 react.js 应用,基于 Airbnb JavaScript Style GuideHooksSonarJSJSDoc,并借助 Browserslist 检测 API 兼容性。(See Source)

使用这个配置还需要一些额外的工作。

  • 你需要添加 @wang1212/eslint-config/react 到你的 .eslintrc.json 配置文件:

    {
    - "extends": ["@wang1212/eslint-config"],
    + "extends": ["@wang1212/eslint-config/react"],
    }

@wang1212/eslint-config/react-typescript

该配置适用于 TypeScript 编写的 react.js 应用,基于 Airbnb JavaScript Style GuideHooksSonarJSTSDoc,并借助 Browserslist 检测 API 兼容性。(See Source)

这个配置也有一个别名 @wang1212/eslint-config/react-ts

使用这个配置还需要一些额外的工作。

  1. 安装额外的 peerDependencies:

    npm install --save-dev @typescript-eslint/parser @typescript-eslint/eslint-plugin

    注意: 按照官方的维护策略,以上依赖安装时应始终保证版本号相同。

  2. 然后你需要添加 @wang1212/eslint-config/react-typescript 到你的 .eslintrc.json 配置文件:

    {
    - "extends": ["@wang1212/eslint-config"],
    + "extends": ["@wang1212/eslint-config/react-typescript"],
    + "parser": "@typescript-eslint/parser",
    + "parserOptions": {
    +   "project": './tsconfig.json'
    + },
    }

@wang1212/eslint-config/node

该配置适用于 JavaScript 编写的 Node.js 程序,基于 Airbnb JavaScript Style GuideSonarJSJSDoc。(See Source)

使用这个配置还需要一些额外的工作。

  • 你需要添加 @wang1212/eslint-config/node 到你的 .eslintrc.json 配置文件:

    {
    - "extends": ["@wang1212/eslint-config"],
    + "extends": ["@wang1212/eslint-config/node"],
    }

开发准则

Git 提交信息格式

采用社区提交格式最佳实践

# 以前
git commit

# 现在
npm run commit

这种约束依赖于社区提供的工具 commitizencommitlint

npm 发布

该模块的版本管理采用社区推荐的规范语义化版本控制。跟随版本变动会维护一个变更日志(CHANGELOG.md)了解为什么这么做)。

# 在发布到 npm 存储库之前更新版本并生成更改日志
npm run release
# 或者,进行预览
npm run release -- --dry-run

# 然后发布到 npm,如果在自动发布到 npm 时没有选择 yes
npm publish # npm publish --access public

这些工作是在社区提供的 release-it 工具的帮助下完成的。

许可

MIT.