Giter VIP home page Giter VIP logo

Comments (4)

niktek avatar niktek commented on May 22, 2024

Have done a first pass on this, some notes: npm run lint only shows the filename of something wrong, you need to do npm run format and then use the diff view to see what got changed. And yes it is a lot of minor things like single/double quotes, extra commas, etc. It passes the npm run tests though which is good.

BUT - some of the more deliberate formatting in components, especially around large case statements for applying class strings, get stretched out vertically. Also, it strips commented urls in <-- --> for some reason and I can see that they are handy reference urls that should not be removed.

Ultimately, it has to be script based, because it will be going to CI/CD at some point and there is no maintainer sanity to be had on vetting each commit for linting on top of things like code quality/functionality. I'm happy to see if there is some more tweaking that can be done on the rules, but I dare say the defaults are pretty sane from the svelte linting settings that seem to be there.

I can convert the <-- url --> to \\ commented urls so that they will be preserved on future runs, but I think the carefully crafted case statements are going to be a victim here (or lots of // prettier-ignore's)

from skeleton.

endigo9740 avatar endigo9740 commented on May 22, 2024

Ok, sounds like the current config is not working as expected. We definitely don't want to strip out URL comments as those typically contain useful references or documentation. In that case, leave this one to me. I'll look to adjust the the config and then we'll go from there. Thanks for taking a look though!

Again, I'd advise we not proceed on this until the a11y updates are in complete as these include a notable amount of code changes and refactoring. We might duplicate effort otherwise.

from skeleton.

niktek avatar niktek commented on May 22, 2024

Using the following as .prettierrc

{
	"useTabs": true,
	"singleQuote": true,
	"trailingComma": "none",
	"printWidth": 140,
	"htmlWhitespaceSensitivity": "ignore",
	"svelteSortOrder": "options-styles-scripts-markup",
	"svelteStrictMode": false,
	"svelteBracketNewLine": false,
	"svelteAllowShorthand": true,
	"svelteIndentScriptAndStyle": true
}

Comments aren't being stripped, but they are being moved to below the main <script> tag (well most of them anyways), this is most noticeable on ConicGradient. And it likes <script lang='postcss'> at the top too.

Adjusting the printWidth to 140 stopped a few line wraps on let class = 'long class string' - but I can't confirm on a laptop right now if that makes side scrolling a thing. Not really a big deal either way.

It's really only, Button, Avatar, Menu, Toast, Tooltip and some of the source props for tables in data-tables, drawers, lists, menus, paginators that could do with a judicial // prettier-ignore to preserve some chunks. Much less than I thought.

It has made the docs pages source a lot easier for spell checking due to the column wrap. Have done a visual check on the served docs pages and no rendering issues on that side either.

Definitely will wait till A11y stuff is done, but this is looking nice and straight forward now.

from skeleton.

endigo9740 avatar endigo9740 commented on May 22, 2024

This is great! These changes will be far reaching so I'd like give this a once-over as well before we implement, but I'll definitely use your config as the baseline.

I'd be surprised if there's no a way to keep comments at the top of the file. Perhaps they need to be formatted multi-line?

/* 
 * Example Comment
*/

Line wrapping does help readability in most cases. We'll aim to modify the code and accommodate and meet the requirements we settle on (140, etc), then opt for the prettier-ignore as sparingly as possible.

Excited to check it out though!

from skeleton.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.