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-config-sparkpost

v3.0.0

Published

ESLint configuration for SparkPost

Downloads

195

Readme

eslint-config-sparkpost

ESLint configuration for Javascript and TypeScript based SparkPost projects

Upgrading from 2.x to 3.x

There were several breaking changes including moving from ESLint 5.x to ESLint 8.x. This change alone caused some minimal breaking changes. Since we ultimately extend eslint:recommended in our base configuration, the upgrade from eslint 5.x to 8.x changed that 'recommended' config and the rules between versions have definitely changed. We compensated to match our existing config as best we could, but you may find other changes when running ESLint in your projects.

We also moved several specific configs from overrides in the base config to their own specific configs. Mocha and TypeScript are used by some projects, however they are not used by every project so we have separated them to their own configs and moved their dependencies to optional peer dependencies so that we no longer need to install and maintain them in projects that don't use them.

Special Concerns for Mocha Based Projects

Traditionally we've setup special rules for mocha based projects, however not all projects use mocha. This would lead to dependencies being installed that were unrelated to the project. For this reason, we have split mocha configuration into its own configuration. You can take advantage of it by extending sparkpost/mocha from this package. This will require you to install the plugin eslint-plugin-mocha in the project's dev dependencies.

Example:

npm i -D eslint-plugin-mocha

In your .eslintrc file:

{
  "normal": "stuff <- comment",
  "overrides": [
    {
      "files": ["test/**/*.spec.js"],
      "extends": ["sparkpost/mocha"]
    }
  ]
}

Special Concerns for TypeScript Projects

We have several typescript based projects, however not all projects use typescript. This would lead to dependencies being installed that were unrelated to the project. For this reason, we have split typescript configuration into its own configuration. You can take advantage of it by extending sparkpost/typescript from this package. This will require you to install several plugins and configs in the project's dev dependencies.

Example:

npm i -D @typescript-eslint/eslint-plugin @typescript-eslint/parser eslint-config-prettier eslint-plugin-prettier

In your .eslintrc file:

{
  "normal": "stuff <- comment",
  "extends": ["sparkpost/typescript"],
  "rules": {
    "other": "rules that override the base typescript config <- comment"
  }
}

Docs in Libraries

This config has extra rules specifically around JSDocs to help have better documentation in our libraries.
This can help in knowledge sharing and will hopefully promote better docs in our shared JS modules.

To use, add the following to your .eslintrc file:

{
  "extends": "sparkpost/lib"
}

Automation for Checking Changelogs

Add the npm scripts

{
  "chk-changelog": "grep `node -e 'console.log(require(\"./package.json\").version);'` CHANGELOG.md || echo 'Please update CHANGELOG.md with your updates'; exit 255",
  "prepublishOnly": "npm run chk-changelog"
}

This will check your changelog for an entry for your current version when you publish.