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

@magijs/lint

v0.0.2-alpha.3

Published

前端工作流程规约

Downloads

44

Readme

lint

我们通常会在项目中使用 ESLint、Stylelint 来协助我们把控编码质量,为了实现低成本、高性能、更稳定地接入工具, 提供了开箱即用的 Lint 能力,包含以下特性:

  1. 推荐配置:提供 ESLint 及 Stylelint 推荐配置,在发布系统执行检查时使用推荐配置
  2. 统一的 CLI:提供 lint CLI,集成式调用 ESLint 和 Stylelint
  3. 规则稳定:始终确保规则的稳定性,不会出现上游配置更新导致存量项目 lint 失败的情况

设计目标

在现有规范下,把分散在项目中的依赖统一集成到了zalint命令包中维护升级。对于规范将内置在zalint中,不提供外部配置方式。后续将使用 zalint 内置的规范执行

使用

安装

yarn add @magijs/lint@latest

执行命令

# 执行eslint检查js代码规范
zalint eslint

# 执行stylelint检查样式规范
zalint stylelint

# 生成报告,同时执行eslint和stylelint
zalint report

#
zalint staged

自定义静态扫描目录

# 指定扫描client目录
zalint eslint -d client -fix

# 指定扫描client目录
zalint stylelint -d client -fix

# 指定扫描client目录
zalint report -d client

与 Git 工作流结合

将 lint 与 Git 工作流结合使用,以便在提交代码时自动 lint 本次变更的代码。

git commit 流程检查:

  • git commit 时会自动执行npm run precommit,若执行报错将终止提交
  • 校验 commit 消息格式是否合法,若不合法将终止提交
  • 校验 git config user.email 配置是否邮箱,否则终止提交

内置规则

参考

  • https://alloyteam.github.io/eslint-config-alloy/?language=zh-CN
  • https://github.com/conventional-changelog/commitlint
  • https://github.com/eslint/eslint
  • https://github.com/prettier/prettier
  • https://github.com/okonet/lint-staged