linter-stylelint icon indicating copy to clipboard operation
linter-stylelint copied to clipboard

Restore embedded linting when a Stylelint Processor exists for it

Open Arcanemagus opened this issue 8 years ago • 21 comments

Embedded scope linting was removed in https://github.com/AtomLinter/linter-stylelint/commit/c9da67a6fa19c9961ff8ee32feb7bc938342de27 as part of the update to Stylelint v7, since it no longer exists in the core. This issue is to track restoring this functionality when somebody has written a Processor implementing it.

Arcanemagus avatar Jul 14 '16 18:07 Arcanemagus

https://github.com/ccbikai/stylelint-processor-html

ccbikai avatar Aug 04 '16 04:08 ccbikai

Might as well implement Markdown (and any other relevant ones) as well: https://github.com/stylelint/stylelint/blob/master/docs/developer-guide/processors.md

Arcanemagus avatar Sep 26 '16 19:09 Arcanemagus

+1

klebba avatar Oct 07 '16 22:10 klebba

We just released a processor to lint the CSS in styled components! 🎉

https://github.com/styled-components/stylelint-processor-styled-components

Is there a way we can add support for this in linter-stylelint? It's in my .stylelintrc, so I figured you'd pick it up automatically but of course you don't react to .js files. Can we maybe add a generic "Try linting files with these extensions" option to linter-stylelint?

mxstbr avatar Oct 24 '16 07:10 mxstbr

@mxstbr Unfortunately it's not quite that simple, as we only want to attempt linting if there is a processor available for the type. Reverting the removals from the commit referenced above is the starting place, I just haven't had time to implement it yet.

Arcanemagus avatar Oct 24 '16 18:10 Arcanemagus

@Arcanemagus language-babel support highlight styled-components by add a new scope named source.css.styled. To resolve @mxstbr question. Just add source.css.styled in baseScopes at lib/index.js#L27. That's simple.

cncolder avatar Dec 27 '16 16:12 cncolder

@cncolder All that would do is start running this package on those sections of the code, the functionality to make stylelint actually understand the file as a whole still needs to be restored.

Arcanemagus avatar Dec 27 '16 21:12 Arcanemagus

+1

jbreuer95 avatar Feb 14 '17 14:02 jbreuer95

+1 for https://github.com/ccbikai/stylelint-processor-html

mattixittam avatar Apr 05 '17 13:04 mattixittam

What's the status on this one? Is there any way to get linting to appear in Atom?

funwithtriangles avatar May 27 '17 23:05 funwithtriangles

the stylelint-processor-html does not trigger in html or vue file, and style lint can not work in Atom. can you make the file extensions to be configurable, just like https://github.com/AtomLinter/linter-stylelint/issues/306 said?

czonechan avatar Jun 06 '17 06:06 czonechan

Since the user is responsible for configuring both the settings for .stylelintrc and the settings for linter-stylelint, isn't the onus on her to make sure that if she tells the linter to apply itself to a scope she also configures stylelint to understand it? It's possible that I'm misunderstanding something about the linter's inner workings, but from what I've read it doesn't look as though there's any need to be more robust or defensive about it than that.

phyllisstein avatar Jun 20 '17 04:06 phyllisstein

@phyllisstein Until https://github.com/AtomLinter/linter-stylelint/issues/51 is fixed, every supported plugin will need to be installed here in this package as currently it only uses the embedded stylelint instance. It's not just a matter of configuring stylelint to work with it in the project right now.

Arcanemagus avatar Jul 10 '17 17:07 Arcanemagus

@Arcanemagus hey, are you planning to address this issue? Otherwise, could you describe what do want to be done here, so the community will be able to help?

ezhlobo avatar Nov 24 '17 06:11 ezhlobo

This package is useless for me until I can lint .vue files within Atom

boboldehampsink avatar Mar 09 '18 10:03 boboldehampsink

Having support for .vue files would be awesome. Meanwhile I use lint-sass-vue.

juni0r avatar Mar 20 '18 12:03 juni0r

@Arcanemagus or anyone else, can you explain what's needed to make this happen? I'm happy to take this on, but am looking for a bit of direction since I'm brand new to this codebase!

edahlseng avatar Apr 11 '18 00:04 edahlseng

@Arcanemagus I think now that #381 is merged, this can be supported by adding these scopes to the baseScopes array:

source.css.embedded.html
source.scss.embedded.html
source.css.scss.embedded.html
source.less.embedded.html
source.css.less.embedded.html
source.css.postcss.embedded.html
source.css.postcss.sugarss.embedded.html

emuvente avatar Apr 30 '18 06:04 emuvente

@emuvente would styled-components in .js files also be supported by adding other scopes?

edahlseng avatar May 10 '18 18:05 edahlseng

@edahlseng Yes, it looks like styled components could possibly be supported by adding the source.inside-js.css.styled scope. #322 appears to be trying to solve that.

I think one way this could be solved is to have the default scopes and a couple configuration options to add on additional scopes if wanted. The configuration options could be:

  • A checkbox for 'Enable checking embedded styles' that would add the .embedded.html scopes.
  • A checkbox for 'Enable checking styled-components' that would add the source.inside-js.css.styled scope.
  • A text input for 'Additional scopes to check' where the user could enter any additional grammar scopes that they wanted the plugin to run in, similar to how linter-eslint handles this problem.

@Arcanemagus thoughts?

emuvente avatar May 14 '18 18:05 emuvente

@emuvente that sounds great to me, so long as the TypeScript users among us get that "Additional Scopes" input. 😬

phyllisstein avatar May 18 '18 05:05 phyllisstein