ESLint rules for Jasmine
-
Install
eslint-plugin-jasmineas a dev-dependency:npm install --save-dev eslint-plugin-jasmine
-
Enable the plugin by adding it to your
.eslintrc:plugins: - jasmine
This plugin ships with a default configuration for each rule:
| Rule | Default | Options |
|---|---|---|
| no-focused-tests | 2 | |
| no-disabled-tests | 1 | |
| no-spec-dupes | 1, 'block' | ['block', 'branch'] |
| no-suite-dupes | 1, 'block' | ['block', 'branch'] |
| no-suite-callback-args | 2 | |
| missing-expect | 0, 'expect()' | expectation function names |
| valid-expect | 1 |
For example, the no-focused-tests rule is enabled by default and will cause
ESLint to throw an error (with an exit code of 1) when triggered.
You may customise each rule by adding a value in your .eslintrc rules
property:
plugins:
- jasmine
rules:
jasmine/no-focused-tests: 0
jasmine/no-suite-dupes:
- 2
- "branch"See configuring rules for more information.
© 2015 Tom Vincent git@tlvince.com
Licensed under the MIT license.