clutchski / coffeelint

Lint your CoffeeScript.
http://www.coffeelint.org
Other
1.17k stars 172 forks source link

Suport JSX (react) notation #629

Open aurium opened 6 years ago

aurium commented 6 years ago

The coffeelint's doc points to use coffee-react-transform, however it miss features and is deprecated. And, as the coffeelint's doc says, transformers may mess with the original source format.

Supporting JSX, coffeelint could test indentation of nested tags, line spliced tags, and more...

aurium commented 6 years ago

Vows test:

    topic:
        '''
        <div className="test">
            {value}
        </div>
        '''

    'do not missunderstand JSX': (source) ->
        config = { spacing_after_comma: { level: 'error' } }
        errors = coffeelint.lint(source, config)
        console.log errors

Outputs:

[ { name: 'spacing_after_comma',
    level: 'error',
    message: 'a space is required after commas',
    description: 'This rule checks to make sure you have a space after commas.',
    lineNumber: 1,
    line: '<div className="test">',
    rule: 'spacing_after_comma' },
  { name: 'spacing_after_comma',
    level: 'error',
    message: 'a space is required after commas',
    description: 'This rule checks to make sure you have a space after commas.',
    lineNumber: 1,
    line: '<div className="test">',
    rule: 'spacing_after_comma' } ]

Why it matches spacing_after_comma in a JSX tag notation?