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

h-com-linters

v1.14.0

Published

Vue3项目的husky + lint-staged + eslint + stylelint + prettier + commitlint 配置集合

Downloads

15

Readme

h-com-linters Configs

Vue 项目的 husky + lint-staged + eslint + stylelint + prettier + commitlint 配置集合

目 录 结 构

configs // .husky+commitlint+eslint + stylelint + prettier + commitlint等 配置集合
    -- .husky // git hooks .husky文件配置
    -- .commitlintrc.js // commitlint配置
    -- .eslintignore.ts // eslint忽略配置
    -- .eslintrc// eslint配置
    -- .prettierrc.js // prettier配置(美化代码)
    -- .stylelintrc.js // stylelint配置
    --  tsconfig.json // 
lib // 组件编译输出目录
    -- bin.js//  .bin可执行文件入口
    -- index.js // 仓库入口文件 
    -- index.d.ts // 
    -- bin.d.ts//

使用

**前置条件 **

1.安装 h-com-linters

npm install h-com -linters

2.IDE 安装 eslint、stylelint、prettier 插件,用于编码时的提醒 3.在 package.json 中添加

// windows 
"scripts": {
    "prepare": "h-com-linters install", //ts 项目
    "prepare": "h-com-linters install --js", //js 项目 
}
// mac pre-commit等在mac下不被认可为可执行文件
"scripts": {
    "prepare": "h-com-linters install && chmod +x .husky/*",
}

执行(windows 推荐使用 git bash,'h-com-linters install && chmod +x .husky/*'命令就会不报错)

yarn add -D h-com-linters

注意:更新h-com-linters 也使用上面这条命令,这样才能触发执行 scripts.prepare

h-com-linters 自动会安装相关的依赖包,并将 husky 配置、代码检查相关配置、commit 提交配置都拷贝到项目下。

4.还可以作为一个简易的脚手架使用

npm h-com-linters  -g

全局安装后

h-com-linters clicreate yourProjectName

构建 & 发布

目前项目构建使用 semantic-release 自动发布,

发布过程为:

  • yarn 安装依赖包
  • yarn run build 执行构建(本项目通过配置 scripts: {"prepare": "npm run build"}实现)
  • yarn run semantic-release 版本更新并发布

实现原理

仿 husky 实现,详细查看:git commit 代码校验和提交注释校验

其他问题

  1. npm 包中文件行尾是 LF,如果项目本身是 CRLF 行尾,可能需要设置一下: git config --global core.autocrlf false
  2. 配置完成后,配置没有马上生效,可以重启 IDE