🌜
🌞
eslint-plugin-jasmine

eslint-plugin-jasmine

v4.1.3

ESLint rules for Jasmine

npm install eslint-plugin-jasmine

README

eslint-plugin-jasmine

Build Status npm version License

ESLint rules for Jasmine

Usage

  1. Install eslint-plugin-jasmine as a dev-dependency:

    npm install --save-dev eslint-plugin-jasmine
    
  2. Enable the plugin by adding it to your .eslintrc:

    plugins:
      - jasmine
    

ESLint itself provides a Jasmine environment for Jasmine's global variables. It's therefore recommended to also enable it in your .eslintrc:

plugins:
  - jasmine
env:
  jasmine: true

By default, no rules are enabled. See the next section for more.

Configuration

This plugin exports a recommended configuration that enforces good practices.

To enable this configuration, use the extends property in your .eslintrc config file:

plugins:
  - jasmine
env:
  jasmine: true
extends: 'plugin:jasmine/recommended'

See the ESLint config docs for more information about extending configuration files.

Rules

Rule Recommended Options
expect-matcher 1,
expect-single-argument 1,
missing-expect 0, 'expect()', 'expectAsync()' expectation function names
named-spy 0
new-line-before-expect 1
new-line-between-declarations 1
no-assign-spyon 0
no-describe-variables 0
no-disabled-tests 1
no-expect-in-setup-teardown 1, 'expect()', 'expectAsync()' expectation function names
no-focused-tests 2
no-global-setup 2
no-pending-tests 1
no-promise-without-done-fail 1
no-spec-dupes 1, 'block' ['block', 'branch']
no-suite-callback-args 2
no-suite-dupes 1, 'block' ['block', 'branch']
no-unsafe-spy 1
valid-expect deprecated
prefer-jasmine-matcher 1
prefer-promise-strategies 1
prefer-toHaveBeenCalledWith 1
prefer-toBeUndefined 0 ['always', 'never']

For example, using the recommended configuration, the no-focused-tests rule is enabled 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
env:
  jasmine: true
rules:
  jasmine/no-focused-tests: 0
  jasmine/no-suite-dupes:
    - 2
    - branch

See configuring rules for more information.

Author

© 2016 - 2017 Tom Vincent [email protected] and contributors.

License

Released under the MIT license.

Release Notes

4.1.3
By Tom Vincent • Published on November 24, 2021

4.1.3 (2021-11-24)

Bug Fixes

  • rule: Add required meta.fixable attribute (#341) (3a61ff2)
  • rule: Support await/return expect() for new-line-before-expect rule (#259) (ee078a6)
4.1.2
By Tom Vincent • Published on February 2, 2021

4.1.2 (2021-02-02)

Bug Fixes

  • Definition for rule 'jasmine/prefer-toBeUndefined' was not found (6e2b913), closes #300
4.1.1
By Tom Vincent • Published on April 13, 2020

4.1.1 (2020-04-13)

Bug Fixes

  • no-focused-test: Only report focused test keyword, not test (796dddf), closes #230
4.1.0
By Tom Vincent • Published on November 16, 2019

4.1.0 (2019-11-16)

Features

  • no-pending-tests: add rule to disallow pending specs (ab30e3e)
4.0.0
By Tom Vincent • Published on November 9, 2019

4.0.0 (2019-11-09)

chore

BREAKING CHANGES

  • repo: upgrades eslint from v4.x to 6.x
3.0.0
By Tom Vincent • Published on November 9, 2019

3.0.0 (2019-11-09)

chore

  • package: drop support for Node.js older than v8 (39c40ce)
  • travis: drop support for node v4 (f42039e)

Features

  • missing-expect: add expectAsync() support (45e2abd)
  • no-expect-in-setup-teardown: add expectAsync() support (2eea06b)
  • prefer-toBeUndefined: add rule to prefer toBeUndefined matcher (4604189)

BREAKING CHANGES

  • package: this package no longer supports Node.js versions older than v8.
  • travis: After this release, node v4.x is not guaranteed to be compatible with this package.
2.10.1
By Tom Vincent • Published on May 17, 2018

<a name"2.10.1">

2.10.1 (2018-05-17)

Bug Fixes

  • rule: allow done.fail in first argument of then (76a524e1)
2.10.0
By Tom Vincent • Published on May 10, 2018

<a name"2.10.0">

2.10.0 (2018-05-10)

Features

  • rule: add rule to disallow promise without done.fail (9bd0f76e)
2.9.3
By Tom Vincent • Published on February 28, 2018

<a name"2.9.3">

2.9.3 (2018-02-28)

Bug Fixes

  • new-line-between-declarations: Add extra check for arguments body (2338ffef)
2.9.2
By Tom Vincent • Published on February 6, 2018

<a name"2.9.2">

2.9.2 (2018-02-06)

Bug Fixes

  • docs:
    • adding the lint rule names to the title (31e897ae)
    • add rule name to the title (a05151f2)

General

License
MIT
Typescript Types
None found
Tree-shakeable
No

Popularity

GitHub Stargazers
92
Community Interest
171
Number of Forks
51

Maintenance

Commits
10/219/2201
Last Commit
Nov 7, 2021
Open Issues
33
Closed Issues
49
Open Pull Requests
31
Closed Pull Requests
159

Versions

Versions Released
10/219/2201
Latest Version Released
Current Tags
latest4.1.3

Dependencies

Contributors

tlvince
tlvince
Commits: 53
greenkeeperio-bot
greenkeeperio-bot
Commits: 9
emilos
emilos
Commits: 8
alecxe
alecxe
Commits: 7
burabure
burabure
Commits: 5
DianaSuvorova
DianaSuvorova
Commits: 5
remcohaszing
remcohaszing
Commits: 5
JELaVallee
JELaVallee
Commits: 4
sonicdoe
sonicdoe
Commits: 3
elliot-nelson
elliot-nelson
Commits: 3
petersendidit
petersendidit
Commits: 3
ganimomer
ganimomer
Commits: 3
jrencz
jrencz
Commits: 3
yaarams
yaarams
Commits: 2
ArnaudRinquin
ArnaudRinquin
Commits: 2