Closed aminland closed 4 years ago
Also fixes #630 and #619
Until such time as you start accepting pull requests again, this code (with many more changes) will live at https://github.com/aminland/coffeelint2
named coffeelint2 for coffeescript 2 support. (also works nicely with eslint via my eslint-plugin-coffee)
Hi. Thanks for the PR
There seems to be 3 separate requests in this one PR.
a
but have some "parseCSX" property in the class of the rules that signifies whether the rules want to parse CSX or not.I haven't implemented anything because I haven't spent much time with CSX/CS2. I think if someone started a discussion and had a good way to implement it, I would merge it. But I think handling it for each individual rule sounds like a nightmare.
Also it looks like you deleted some tests and some code that don't seem clear to me why you're deleting them. The tests added should also provide enough coverage where I feel confident that the implementation is sound. I'm not saying I need 100 tests, but the tests should appear to have coverage for the general cases.
Hi,
I've added more items since you last looked. In an effort to make this easier I rebased the hell out of my commits so that they're each somewhat self-contained in what they do.
In terms of the issues you raised:
1) the config extend commit is so that one can, let's say, in package.json coffeeLintConfig
, extend a relative path (e.g. "extends": "../coffeeLintConfig/index"
). Without this commit you can only extend things that are installed in node_modules (thus preventing you from dynamically generating a config locally).
2) Surprisingly, you don't need to do all that to get CJSX files to work correctly. The reason is simple: since we're using the CoffeeScript lexer, and that lexer supports CJSX via a hack of sorts, there's not much required to support it. At least in terms of the default rule configs, these basic changes are sufficient. If you find other situations where CJSX tags break other rules, I'll be glad to fix those as well.
What this PR doesn't do is enable new rules to be written that specifically apply only in a CJSX context.
3) That last commit adds column numbers to the context for all errors (and for lexical lint rules, end positions as well). This is done so that when using an editor you can get proper highlighting.
-- The way I see it, coffeelint is mostly for syntax validation, and coffee-style preference checking. All of these changes were basically done with the aim of not running coffeelint directly, but rather, just using eslint. Eslint is much more powerful, and can do all sorts of extra things. With these changes in place, I was able to make eslint-plugin-coffee which enables full compatibility of eslint with coffee (and allowing direct checking / configuration of coffeelint style rules).
If you really want me to split to multiple PRs I can, but i don't see a need as I don't think i've done anything controversial...
What's the status here, can this be merged - or should separate PRs be submitted - or something else?
I need jsx support on my project so would be nice to have this on the main repo instead of having to use a different package.
bump.
This will be added to @coffeelint/cli in https://github.com/coffeelint/coffeelint/pull/8. Thanks!
Fixes colon and comma spacing issues from CSX (JSX) format described in #629