Rules that apply to testing with the should.js library.
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
Add @jaredmcateer/shouldjs
to the plugins section of your .eslintrc
configuration file. You can omit the eslint-plugin-
prefix:
{
"plugins": ["@jaredmcateer/shouldjs"]
}
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"]
}
}
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"]
}
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.