-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
162 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/** | ||
* @fileoverview Translation for `disallowSpacesInGenerator` (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: 'generator-star-spacing', | ||
truthy: function(__current__, value) { | ||
var obj = __current__ ? __current__[1] : {} | ||
|
||
if (value.beforeStar) { | ||
obj.before = false | ||
} | ||
|
||
if (value.afterStar) { | ||
obj.after = false | ||
} | ||
|
||
return [2, obj] | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/** | ||
* @fileoverview Translation for `requireSpacesInGenerator` (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: 'generator-star-spacing', | ||
truthy: function(__current__, value) { | ||
var obj = __current__ ? __current__[1] : {} | ||
|
||
if (value.beforeStar) { | ||
obj.before = true | ||
} | ||
|
||
if (value.afterStar) { | ||
obj.after = true | ||
} | ||
|
||
return [2, obj] | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/** | ||
* @fileoverview Tests for `disallowSpacesInGenerator` (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/disallowSpacesInGenerator.js') | ||
|
||
var getFn = caller(lib) | ||
|
||
describe('jscs#disallowSpacesInGenerator', function() { | ||
it('converts the rule correctly', function() { | ||
var fn = getFn() | ||
var fnBound = getFn([2, { | ||
before: true | ||
}]) | ||
|
||
expect(fn({ | ||
beforeStar: false, | ||
afterStar: true | ||
})).to.eql([2, { | ||
after: false | ||
}]) | ||
|
||
expect(fnBound({ | ||
beforeStar: true, | ||
afterStar: true | ||
})).to.eql([2, { | ||
after: false, | ||
before: false | ||
}]) | ||
|
||
expect(fn({ | ||
beforeStar: true, | ||
afterStar: false | ||
})).to.eql([2, { | ||
before: false | ||
}]) | ||
|
||
expect(fn({ | ||
beforeStar: false, | ||
afterStar: false | ||
})).to.eql([2, {}]) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/** | ||
* @fileoverview Tests for `requireSpacesInGenerator` (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/requireSpacesInGenerator.js') | ||
|
||
var getFn = caller(lib) | ||
|
||
describe('jscs#requireSpacesInGenerator', function() { | ||
it('converts the rule correctly', function() { | ||
var fn = getFn() | ||
var fnBound = getFn([2, { | ||
before: true | ||
}]) | ||
|
||
expect(fn({ | ||
beforeStar: false, | ||
afterStar: true | ||
})).to.eql([2, { | ||
after: true | ||
}]) | ||
|
||
expect(fnBound({ | ||
beforeStar: false, | ||
afterStar: true | ||
})).to.eql([2, { | ||
after: true, | ||
before: true | ||
}]) | ||
|
||
expect(fn({ | ||
beforeStar: true, | ||
afterStar: false | ||
})).to.eql([2, { | ||
before: true | ||
}]) | ||
|
||
expect(fn({ | ||
beforeStar: false, | ||
afterStar: false | ||
})).to.eql([2, {}]) | ||
}) | ||
}) |