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

express-check-in

v0.2.0

Published

Quickly validate and fixup code style and spelling

Downloads

31

Readme

express-check-in

Prettier npm License

Validate and fixup code at check-in

Install

With yarn:

yarn add --dev prettier express-check-in

With npm:

npm install --save-dev prettier express-check-in

Usage

With yarn:

yarn express-check-in

With npx:

npx -p prettier@latest -p express-check-in express-check-in

Note: You can (should) change latest to a specific version of Prettier.

With npm:

npm exec express-check-in

Plugins

The express-check-in command has a plugin-based architecture. There are two built-in plugins, prettier and cspell. Both of these are by default enabled if the required dependency is installed (respectively the prettier and cspell-lib packages).

To do:

  • Write documentation on how to write your own plugins
  • Load 3rd party plugins automatically?
  • Provide eslint --fix plugin?

Pre-Commit Hook

You can run express-check-in as a pre-commit hook using husky.

yarn add --dev husky
yarn husky add .husky/pre-commit "yarn express-check-in --staged"

CLI Flags

--staged

Pre-commit mode. Under this flag only staged files will be formatted, and they will be re-staged after formatting.

Partially staged files will be re-staged after formatting, but the files on disk will not be updated to reflect these changes. This prevents conflicts between the unstaged changes and the changes made by express-check-in.

--pattern

Filters the files for the given micromatch pattern.
For example express-check-in --pattern "**/*.*(js|jsx)" or express-check-in --pattern "**/*.js" --pattern "**/*.jsx"

--plugin

Explicitly pass what plugins to use, e.g.

express-check-in --plugin prettier

will only use the prettier builtin plugin, even if the cspell builtin plugin could also be loaded.

--verbose

Outputs the name of each file right before it is processed. This can be useful if Prettier throws an error and you can't identify which file is causing the problem.

--bail

Prevent git commit if any files are fixed.

--check

Check that files are correctly formatted, but don't format them. This is useful on CI to verify that all changed files in the current branch were correctly formatted.

--no-resolve-config

Do not resolve prettier config when determining which files to format, just use standard set of supported file types & extensions prettier supports. This may be useful if you do not need any customization and see performance issues.

By default, express-check-in will check your prettier configuration file for any overrides you define to support formatting of additional file extensions.

Example .prettierrc file to support formatting files with .cmp or .page extensions as html.

{
    "printWidth": 120,
    "bracketSpacing": false,
    "overrides": [
        {
            "files": "*.{cmp,page}",
            "options": {"parser": "html"}
        }
    ],
}

Project

This project started as a fork of pretty-quick. Some functionality, e.g. mercurial support, is removed to make it possible to restage partially staged files. The prettier-only implementation is expanded to also support other checks, such as spell checking via cspell.