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

eslint-config-zain

v1.0.8

Published

eslint configuration for zain

Downloads

13

Readme

English | 简体中文

eslint-config-zain

用来给 ReactTypescript 添加 Eslint 规则

使用

安装

# 项目中只需引入这一个依赖包就可以了,不用加 eslint 和 prettier 或者其它配置包
npm i -D eslint-config-zain

添加配置文件 .eslintrc.js,在 .eslintignore 中添加过滤文件和文件夹

module.exports = {
  extends: 'eslint-config-zain',
  rules: {},
  parserOptions: {
    ecmaVersion: 2020,
    sourceType: 'module',
    project: './tsconfig.json',
    tsconfigRootDir: __dirname,
    createDefaultProgram: true,
  },
  settings: {
    'import/resolver': {
      node: {},
      webpack: {
        // 这行根据自己的配置可加可不加
        config: require.resolve('./configs/webpack.config.eslint.ts'),
      },
      typescript: {},
    },
  },
}

package.json 文件增加脚本和配置

{
  "scripts": {
    "lint": "eslint . --ext .js,.jsx,.ts,.tsx",
    "lint:fix": "eslint . --ext .js,.jsx,.ts,.tsx --fix",
  }
}

开发调试

  1. 将包发布到 ~/.yalc 中并监听文件修改
npm run start
  1. 其它项目中使用 ~/.yalc 中的本地包调试
# 全局安装 yalc
npm i yalc -g

# 将本地包添加到其它联调项目中(这条命令在其它项目中执行)
yalc add eslint-config-zain --dev

# 安装本地包 eslint-config-zain 中的依赖(当前项目更新依赖包后,其它项目中都需要再执行一次)
npm i
  1. 调试完成后,移除 ~/.yalc 中的本地包,还原 package.json 文件和 node_modules 依赖包
# 移除本地包,还原 package.json 文件
yalc remove eslint-config-zain

# 还原依赖包 `node_modules` 依赖包
npm i
  1. 本地包热更原理说明
  • 使用 nodemon 监听指定文件修改,修改后触发 yalc push 发布更新本地包
# nodemon 监视文件更改并执行对应的命令常用参数(可以通过 nodemon -h 查看更多命令)
nodemon
 --ignore node_modules/ # 忽略目录
 --watch ./ # 观察目录
 -C # 只在变更后执行,首次启动不执行命令(当前项目设置为首次启动执行)
 -e js,ts,json,md # 监控指定后缀名的文件
 --debug # 调试
 -x "npm run push" # 自定义命令

发布依赖包

  1. 更新 package.json 中的版本号
{
  "version": "1.0.4",
}
  1. 添加 npm 用户(已经添加过就不用添加了)
# (mac)添加好后会在这个目录记录当前用户的 _authToken: /Users/[当前用户目录]/.npmrc
npm adduser
  1. 发布
npm publish