eslint-plugin-jasmine
Advanced tools
Comparing version 1.0.0 to 1.1.0
@@ -6,2 +6,5 @@ # Contributing | ||
* Add a unit test for new/changed rules | ||
* Format Git commit messages according to [AngularJS conventions][cc] | ||
* When creating a new rule, please add it to [index.js][], document it (see | ||
[docs][]) and update the [configuration table][] | ||
@@ -11,1 +14,6 @@ If in doubt, file an issue first. | ||
Thanks! | ||
[cc]: https://github.com/ajoslin/conventional-changelog/blob/master/conventions/angular.md | ||
[docs]: docs/rules | ||
[index.js]: index.js | ||
[configuration table]: README.md#configuration |
@@ -6,8 +6,10 @@ 'use strict'; | ||
'no-focused-tests': require('./lib/rules/no-focused-tests'), | ||
'no-disabled-tests': require('./lib/rules/no-disabled-tests') | ||
'no-disabled-tests': require('./lib/rules/no-disabled-tests'), | ||
'no-suite-dupes': require('./lib/rules/no-suite-dupes') | ||
}, | ||
rulesConfig: { | ||
'no-focused-tests': 2, | ||
'no-disabled-tests': 1 | ||
'no-disabled-tests': 1, | ||
'no-suite-dupes': 1 | ||
} | ||
}; |
'use strict'; | ||
module.exports = function(prohibiteds, context) { | ||
function matchProhibited(name) { | ||
var regex = new RegExp('^(' + prohibiteds.join('|') + ')$'); | ||
return name.match(regex); | ||
} | ||
var regex = new RegExp('^(' + prohibiteds.join('|') + ')$'); | ||
function report(context, node, result) { | ||
context.report(node, 'Unexpected {{name}}.', { | ||
name: result[1] | ||
}); | ||
} | ||
return { | ||
'Identifier': function(node) { | ||
var result = matchProhibited(node.name); | ||
var result = node.name.match(regex); | ||
if (result) { | ||
report(context, node, result); | ||
context.report(node, 'Unexpected {{name}}.', { | ||
name: result[1] | ||
}); | ||
} | ||
@@ -21,0 +15,0 @@ } |
{ | ||
"name": "eslint-plugin-jasmine", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "ESLint rules for Jasmine", | ||
@@ -14,4 +14,7 @@ "main": "index.js", | ||
"scripts": { | ||
"pretest": "eslint index.js lib test", | ||
"test": "mocha", | ||
"watch": "mocha --watch" | ||
"watch": "mocha --watch", | ||
"prepublish": "semantic-release pre", | ||
"postpublish": "semantic-release post" | ||
}, | ||
@@ -35,6 +38,8 @@ "keywords": [ | ||
"devDependencies": { | ||
"eslint": "^0.12.0", | ||
"eslint-tester": "^0.5.0", | ||
"mocha": "^2.1.0" | ||
"eslint": "^0.24.1", | ||
"eslint-config-tlvince": "^1.2.0", | ||
"eslint-tester": "^0.8.2", | ||
"mocha": "^2.2.5", | ||
"semantic-release": "^3.3.2" | ||
} | ||
} |
@@ -33,2 +33,3 @@ # eslint-plugin-jasmine | ||
[no-disabled-tests][] | 1 | ||
[no-suite-dupes][] | 1 | ||
@@ -52,3 +53,4 @@ For example, the `no-focused-tests` rule is enabled by default and will cause | ||
[no-disabled-tests]: docs/rules/no-disabled-tests.md | ||
[configuring rules]: http://eslint.org/docs/configuring/ | ||
[no-suite-dupes]: docs/rules/no-suite-dupes.md | ||
[configuring rules]: http://eslint.org/docs/configuring/#configuring-rules | ||
@@ -55,0 +57,0 @@ ## Author |
@@ -7,2 +7,3 @@ 'use strict'; | ||
var eslintTester = new ESLintTester(linter); | ||
eslintTester.addRuleTest('lib/rules/no-disabled-tests', { | ||
@@ -17,15 +18,19 @@ valid: [ | ||
code: 'xdescribe("My disabled suite", function() {});', | ||
errors: [{ | ||
message: 'Unexpected xdescribe.', | ||
type: 'Identifier' | ||
}] | ||
errors: [ | ||
{ | ||
message: 'Unexpected xdescribe.', | ||
type: 'Identifier' | ||
} | ||
] | ||
}, | ||
{ | ||
code: 'xit("My disabled spec", function() {});', | ||
errors: [{ | ||
message: 'Unexpected xit.', | ||
type: 'Identifier' | ||
}] | ||
errors: [ | ||
{ | ||
message: 'Unexpected xit.', | ||
type: 'Identifier' | ||
} | ||
] | ||
} | ||
] | ||
}); |
@@ -7,2 +7,3 @@ 'use strict'; | ||
var eslintTester = new ESLintTester(linter); | ||
eslintTester.addRuleTest('lib/rules/no-focused-tests', { | ||
@@ -17,29 +18,37 @@ valid: [ | ||
code: 'ddescribe("My exclusive suite", function() {});', | ||
errors: [{ | ||
message: 'Unexpected ddescribe.', | ||
type: 'Identifier' | ||
}] | ||
errors: [ | ||
{ | ||
message: 'Unexpected ddescribe.', | ||
type: 'Identifier' | ||
} | ||
] | ||
}, | ||
{ | ||
code: 'iit("My exclusive test", function() {});', | ||
errors: [{ | ||
message: 'Unexpected iit.', | ||
type: 'Identifier' | ||
}] | ||
errors: [ | ||
{ | ||
message: 'Unexpected iit.', | ||
type: 'Identifier' | ||
} | ||
] | ||
}, | ||
{ | ||
code: 'fdescribe("My focused suite", function() {});', | ||
errors: [{ | ||
message: 'Unexpected fdescribe.', | ||
type: 'Identifier' | ||
}] | ||
errors: [ | ||
{ | ||
message: 'Unexpected fdescribe.', | ||
type: 'Identifier' | ||
} | ||
] | ||
}, | ||
{ | ||
code: 'fit("My focused spec", function() {});', | ||
errors: [{ | ||
message: 'Unexpected fit.', | ||
type: 'Identifier' | ||
}] | ||
errors: [ | ||
{ | ||
message: 'Unexpected fit.', | ||
type: 'Identifier' | ||
} | ||
] | ||
} | ||
] | ||
}); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
21
177
62
10928
5