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

@reskript/cli-lint

v6.2.1

Published

通过eslint检查代码规范。

Downloads

116

Readme

@reskript/cli-lint

通过eslint检查代码规范。

正常使用

使用skr lint检查代码规范。

Usage: lint [options] [files...]

Lint files, by default .js(x) files under src are linted

Options:
  --changed                    lint only changed files in git workspace
  --staged                     lint only staged (both partially and fully) files in git workspace
  --allow-unsafe-react-method  allow UNSAFE_* methods in react component
  --fix                        fix possible lint errors
  -h, --help                   output usage information

缩小检查范围

对于比较大型的项目,通常全量的检查很消耗时间,此时可以选择仅检查已经修改过的代码:

skr lint --changed

也可以进一步缩小范围,仅检查通过git add添加到版本中的代码:

skr lint --staged

使用git钩子进行检查

推荐使用husky在代码提交前对代码进行检查。

首先安装husky:

npm install --save-dev husky

随后在package.json中增加以下内容:

{
  "husky": {
    "hooks": {
      "pre-commit": "skr lint --staged --fix --auto-stage"
    }
  }
}

在每次git commit提交代码时,都会检查需要提交入库的代码。

直接使用lint配置

如果你需要直接使用eslint的规则,比如通过编辑器的eslint插件进行代码的实时检查,则需要放置一个.eslintrc.js配置文件并引用@reskript/config-lint的规则,具体请参考config-lint的说明