Skip to content

Commit

Permalink
Resolves #51
Browse files Browse the repository at this point in the history
  • Loading branch information
brenolf committed Apr 27, 2016
1 parent 15af54c commit 6e09505
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 0 deletions.
27 changes: 27 additions & 0 deletions lib/dictionaries/jscs/requireCapitalizedConstructorsNew.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/**
* @fileoverview Translation for `requireCapitalizedConstructorsNew` (JSCS) to ESLint
* @author Breno Lima de Freitas <https://breno.io>
* @copyright 2016 Breno Lima de Freitas. All rights reserved.
* See LICENSE file in root directory for full license.
*/

'use strict'

//------------------------------------------------------------------------------
// Rule Translation Definition
//------------------------------------------------------------------------------

module.exports = {
name: 'new-cap',
truthy: function(__current__, value) {
if (value !== true) {
return [2, {
capIsNewExceptions: value.allExcept
}]
}

return [2, {
capIsNewExceptions: []
}]
}
};
32 changes: 32 additions & 0 deletions test/dictionaries/jscs/requireCapitalizedConstructorsNew.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/**
* @fileoverview Tests for `requireCapitalizedConstructorsNew` (JSCS) translation
* @author Breno Lima de Freitas <https://breno.io>
* @copyright 2016 Breno Lima de Freitas. All rights reserved.
* See LICENSE file in root directory for full license.
*/

'use strict'

//------------------------------------------------------------------------------
// Requirements
//------------------------------------------------------------------------------

var lib = require('../../../lib/dictionaries/jscs/requireCapitalizedConstructorsNew.js')

var getFn = caller(lib)

describe('jscs#requireCapitalizedConstructorsNew', function() {
it('converts the rule correctly', function() {
var fn = getFn()

expect(fn(true)).to.eql([2, {
capIsNewExceptions: []
}])

expect(fn({
allExcept: ['A', 'B', 'C']
})).to.eql([2, {
capIsNewExceptions: ['A', 'B', 'C']
}])
})
})

0 comments on commit 6e09505

Please sign in to comment.