Skip to content

Does tailwind automatically use stylelinter? #322

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
terryupton opened this issue Dec 18, 2017 · 17 comments
Closed

Does tailwind automatically use stylelinter? #322

terryupton opened this issue Dec 18, 2017 · 17 comments

Comments

@terryupton
Copy link

terryupton commented Dec 18, 2017

Does tailwind automatically use stylelinter? I seem to have come across an issue in my gulp setup with postcss. Having done some debugging and tracking down it seems to be tailwind within my postcss processes causing the issue;

So here is my postcss process code;

        tailwindcss('tailwind.js'),
        autoprefixer({browsers:['last 2 versions', 'IE 9', 'Safari 8']}),
        csssort({
            "properties-order": "alphabetical",
        })
    ];

I have a work-in-progress .stylelintrtc file that contains a few comments and I wasn’t ready to use it, hence nothing else in gulp setup requests stylelint etc. but I am getting the following error, I believe becuase my .stylelintrtc file contains comments.

Sure I can remove these, but I wondered as to why it was even finding the file, when there is no mention to use it within my gulp config.

After trial and error

AMLException: end of the stream or a document separator is expected in "/Users/terryupton/Dropbox/Amasci/Websites/ZZZ_boilerplate-tailwind/boilerplate-tailwind.loc/.stylelintrc" at line 171, column 1:

I found by removing the tailwindcss('tailwind.js'), from the processes the error didn’t occur.

An easy fix as I can either remove the comments or rename the .stylelintrtc file until I am ready, but wanted understand as to why this is occurring? Anyone able to shed some light?

Thanks.

@adamwathan
Copy link
Member

Yeah we run stylefmt on everything by default because PostCSS generates some really annoyingly formatted code :/

This is probably a dumb idea, so I'm going to remove it and only run it against our CDN builds.

@terryupton
Copy link
Author

Thanks for confirming @adamwathan - if you do keep it in, then it might be just worth a mention in the docs. It's not necessarily a bad idea, perhaps the .stylelint config file could be part of the package so people can choose to use it as default or rollout their own? I'm not sure if there would be any conflicts with both being used, I am pretty new to using stylelint myself...

@m1guelpf
Copy link
Contributor

@adamwathan How about a config option to enable/disable stylelint?

@adamwathan
Copy link
Member

Easier to just add it yourself to your PostCSS plugin list IMO.

@terryupton
Copy link
Author

On a side note, i'd be interested to see what your stylelint config rules are...?

@adamwathan
Copy link
Member

Literally nothing, we just stick stylefmt onto the end of the plugin chain with whatever the defaults are 😄

@adamwathan
Copy link
Member

We're not actually trying to enforce any specific style, just clean up the absolutely horrid non-formatting you get out of the box :/

image

@terryupton
Copy link
Author

terryupton commented Dec 22, 2017

@adamwathan just a further point on this it seems like stylfmt is a little outdated and I am also seeing this issue -> stylelint/stylelint#3042 when using my own . stylelintrtc, which now I have set up.

@damiani
Copy link
Contributor

damiani commented Jan 11, 2018

FWIW, I'm getting warnings when building w/ Webpack and Laravel Mix...

Could not find "stylelint-config-recommended-scss". Do you need a `configBasedir`?

...which don't seem to be affecting compilation, and which I think are dealt with in a more recent version of stylelint than what stylefmt uses.

@adamwathan
Copy link
Member

I hacked on removing stylelint from Tailwind completely a while ago, in hopes that I could find some very simple formatter that could just be applied to our generated code as well as our CDN builds but I literally couldn't find anything that worked properly. Inserting new nodes into the tree with PostCSS results in incredibly unpredictable formatting which is super annoying, so I'd really like to be able to format this stuff somehow.

I would love a PR from someone that removes stylelint from our main PostCSS plugin list but still manages to format the generated utilities nicely, and also keeps the non-minified CDN builds nicely formatted!

@evenfrost
Copy link
Contributor

Got same Undefined rule font-family-no-missing-generic-family-keyword error and dead-ended here. As mentioned above, this is because stylefmt uses older version of stylelint which does not have this rule. But I still quite don't understand why it gets picked up.

@adamwathan
Copy link
Member

Again PRs welcome :) Don't have time to dive into this myself until at least next week.

@damiani
Copy link
Contributor

damiani commented Jan 19, 2018

I was just about to PR a change from stylefmt to perfectionist—which in my testing, worked very well—but then I saw that @reinink has a branch here ca2ad4c that does the same thing.

Any reason not to use that?

@damiani
Copy link
Contributor

damiani commented Jan 19, 2018

As far as I can tell, a PostCSS plugin for prettier doesn't exist? It was on a issue thread in postCSSs repo where I came across the recommendation to use perfectionist, since they didn't seem to want to support prettier. I could be wrong.

Plus, the branch with the perfectionist fix already exists :)

@adamwathan
Copy link
Member

@damiani I can't remember honestly where we got stuck there, if you're up for pulling that branch down and seeing where it's at, I'd gladly take a PR that finished it off.

@aparajita I tried Prettier as well but ran into issues, can't remember what they were unfortunately.

In a perfect world we would only run something like this during our build process for the dist builds, but when we generate new CSS with PostCSS the formatting is completely unpredictable and hard to control and looks just bad enough to drive me crazy, so I'd really like for Tailwind's generated code to also get formatted in a reasonable way so people aren't forced to use their own formatter to fix our crap.

@damiani
Copy link
Contributor

damiani commented Jan 19, 2018

Will do...In my testing, I just used the built-in {format: 'compact'} option and it yielded this, which seems like a reasonable result:

screen shot 2018-01-18 at 10 31 33 pm

or expanded:

screen shot 2018-01-18 at 10 32 42 pm

I'll check out the options that @reinink used in his branch, see if we can get the output to be close to what you have from stylefmt, and then post a PR this afternoon.

@adamwathan
Copy link
Member

Dropped our stylefmt dependency for Perfectionist and tagged v0.4.1 (thanks Keith!)

I'd still like to improve this eventually and have it only apply to code Tailwind actually generates instead of to your entire CSS tree, but this is still better than what we had, and if someone wants to enforce a different style it's of course easy to just drop their own prettifier onto the end of the chain.

adamwathan pushed a commit that referenced this issue Oct 30, 2024
Here is everything you need to know about this update. Please take a
good look at what changed and the test results before merging this pull
request.

### What changed?




#### ✳️ jiti (2.1.0 → 2.3.3) · [Repo](https://github.com/unjs/jiti) ·
[Changelog](https://github.com/unjs/jiti/blob/main/CHANGELOG.md)



<details>
<summary>Release Notes</summary>
<h4><a
href="https://github.com/unjs/jiti/releases/tag/v2.3.3">2.3.3</a></h4>

<blockquote><p dir="auto"><a
href="https://bounce.depfu.com/github.com/unjs/jiti/compare/v2.3.2...v2.3.3">compare
changes</a></p>
<h3 dir="auto">🩹 Fixes</h3>
<ul dir="auto">
<li>
<strong>eval:</strong> Return fallback value (<a
href="https://bounce.depfu.com/github.com/unjs/jiti/pull/326">#326</a>)</li>
</ul>
<h3 dir="auto">💅 Refactors</h3>
<ul dir="auto">
<li>Remove some unused exports with <a href="https://knip.dev/">Knip</a>
(<a
href="https://bounce.depfu.com/github.com/unjs/jiti/pull/327">#327</a>)</li>
</ul>
<h3 dir="auto">❤️ Contributors</h3>
<ul dir="auto">
<li>Lars Kappert (<a
href="https://bounce.depfu.com/github.com/webpro">@webpro</a>)</li>
</ul></blockquote>
<h4><a
href="https://github.com/unjs/jiti/releases/tag/v2.3.2">2.3.2</a></h4>

<blockquote><p dir="auto"><a
href="https://bounce.depfu.com/github.com/unjs/jiti/compare/v2.3.1...v2.3.2">compare
changes</a></p>
<h3 dir="auto">🩹 Fixes</h3>
<ul dir="auto">
<li>
<strong>eval:</strong> Fallback in async mode (<a
href="https://bounce.depfu.com/github.com/unjs/jiti/pull/325">#325</a>)</li>
</ul></blockquote>
<h4><a
href="https://github.com/unjs/jiti/releases/tag/v2.3.1">2.3.1</a></h4>

<blockquote><p dir="auto"><a
href="https://bounce.depfu.com/github.com/unjs/jiti/compare/v2.3.0...v2.3.1">compare
changes</a></p>
<h3 dir="auto">🩹 Fixes</h3>
<ul dir="auto">
<li>Conditional access to <code class="notranslate">mod.default</code>
(<a
href="https://bounce.depfu.com/github.com/unjs/jiti/commit/8c30a94">8c30a94</a>)</li>
</ul></blockquote>
<h4><a
href="https://github.com/unjs/jiti/releases/tag/v2.3.0">2.3.0</a></h4>

<blockquote><p dir="auto"><a
href="https://bounce.depfu.com/github.com/unjs/jiti/compare/v2.2.1...v2.3.0">compare
changes</a></p>
<div class="markdown-alert markdown-alert-important" dir="auto">
<p class="markdown-alert-title" dir="auto"><svg class="octicon
octicon-report mr-2" viewbox="0 0 16 16" version="1.1" width="16"
height="16" aria-hidden="true"><path d="M0 1.75C0 .784.784 0 1.75
0h12.5C15.216 0 16 .784 16 1.75v9.5A1.75 1.75 0 0 1 14.25 13H8.06l-2.573
2.573A1.458 1.458 0 0 1 3 14.543V13H1.75A1.75 1.75 0 0 1 0
11.25Zm1.75-.25a.25.25 0 0 0-.25.25v9.5c0 .138.112.25.25.25h2a.75.75 0 0
1 .75.75v2.19l2.72-2.72a.749.749 0 0 1 .53-.22h6.5a.25.25 0 0 0
.25-.25v-9.5a.25.25 0 0 0-.25-.25Zm7 2.25v2.5a.75.75 0 0 1-1.5
0v-2.5a.75.75 0 0 1 1.5 0ZM9 9a1 1 0 1 1-2 0 1 1 0 0 1 2
0Z"></path></svg>Important</p>
<p dir="auto">To enhance compatibility, jiti <code
class="notranslate">&gt;=2.1</code> enabled <a
href="https://bounce.depfu.com/github.com/unjs/jiti#interopdefault"><code
class="notranslate">interopdefault</code></a> using a new Proxy method.
If you migrated to <code class="notranslate">2.0.0</code> earlier, this
might have caused behavior changes. In case of any issues during the
upgrade, please <a
href="https://bounce.depfu.com/github.com/unjs/jiti/issues">report</a>
so we can investigate to solve them. 🙏🏼</p>
</div>
<h3 dir="auto">🚀 Enhancements</h3>
<ul dir="auto">
<li>Support <code class="notranslate">jiti.import(id, {default:
true})</code> (<a
href="https://bounce.depfu.com/github.com/unjs/jiti/pull/323">#323</a>)</li>
</ul>
<h3 dir="auto">🩹 Fixes</h3>
<ul dir="auto">
<li>
<strong>interopDefault:</strong> Avoid <code
class="notranslate">in</code> operator for primitive inputs (<a
href="https://bounce.depfu.com/github.com/unjs/jiti/pull/321">#321</a>)</li>
<li>
<strong>interopDefault:</strong> Simplify logic for default export
checks (<a
href="https://bounce.depfu.com/github.com/unjs/jiti/pull/322">#322</a>)</li>
</ul>
<h3 dir="auto">❤️ Contributors</h3>
<ul dir="auto">
<li>Pooya Parsa (<a
href="https://bounce.depfu.com/github.com/pi0">@pi0</a>)</li>
<li>
<a href="https://bounce.depfu.com/github.com/beer">@beer</a> (<a
href="https://bounce.depfu.com/github.com/iiio2">@iiio2</a>)</li>
</ul></blockquote>
<h4><a
href="https://github.com/unjs/jiti/releases/tag/v2.2.1">2.2.1</a></h4>

<blockquote><p dir="auto"><a
href="https://bounce.depfu.com/github.com/unjs/jiti/compare/v2.2.0...v2.2.1">compare
changes</a></p>
<h3 dir="auto">🩹 Fixes</h3>
<ul dir="auto">
<li>Bump cache version (<a
href="https://bounce.depfu.com/github.com/unjs/jiti/commit/3acd097">3acd097</a>)</li>
</ul></blockquote>
<h4><a
href="https://github.com/unjs/jiti/releases/tag/v2.1.2">2.1.2</a></h4>

<blockquote><p dir="auto"><a
href="https://bounce.depfu.com/github.com/unjs/jiti/compare/v2.1.1...v2.1.2">compare
changes</a></p>
<h3 dir="auto">🌊 Types</h3>
<ul dir="auto">
<li>Use local <code class="notranslate">NodeModule</code> type (<a
href="https://bounce.depfu.com/github.com/unjs/jiti/commit/718bea2">718bea2</a>)</li>
</ul></blockquote>
<h4><a
href="https://github.com/unjs/jiti/releases/tag/v2.1.1">2.1.1</a></h4>

<blockquote><p dir="auto"><a
href="https://bounce.depfu.com/github.com/unjs/jiti/compare/v2.1.0...v2.1.1">compare
changes</a></p>
<ul dir="auto">
<li>
<strong>types:</strong> Add standalone types for node require (<a
href="https://bounce.depfu.com/github.com/unjs/jiti/pull/316">#316</a>)</li>
<li>Update babel to 7.25.7</li>
</ul></blockquote>
<p><em>Does any of this look wrong? <a
href="https://depfu.com/packages/npm/jiti/feedback">Please let us
know.</a></em></p>
</details>

<details>
<summary>Commits</summary>
<p><a
href="https://github.com/unjs/jiti/compare/f99a1d7df0064e201df760e17470cc34bb330618...544247421cce0349d58dc94d58e862a7bc12176a">See
the full diff on Github</a>. The new version differs by 31 commits:</p>
<ul>
<li><a
href="https://github.com/unjs/jiti/commit/544247421cce0349d58dc94d58e862a7bc12176a"><code>chore(release):
v2.3.3</code></a></li>
<li><a
href="https://github.com/unjs/jiti/commit/9ceae39f2680ec358b4647db5bd72766fa6cc47d"><code>refactor:
remove some unused exports (#327)</code></a></li>
<li><a
href="https://github.com/unjs/jiti/commit/dccce59504d0f8350b9154f908246ce554183c39"><code>fix(eval):
return fallback value (#326)</code></a></li>
<li><a
href="https://github.com/unjs/jiti/commit/c1a24e0d9f4bc077c70e1ec72f9424b6b4e3b195"><code>chore(release):
v2.3.2</code></a></li>
<li><a
href="https://github.com/unjs/jiti/commit/3627a56e50a1992bc229f7f85a5899b1d870d7b6"><code>chore:
update lockfile</code></a></li>
<li><a
href="https://github.com/unjs/jiti/commit/650cc6c69f485f575f0f08844575946280f10592"><code>fix(eval):
fallback in async mode (#325)</code></a></li>
<li><a
href="https://github.com/unjs/jiti/commit/c4697486207fcbcb390d172da619b7c1a7bac6a2"><code>chore(release):
v2.3.1</code></a></li>
<li><a
href="https://github.com/unjs/jiti/commit/8c30a94171c5aa052fc69b6434ccf6980077db93"><code>fix:
conditional access to `mod.default`</code></a></li>
<li><a
href="https://github.com/unjs/jiti/commit/f67ed60ee59c313500659ae23747cafb6a442ab2"><code>chore:
update note</code></a></li>
<li><a
href="https://github.com/unjs/jiti/commit/a39bd7eb1687059b57c169c3f5001f9d921f4a18"><code>chore(release):
v2.3.0</code></a></li>
<li><a
href="https://github.com/unjs/jiti/commit/c1325e9f2ef1bca43b1dbe9fba301cc655971b37"><code>chore:
update lockfile</code></a></li>
<li><a
href="https://github.com/unjs/jiti/commit/daede71dd4e54b0a6ab66e945677766b5117d829"><code>feat:
support `jiti.import(id, {default: true})` (#323)</code></a></li>
<li><a
href="https://github.com/unjs/jiti/commit/537fa3998f49855681d77c4e5f88a987fb82170e"><code>docs:
add note about interop default</code></a></li>
<li><a
href="https://github.com/unjs/jiti/commit/61891a0c863d261c151cc9dd50f9bace5d089c68"><code>docs:
update interopDefault description and reference</code></a></li>
<li><a
href="https://github.com/unjs/jiti/commit/fd5d7eac13c0bb2bcccce0ca6b6c71ee3503f580"><code>refactor(interopDefault):
simplify logic for default export checks (#322)</code></a></li>
<li><a
href="https://github.com/unjs/jiti/commit/4be8bff84ef5ae16d31cca79ac9118be88e62b64"><code>fix(interopDefault):
avoid `in` operator for primitive inputs (#321)</code></a></li>
<li><a
href="https://github.com/unjs/jiti/commit/a86751ee15b016828fd93d665d27efe549c967ec"><code>docs:
fix format (#320)</code></a></li>
<li><a
href="https://github.com/unjs/jiti/commit/94b172b9794bbf16ea774b8d82b8016384bb327a"><code>chore(release):
v2.2.1</code></a></li>
<li><a
href="https://github.com/unjs/jiti/commit/3acd09751f1471b8f6293ba8f073679836163fe3"><code>fix:
bump cache version</code></a></li>
<li><a
href="https://github.com/unjs/jiti/commit/50ac5d9874f3c6d6198becb1e9ba00d422e5004f"><code>chore(release):
v2.2.0</code></a></li>
<li><a
href="https://github.com/unjs/jiti/commit/138401060f8ea087623b1989ea90930fa52078bf"><code>ci:
correct condition</code></a></li>
<li><a
href="https://github.com/unjs/jiti/commit/4f9d67d639bf8a7cca09c0ca5748bb09f3d9145d"><code>ci:
run nightly release once</code></a></li>
<li><a
href="https://github.com/unjs/jiti/commit/da70d244b012a366cdf1405b04c2983ff754dd64"><code>feat:
use smarter proxy for `interopDefault` (#318)</code></a></li>
<li><a
href="https://github.com/unjs/jiti/commit/88260477e96a3e9e2790ac26f7c9524b7c7f2410"><code>refactor:
inline interopDefault from mlly</code></a></li>
<li><a
href="https://github.com/unjs/jiti/commit/103d165092f7d13e9243977a3f8edf9ec6e66b41"><code>chore(release):
v2.1.2</code></a></li>
<li><a
href="https://github.com/unjs/jiti/commit/718bea26084d464a1969e457f4b3fd409176af08"><code>types:
use local `NodeModule` type</code></a></li>
<li><a
href="https://github.com/unjs/jiti/commit/420787447bc3aa1c4da0d590ed82323cf1e49bed"><code>chore(release):
v2.1.1</code></a></li>
<li><a
href="https://github.com/unjs/jiti/commit/5998e3c88062aceffb035b89e45ad85ccb58381c"><code>chore:
updarte deps</code></a></li>
<li><a
href="https://github.com/unjs/jiti/commit/b3a4ccb6abfdb7112a6f976c8761c0bb11762ce7"><code>fix(types):
add standalone types for node require (#316)</code></a></li>
<li><a
href="https://github.com/unjs/jiti/commit/e7ffe04fceba3ab725d77be091e0c0432dfcf02f"><code>test:
ignore deps for node native register</code></a></li>
<li><a
href="https://github.com/unjs/jiti/commit/1d86ca3a68cb5af1563cc27d328c72ec0e5c22b5"><code>test:
add dependency tests</code></a></li>
</ul>
</details>












---
![Depfu
Status](https://depfu.com/badges/edd6acd35d74c8d41cbb540c30442adf/stats.svg)

[Depfu](https://depfu.com) will automatically keep this PR
conflict-free, as long as you don't add any commits to this branch
yourself. You can also trigger a rebase manually by commenting with
`@depfu rebase`.

<details><summary>All Depfu comment commands</summary>
<blockquote><dl>
<dt>@​depfu rebase</dt><dd>Rebases against your default branch and
redoes this update</dd>
<dt>@​depfu recreate</dt><dd>Recreates this PR, overwriting any edits
that you've made to it</dd>
<dt>@​depfu merge</dt><dd>Merges this PR once your tests are passing and
conflicts are resolved</dd>
<dt>@​depfu cancel merge</dt><dd>Cancels automatic merging of this
PR</dd>
<dt>@​depfu close</dt><dd>Closes this PR and deletes the branch</dd>
<dt>@​depfu reopen</dt><dd>Restores the branch and reopens this PR (if
it's closed)</dd>
<dt>@​depfu pause</dt><dd>Ignores all future updates for this dependency
and closes this PR</dd>
<dt>@​depfu pause [minor|major]</dt><dd>Ignores all future minor/major
updates for this dependency and closes this PR</dd>
<dt>@​depfu resume</dt><dd>Future versions of this dependency will
create PRs again (leaves this PR as is)</dd>
</dl></blockquote>
</details>

Co-authored-by: depfu[bot] <23717796+depfu[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants