Skip to content
This repository has been archived by the owner on Oct 19, 2021. It is now read-only.

Commit

Permalink
upgrade to Coffee 2.1.1 (^2.0.0) and add tests for the CSX fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
aminland committed Jan 17, 2018
1 parent d02c815 commit 7e80ca0
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"dependencies": {
"browserify": "^13.1.0",
"coffeeify": "~1.0.0",
"coffeescript": "~2.0.x",
"coffeescript": "^2.1.1",
"glob": "^7.0.6",
"ignore": "^3.0.9",
"optimist": "^0.6.1",
Expand Down
26 changes: 21 additions & 5 deletions test/test_colon_assignment_spacing.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -98,15 +98,15 @@ vows.describe(RULE).addBatch({
errors = coffeelint.lint(source, config)
assert.isEmpty(errors)

'Should not complain about strings':
'Should not complain about CSX syntax':
topic:
'''
foo = (stuff) ->
throw new Error("Error: stuff required") unless stuff?
# do real work
<Wrapper prop1="" flag1>
<Element prop2={myVal} />
</Wrapper>
'''

'will return an error': (source) ->
'will not return an error': (source) ->
config =
colon_assignment_spacing:
level: 'error'
Expand All @@ -116,4 +116,20 @@ vows.describe(RULE).addBatch({
errors = coffeelint.lint(source, config)
assert.isEmpty(errors)

'Inside CSX interpolation':
topic:
'''
<Element prop={{key:somefunc k:v}} />
'''

'will return an error': (source) ->
config =
colon_assignment_spacing:
level: 'error'
spacing:
left: 1
right: 1
errors = coffeelint.lint(source, config)
assert.lengthOf(errors, 2)

}).export(module)
30 changes: 30 additions & 0 deletions test/test_spacing_after_comma.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,34 @@ vows.describe(RULE).addBatch({
errors = coffeelint.lint(source, config)
assert.equal(errors.length, 0)

'Should not complain about CSX syntax':
topic:
'''
render = -> <Wrapper prop1="" flag1>
<Element prop2={myVal} />
</Wrapper>
'''

'will not return an error': (source) ->
config =
spacing_after_comma:
level: 'error'
errors = coffeelint.lint(source, config)
assert.isEmpty(errors)

'Inside CSX interpolation':
topic:
'''
render = -> <Element prop={{k1:1,k2:v}}>{
Object.keys {a,b,c, }
}</Element>
'''

'will return an error': (source) ->
config =
spacing_after_comma:
level: 'error'
errors = coffeelint.lint(source, config)
assert.lengthOf(errors, 3)

}).export(module)

0 comments on commit 7e80ca0

Please sign in to comment.