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

eslint-plugin-springload

v2.2.0

Published

Springload's ESLint shareable configurations as a plugin

Downloads

82

Readme

eslint-plugin-springload npm Build Status

Springload's ESLint shareable configurations, as a plugin.

Why

We want shareable configs to have as low of an overhead as possible. Users shouldn't have to know exactly what plugins are required by the config, install them and manage their versions manually. This plugin exposes eslint-config-springload for reuse, with plugins automatically installed.

See https://github.com/eslint/eslint/issues/3458 for further discussion on this topic. Approach inspired by eslint-plugin-react-app.

Usage

Install the config and its dependencies:

npm install --save-dev eslint@3 eslint-plugin-springload

Configure ESLint to use this config. For example, in your package.json, this would be:

"eslintConfig": {
  "extends": "plugin:springload/recommended"
},

Optionally, use the Prettier config:

npm install --save-dev eslint@3 eslint-plugin-springload prettier
"eslintConfig": {
  "extends": "plugin:springload/prettier"
},

Then, to configure Prettier itself, create a prettier.config.js file in the root of your project with:

// Use the Prettier config that comes with eslint-plugin-springload.
module.exports = require('eslint-plugin-springload/prettier.config');

Integration in a development workflow

For Springload projects, linting commands are defined in the package.json as npm scripts. Here are example commands leveraging the ESLint and Prettier configuration, to process code in a lib subfolder:

"scripts": {
    "linter:js": "eslint",
    "formatter:js": "prettier --write",
    "lint": "npm run linter:js -s -- lib",
    "format": "npm run formatter:js -s -- lib/**/*.js",
}

Those commands can then be ran manually.

Usage with git pre-commit hook

The above commands are meant to be usable on arbitrary lists of files. Here is an example pre-commit script that leverages them to re-format and lint JS when committing:

# Only keep staged files that are added (A), copied (C) or modified (M).
STAGED=$(git --no-pager diff --name-only --cached --diff-filter=ACM)
# Files which are only partly staged (eg. git add --patch).
PATCH_STAGED=$(git --no-pager diff --name-only --diff-filter=ACM $STAGED)
# Files which are fully staged.
FULLY_STAGED=$(comm -23 <(echo "$STAGED") <(echo "$PATCH_STAGED"))

JS_STAGED=$(grep .js$ <<< "$STAGED" || true)
JS_FULLY_STAGED=$(grep .js$ <<< "$FULLY_STAGED" || true)
SNAPSHOT_STAGED=$(grep .snap$ <<< "$STAGED" || true)

if [ -n "$JS_FULLY_STAGED" ];
then
    # Format and re-stage fully staged files only.
    npm run formatter:js -s -- $JS_FULLY_STAGED
    git add $JS_FULLY_STAGED
fi

if [ -n "$JS_STAGED" ];
then
    npm run linter:js -s -- $JS_STAGED
fi

Configuring the rules

This is a drop-in configuration for Springload projects. Should further customisation be required, rules coming from external plugins require the springload prefix:

{
  "extends": "plugin:springload/recommended"
  "rules": {
-    "react/react-in-jsx-scope": ["warn"],
+    "springload/react/react-in-jsx-scope": ["warn"],
-    "import/prefer-default-export": ["warn"],
+    "springload/import/prefer-default-export": ["warn"],
  }
}

Usage

Development

Install

git clone [email protected]:springload/eslint-plugin-springload.git
cd eslint-plugin-springload
nvm install
# Then, install all project dependencies.
npm install
# Install the git hooks.
./.githooks/deploy

Development

# Runs linting.
npm run lint
# Runs tests.
npm run test

Releases

This project follows Semantic Versioning as well as ESLint's Semantic Versioning Policy.

# 1. Make a new branch for the release of the new version.
git chore release-vx.y.z
# 2. Update the version in package.json
# 3. Use irish-pub to check the package content. Install with `npm install -g` first.
irish-pub
# 4. Update the [CHANGELOG](CHANGELOG.md) for the upcoming release.
# 5. Create a PR and merge it.
# 6. On master,
npm publish
# 7. Finally, go to GitHub and create a release and a tag for the new version.