Socket
Socket
Sign inDemoInstall

eslint-plugin-jasmine

Package Overview
Dependencies
0
Maintainers
1
Versions
54
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.5.0 to 2.6.0

docs/rules/new-line-before-expect.md

6

index.js

@@ -18,3 +18,4 @@ 'use strict'

'no-expect-in-setup-teardown': require('./lib/rules/no-expect-in-setup-teardown'),
'new-line-between-declarations': require('./lib/rules/new-line-between-declarations')
'new-line-between-declarations': require('./lib/rules/new-line-between-declarations'),
'new-line-before-expect': require('./lib/rules/new-line-before-expect')
},

@@ -37,3 +38,4 @@ configs: {

'jasmine/no-expect-in-setup-teardown': 1,
'jasmine/new-line-between-declarations': 1
'jasmine/new-line-between-declarations': 1,
'jasmine/new-line-before-expect': 1
}

@@ -40,0 +42,0 @@ }

@@ -8,2 +8,6 @@ 'use strict'

var hasPaddingBetweenTokens = require('../helpers/hasPaddingBetweenTokens')
var suiteRegexp = /^(f|x)?describe$/
module.exports = function (context) {

@@ -13,3 +17,3 @@ return {

var pass = true
if (node.callee.name === 'describe') {
if (suiteRegexp.test(node.callee.name)) {
var declarations = getDescribeDeclarationsContent(node)

@@ -19,3 +23,3 @@ pass = declarations.every((token, i) => {

if (next) {
return isPaddingBetweenTokens(token, next)
return hasPaddingBetweenTokens(token, next)
} else {

@@ -43,3 +47,3 @@ return true

function getDescribeDeclarationsContent (describe) {
var declartionsRegexp = /^((before|after)(Each|All))|it|describe$/
var declartionsRegexp = /^(((before|after)(Each|All))|^(f|x)?(it|describe))$/
var declarations = []

@@ -56,11 +60,1 @@ if (describe.arguments && describe.arguments[1] && describe.arguments[1].body.body) {

}
/**
* Checks if there is padding between two tokens
* @param {Token} first The first token
* @param {Token} second The second token
* @returns {boolean} True if there is at least a line between the tokens
*/
function isPaddingBetweenTokens (first, second) {
return second.loc.start.line - first.loc.end.line >= 2
}

@@ -54,3 +54,3 @@ {

},
"version": "2.5.0"
"version": "2.6.0"
}

@@ -83,2 +83,3 @@ # eslint-plugin-jasmine

[new-line-between-declarations][] | 1 |
[new-line-before-expect][] | 1 |

@@ -121,2 +122,3 @@

[new-line-between-declarations]: docs/rules/new-line-between-declarations.md
[new-line-before-expect]: docs/rules/new-line-before-expect.md

@@ -123,0 +125,0 @@ [configuring rules]: http://eslint.org/docs/user-guide/configuring#configuring-rules

@@ -13,5 +13,5 @@ 'use strict'

'describe("", function() {',
'it("", function(){});',
'',
'it("", function(){});',
' it("", function(){});',
' ',
' it("", function(){});',
'});'

@@ -21,6 +21,6 @@ ]),

'describe("", function() {',
'var a=1;',
'beforeEach(function(){});',
'',
'it("", function(){});',
' var a = 1',
' beforeEach(function(){});',
' ',
' it("", function(){});',
'});'

@@ -30,3 +30,3 @@ ]),

'describe("", function() {',
'expect(1).toBe(1);',
' expect(1).toBe(1);',
'});'

@@ -36,7 +36,7 @@ ]),

'describe("", function() {',
'describe("", function(){',
'it("", function(){});',
'});',
'',
'it("", function(){});',
' describe("", function(){',
' it("", function(){});',
' });',
' ',
' it("", function(){});',
'});'

@@ -49,7 +49,7 @@ ])

'describe("", function() {',
'describe("", function(){',
'it("", function(){});',
'});',
'it("", function(){});',
'it("", function(){});',
' describe("", function() {',
' it("", function(){});',
' });',
' it("", function(){});',
' it("", function(){});',
'});'

@@ -66,4 +66,4 @@ ]),

'describe("", function() {',
'beforeEach(function(){});',
'it("", function(){});',
' beforeEach(function(){});',
' it("", function(){});',
'});'

@@ -80,4 +80,4 @@ ]),

'describe("", function() {',
'describe("", function() {})',
'describe("", function() {})',
' describe("", function() {})',
' describe("", function() {})',
'})'

@@ -84,0 +84,0 @@ ]),

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc