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

ync-cli-eslint-config

v0.1.5

Published

eslint, prettier 配置方案

Readme

简介

eslint, prettier 配置方案

如何扩展此 cli 工具

相关命令

# 安装依赖【切记不能通过 cnpm 安装,否则下面 link 和 test 会报错】
npm ci

# link
npm run link

# 本地测试
npm run test

# 发布
npm publish --access=public

项目相关 npm 包

一、prettier
eslint-config-prettier

二、eslint
eslint
eslint-plugin-import

1、js
@babel/core
@babel/eslint-parser
eslint-config-airbnb [用到才安装]

2、react
eslint-plugin-react,
eslint-plugin-react-hooks,
eslint-plugin-jsx-a11y

3、taro
eslint-plugin-taro

4、ts
@typescript-eslint/parser
eslint-import-resolver-typescript,
@typescript-eslint/eslint-plugin,
eslint-plugin-deprecation

三、alias
eslint-import-resolver-alias

如何使用此 cli 工具

# 依赖安装
npm install ync-cli-eslint-config -D

# 使用方法
npx ync-eslint-config -t -a -f react

参数描述

| 参数名 | 类型 | 说明 | 默认值 | 必须 | | --- | --- | --- | --- | --- | | -f, --framework | String | 项目使用的框架 , 不传则使用 Javascript 相关 Eslint 配置 | N/A | 否 | | -t, --typescript | Boolean | 项目是否使用了 Typescript , 为 true 则添加 Typescript 相关 Eslint 配置 | false | 否 | | -a, --alias | Boolean | 项目是否使用了 webpack alias | false | 否 | | -c, --cypress | Boolean | 项目是否使用了 Cypress | false | 否 |

IDE 配置

配置 VScode

  1. 安装 eslint 插件
  2. 打开 vscode 的配置文件setting.json,然后添加如下配置
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
    "source.fixAll.eslint": true
}
  1. 重新启动 vscode

配置 WebStorm

  1. 打开设置面板

    • windows: file -> settings
    • mac: Preferences
  2. 找到 eslint 设置页

    • search 'eslint'
    • Languages & Frameworks -> JavaScript -> Code Quality Tools -> ESLint
  3. 打开 eslint 选择第二项: Automatic ESlint configuration

  4. 如果碰到ESLint: Delete (prettier/prettier)的问题,可以是这尝试下面方案

$ git config --global core.autocrlf false
然后删掉本地的仓库,重新 git clone.

常见问题 ⚠️⚠️⚠️

实验型功能

如果项目依赖了一些试验型的功能(装饰器,class-properties)时,需要手动安装对应的 babel 插件,并配置到 babel.config.json

/** babel.config.json */
{
  "presets": ["@babel/preset-env", "@babel/preset-react"],
  "plugins": [
    ["@babel/plugin-proposal-decorators", { "legacy": true }],
    ["@babel/plugin-proposal-class-properties", { "loose": true }]
  ]
}

文件别名配置

vscode 并不支持相对路径直接跳转,可以在项目根目录下创建 jsconfig.json

/** jsconfig.json */
{
  "compilerOptions": {
    "baseUrl": ".",
    "paths": {
      "~/*": ["./*"]
    }
  }
}

参考资料