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

create-zybx-linter

v1.1.2

Published

为前端项目自动构建在pre-commit时,利用eslint、prettier、yorkie、lint-staged、commitizen统一代码风格

Downloads

7

Readme

简介

在任意前端项目中安装本插件,即可自动集成eslint、prettier、commitlint、yorkie,并通过lint-staged进行commit时的代码校验

安装

npm init zybx-linter

支持校验的文件

  • js
  • vue
  • json

开始使用

npm init zybx-linter

问题

  • 请注意当前本地的node版本,不要过低,需大于v14,node过低会出现执行错误

发布

  • package.json中的version版本号变更后,执行以下命令
npm login  “(如已登陆不需要)”
npm publish

说明

  • 通过执行npm init zybx-linter时,自动执行该插件package.json中的bin命令,也就是执行main.js文件
  • 通过cross-spawn将eslint、prettier、commitlint、lint-staged、yorkie等依赖写入目标项目package.json中,并执行install
  • 通过node中的fs模块将eslint、prettier、commitlint、lint-staged、yorkie的配置写入目标项目package.json中

commitlint

限制了只能用如下参数进行提交
  • Feature: 新功能、新需求
  • Fix: 修补bug
  • Release: 发布
  • Reverts: 回滚提交

prettier

module.exports = {
  printWidth: 160,
  tabWidth: 2,
  useTabs: false,
  semi: true,
  singleQuote: true,
  bracketSpacing: true,
  arrowParens: "avoid",
  eslintIntegration: true,
  trailingComma: "none",
  endOfLine: "auto",
};

more refer:https://www.prettier.cn/

eslint

// npm install babel-eslint --save
module.exports = {
  root: true,
  env: {
    node: true
  },
  extends: ['plugin:vue/essential', '@vue/prettier', 'plugin:prettier/recommended'],
  parserOptions: {
    parser: 'babel-eslint'
  },
  plugins: ['vue'],
  rules: {
    //'off'或'0':关闭   'warn'或'1':警告   "error"或者"2":报错
    // 'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'error',
    'no-console': 'off',
    'no-debugger': 'off',
    'prettier/prettier': 'error'
  }
};

more refer:http://eslint.cn/

packageList

const packageList = [
  '@commitlint/cli@^17.7.1',
  '@commitlint/config-conventional@^17.7.0',
  'cz-git@^1.7.1',
  'babel-eslint@^10.1.0',
  'commitizen@^4.3.0',
  'eslint@^8.48.0',
  'eslint-config-prettier@^9.0.0',
  'eslint-plugin-prettier@^5.0.0',
  'eslint-plugin-vue@^9.17.0',
  'lint-staged@^10.5.4',
  'prettier@^3.0.2',
  'yorkie@^2.0.0'
];

package.json

"lint-staged": {
  "*.{js,vue,json}": [
    "prettier -w"
  ]
},
"config": {
  "commitizen": {
    "path": "node_modules/cz-git"
  }
},
"gitHooks": {
  "pre-commit": "lint-staged",
  "commit-msg": "npx commitlint --edit $1"
}