Skip to content

Commit

Permalink
Merge pull request #25 from 2fast2fourier/eslint-1-1-compat
Browse files Browse the repository at this point in the history
ESLint 1.x compatibility
  • Loading branch information
lo1tuma committed Aug 11, 2015
2 parents 11d8578 + 04b87ec commit 7b36ee7
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 46 deletions.
18 changes: 5 additions & 13 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"no-dupe-args": 2,
"no-else-return": 2,
"no-empty": 2,
"no-empty-class": 2,
"no-empty-character-class": 2,
"no-empty-label": 2,
"no-eq-null": 2,
"no-eval": 2,
Expand Down Expand Up @@ -71,7 +71,6 @@
"no-proto": 2,
"no-redeclare": 2,
"no-regex-spaces": 2,
"no-reserved-keys": 2,
"no-restricted-modules": 0,
"no-return-assign": 2,
"no-script-url": 2,
Expand All @@ -96,7 +95,6 @@
"no-void": 2,
"no-warning-comments": [ 2, { "terms": [ "todo", "fixme", "wtf", "falls through" ], "location": "anywhere" } ],
"no-with": 2,
"no-wrap-func": 2,
"block-scoped-var": 0,
"brace-style": [ 2, "1tbs" ],
"camelcase": 2,
Expand Down Expand Up @@ -136,20 +134,14 @@
"sort-vars": 0,
"space-after-keywords": [ 2, "always" ],
"space-before-blocks": [ 2, "always" ],
"space-before-function-parentheses": [ 2, { "anonymous": "always", "named": "never" } ],
"space-in-brackets": [ 2, "always", {
"singleValue": true,
"objectsInArrays": true,
"arraysInArrays": true,
"arraysInObjects": true,
"objectsInObjects": true,
"propertyName": false
} ],
"space-before-function-paren": [ 2, { "anonymous": "always", "named": "never" } ],
"object-curly-spacing": [ 2, "always" ],
"array-bracket-spacing": [ 2, "always" ],
"space-in-parens": [ 2, "never" ],
"space-infix-ops": 2,
"space-return-throw-case": 2,
"space-unary-ops": 2,
"spaced-line-comment": [ 2, "always" ],
"spaced-comment": [ 2, "always" ],
"strict": [2, "global"],
"use-isnan": 2,
"valid-jsdoc": 0,
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@
"pr-log": "1.3.0",
"istanbul": "0.3.17",
"mocha": "2.2.5",
"eslint-tester": "0.8.2",
"eslint": "0.24.0",
"eslint": "1.1.0",
"coveralls": "2.11.2"
},
"peerDependencies": {
Expand Down
33 changes: 17 additions & 16 deletions test/rules/handle-done-callback.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
'use strict';

var linter = require('eslint').linter,
ESLintTester = require('eslint-tester'),
eslintTester = new ESLintTester(linter);
var RuleTester = require('eslint').RuleTester;
var rule = require('../../lib/rules/handle-done-callback');

eslintTester.addRuleTest('lib/rules/handle-done-callback', {
var ruleTester = new RuleTester();

ruleTester.run('handle-done-callback', rule, {
valid: [
'foo(function (done) { });',
'var foo = function (done) { };',
Expand Down Expand Up @@ -37,52 +38,52 @@ eslintTester.addRuleTest('lib/rules/handle-done-callback', {
invalid: [
{
code: 'it("", function (done) { });',
errors: [ { message: 'Expected "done" callback to be handled.', column: 17, line: 1 } ]
errors: [ { message: 'Expected "done" callback to be handled.', column: 18, line: 1 } ]
},
{
code: 'it("", function (done) { callback(); });',
errors: [ { message: 'Expected "done" callback to be handled.', column: 17, line: 1 } ]
errors: [ { message: 'Expected "done" callback to be handled.', column: 18, line: 1 } ]
},
{
code: 'it("", function (callback) { });',
errors: [ { message: 'Expected "callback" callback to be handled.', column: 17, line: 1 } ]
errors: [ { message: 'Expected "callback" callback to be handled.', column: 18, line: 1 } ]
},
{
code: 'it("", function (done) { asyncFunction(function (error) { expect(error).to.be.null; }); });',
errors: [ { message: 'Expected "done" callback to be handled.', column: 17, line: 1 } ]
errors: [ { message: 'Expected "done" callback to be handled.', column: 18, line: 1 } ]
},
{
code: 'it.only("", function (done) { });',
errors: [ { message: 'Expected "done" callback to be handled.', column: 22, line: 1 } ]
errors: [ { message: 'Expected "done" callback to be handled.', column: 23, line: 1 } ]
},
{
code: 'test("", function (done) { });',
errors: [ { message: 'Expected "done" callback to be handled.', column: 19, line: 1 } ]
errors: [ { message: 'Expected "done" callback to be handled.', column: 20, line: 1 } ]
},
{
code: 'test.only("", function (done) { });',
errors: [ { message: 'Expected "done" callback to be handled.', column: 24, line: 1 } ]
errors: [ { message: 'Expected "done" callback to be handled.', column: 25, line: 1 } ]
},
{
code: 'before(function (done) { });',
errors: [ { message: 'Expected "done" callback to be handled.', column: 17, line: 1 } ]
errors: [ { message: 'Expected "done" callback to be handled.', column: 18, line: 1 } ]
},
{
code: 'after(function (done) { });',
errors: [ { message: 'Expected "done" callback to be handled.', column: 16, line: 1 } ]
errors: [ { message: 'Expected "done" callback to be handled.', column: 17, line: 1 } ]
},
{
code: 'beforeEach(function (done) { });',
errors: [ { message: 'Expected "done" callback to be handled.', column: 21, line: 1 } ]
errors: [ { message: 'Expected "done" callback to be handled.', column: 22, line: 1 } ]
},
{
code: 'afterEach(function (done) { });',
errors: [ { message: 'Expected "done" callback to be handled.', column: 20, line: 1 } ]
errors: [ { message: 'Expected "done" callback to be handled.', column: 21, line: 1 } ]
},
{
code: 'it("", (done) => { });',
ecmaFeatures: { arrowFunctions: true },
errors: [ { message: 'Expected "done" callback to be handled.', column: 8, line: 1 } ]
errors: [ { message: 'Expected "done" callback to be handled.', column: 9, line: 1 } ]
}
]
});
32 changes: 17 additions & 15 deletions test/rules/no-exclusive-tests.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
'use strict';

var linter = require('eslint').linter,
ESLintTester = require('eslint-tester'),
eslintTester = new ESLintTester(linter),
expectedErrorMessage = 'Unexpected exclusive mocha test.';
var RuleTester = require('eslint').RuleTester;
var rule = require('../../lib/rules/no-exclusive-tests');

eslintTester.addRuleTest('lib/rules/no-exclusive-tests', {
var ruleTester = new RuleTester();

var expectedErrorMessage = 'Unexpected exclusive mocha test.';

ruleTester.run('no-exclusive-tests', rule, {

valid: [
'describe()',
Expand All @@ -26,43 +28,43 @@ eslintTester.addRuleTest('lib/rules/no-exclusive-tests', {
invalid: [
{
code: 'describe.only()',
errors: [ { message: expectedErrorMessage, column: 9, line: 1 } ]
errors: [ { message: expectedErrorMessage, column: 10, line: 1 } ]
},
{
code: 'describe["only"]()',
errors: [ { message: expectedErrorMessage, column: 9, line: 1 } ]
errors: [ { message: expectedErrorMessage, column: 10, line: 1 } ]
},
{
code: 'it.only()',
errors: [ { message: expectedErrorMessage, column: 3, line: 1 } ]
errors: [ { message: expectedErrorMessage, column: 4, line: 1 } ]
},
{
code: 'it["only"]()',
errors: [ { message: expectedErrorMessage, column: 3, line: 1 } ]
errors: [ { message: expectedErrorMessage, column: 4, line: 1 } ]
},
{
code: 'suite.only()',
errors: [ { message: expectedErrorMessage, column: 6, line: 1 } ]
errors: [ { message: expectedErrorMessage, column: 7, line: 1 } ]
},
{
code: 'suite["only"]()',
errors: [ { message: expectedErrorMessage, column: 6, line: 1 } ]
errors: [ { message: expectedErrorMessage, column: 7, line: 1 } ]
},
{
code: 'test.only()',
errors: [ { message: expectedErrorMessage, column: 5, line: 1 } ]
errors: [ { message: expectedErrorMessage, column: 6, line: 1 } ]
},
{
code: 'test["only"]()',
errors: [ { message: expectedErrorMessage, column: 5, line: 1 } ]
errors: [ { message: expectedErrorMessage, column: 6, line: 1 } ]
},
{
code: 'context.only()',
errors: [ { message: expectedErrorMessage, column: 8, line: 1 } ]
errors: [ { message: expectedErrorMessage, column: 9, line: 1 } ]
},
{
code: 'context["only"]()',
errors: [ { message: expectedErrorMessage, column: 8, line: 1 } ]
errors: [ { message: expectedErrorMessage, column: 9, line: 1 } ]
}
]

Expand Down

0 comments on commit 7b36ee7

Please sign in to comment.