Skip to content

Eslint rules for the should-js test library

License

Notifications You must be signed in to change notification settings

jaredmcateer/eslint-plugin-shouldjs

Repository files navigation

eslint-plugin-shouldjs

Rules that apply to testing with the should.js library.

Installation

You'll first need to install ESLint:

npm i eslint --save-dev

Next, install @jaredmcateer/eslint-plugin-shouldjs:

npm install @jaredmcateer/eslint-plugin-shouldjs --save-dev

Usage

Add @jaredmcateer/shouldjs to the plugins section of your .eslintrc configuration file. You can omit the eslint-plugin- prefix:

{
  "plugins": ["@jaredmcateer/shouldjs"]
}

Configuration

Settings

By default the only allowed variable name for Should.js is should, this can be changed by providing an array to shouldVarNames in the eslint settings.

{
  "settings": {
    "shouldVarNames": ["should", "expect"]
  }
}

Rules

Add the rules you want to use under the rules section.

{
  "rules": {
    "@jaredmcateer/shouldjs/should-var-name": "error",
    "@jaredmcateer/shouldjs/no-property-assertions": "error"
  }
}

Alternative you can use the recommended settings

{
  "extends": ["@jaredmcateer/shouldjs:recommended"]
}

Supported Rules

Acknowledgements

Much of the configuration and learnings of building ESLint Plugins was lifted directly from Darragh ORiordan's article on How to Write an ESLint Plugin in TypeScript and repository. Huge thanks.