Code Monkey home page Code Monkey logo

eslint-config-sparkpost's Introduction

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.

eslint-config-sparkpost's People

Contributors

beardyman avatar bizob2828 avatar colestrode avatar jasminepate328 avatar jasonrhodes avatar rdunlapsp avatar tough-griff avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

mlebarron

eslint-config-sparkpost's Issues

"new-cap" rule errors on code from external libs

If you use a library that uses a capital letter method, eslint will error out.

let unzip = require('unzip');

unzip.Parse();
error  A function with a name starting with an uppercase letter should only be used as a constructor  new-cap

In my opinion the advantage of this rule isn't really worth the bother if that's how it works, I'd prefer to just turn it off. Thoughts?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.