AtomLinter / linter-stylelint

A plugin for Atom Linter providing an interface to stylelint.
https://atom.io/packages/linter-stylelint
115 stars 37 forks source link

Parsing .sss files for lint #204

Closed morajabi closed 8 years ago

morajabi commented 8 years ago

It seems it doesn't support SugarSS at all. I moved from CSS Lint to this just because of that!

plz fix that ASAP.

Arcanemagus commented 8 years ago

Wow, in the future you might want to change your tone. This is an open source project being maintained by volunteers, not some product you've paid money for and are guaranteed support.

SugarSS files should be being recognized as PostCSS files, at least according to the only language file for Atom for it that I see. What are you seeing when you run Editor: Log Cursor Scope from the command palette?

jeddy3 commented 8 years ago

SugarSS files should be being recognized as PostCSS files

I think that might be the cause. As .sss files (like .less and .scss ones) require the syntax option to be set. For SugarSS syntax, the option is "sugarss".

One caveat with SugarSS syntax is that it's not entirely compatible with stylelint-config-standard. This might complicate the tests a little.

at least according to the only language file for Atom for it that I see

I'm not familiar with atom plugins, although I'm curious and eager to learn a bit more about them. Is there a central repo of language files somewhere? And do those file map extensions to "scopes", or am I'm way-off?

P.S. Thanks for the quick release of the 6.6-compatible version btw :)

Arcanemagus commented 8 years ago

I'm not familiar with atom plugins, although I'm curious and eager to learn a bit more about them. Is there a central repo of language files somewhere?

Atom's package list can be searched here, there is nothing specific for languages, other than searching for language 😛.

And do those file map extensions to "scopes", or am I'm way-off?

A package can define a language, which at it's simplest is just a list of file extensions, but can be parts of a file embedded within another. It marks the file with a scope for the language, usually in the form of source.languagename, with embedded parts being source.embedded.languagename.

This used to be the one to use for SugarSS support, and defined .sss files as source.css.sugarss. They deprecated their package in favor of this one though, which specifies SugarSS as source.postcss.

It seems like autocomplete providers are also having issues with this from this issue, maybe we can get some more visibility on the issue and get it fixed.

The linter system in Atom is based on the scope of the current cursor, since that's the surest way of knowing what linters could know how to understand the current code. In this case since the scope is telling us that the file is PostCSS, that's how linter-stylelint is setting itself up for.

Arcanemagus commented 8 years ago

Put a PR up on that language that should let us fix things here once it gets released.

jeddy3 commented 8 years ago

Thanks kindly for the all the detailed information! Very informative.

I think I understand a little better the internal workings now.

Put a PR up on that language that should let us fix things here once it gets released.

Excellent. Fingers crossed.

Thanks again for your continued work on this plugin... I suspect it's one of the more popular ways that people use stylelint!

Arcanemagus commented 8 years ago

@jeddy3 If you want more information on how that whole system works, it's mostly the TextMate grammar system, unfortunately Atom hasn't really documented the details yet so some of how it works is just guesswork.

jeddy3 commented 8 years ago

Very interesting.

jescalan commented 8 years ago

Hi there! So I'm trying to use this linter with a .sss file right now, but it's not activating. When I did the cursor source thing, it said source.postcss, which I assume means it should be working.

Is there any way I can do any further debugging here that might be helpful?

Arcanemagus commented 8 years ago

Actually @jescalan stylint requires special configuration to work properly with SugarSS, and until @azat-io merges https://github.com/azat-io/atom-language-postcss/pull/15, or does a similar fix, that is impossible to do here.

azat-io commented 8 years ago

@Arcanemagus Done!

Arcanemagus commented 8 years ago

Cool, I'll get proper support added here then!

Arcanemagus commented 8 years ago

Just a note for anyone following this, looks like there are still some rough edges around the SugarSS support in stylelint, I found https://github.com/stylelint/stylelint/issues/1544 while writing up the support in here.

Arcanemagus commented 8 years ago

Released in v2.15.0! 🎉

jescalan commented 8 years ago

@Arcanemagus tested and working for me -- thanks!

jeddy3 commented 8 years ago

I found stylelint/stylelint#1544 while writing up the support in here.

FYI, fixed in stylelint@6.8.0.