Skip to content

docs(Standards): Add initial Svelte standards#470

Closed
jmuzina wants to merge 12 commits intomainfrom
svelte-standards
Closed

docs(Standards): Add initial Svelte standards#470
jmuzina wants to merge 12 commits intomainfrom
svelte-standards

Conversation

@jmuzina
Copy link
Copy Markdown
Member

@jmuzina jmuzina commented Mar 11, 2026

Done

Ports the LUI code practices to markdown standards, following the conventions used in the other pragma standards.

There are some standards in the LUI doc that are closer to generic coding/styling/storybook standards, which I have omitted here. If desired, those should be handled separately.

PR readiness check

  • PR should have one of the following labels:
    • Feature 🎁, Breaking Change 💣, Bug 🐛, Documentation 📝, Maintenance 🔨.
  • PR title follows the Conventional Commits format.
  • The code follows the appropriate code standards
  • All packages define the required scripts in package.json:
    • All packages: check, check:fix, and test.
    • Packages with build steps: build to build the package for development or distribution, build:all to build all artifacts. See CONTRIBUTING.md for details.

@jmuzina jmuzina added Review: Code needed Documentation 📝 Improvements or additions to documentation labels Mar 11, 2026
@jmuzina jmuzina requested a review from mariadias143 March 11, 2026 22:35
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds an initial Svelte standards reference document to align Svelte component development practices with the existing “pragma standards” documentation set.

Changes:

  • Introduces STANDARDS_FOR_SVELTE.md with Svelte-specific guidelines (purity, effects, refs, progressive enhancement).
  • Documents composition patterns (subcomponents, snippets, attachments, reactivity boundaries, stable IDs).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread docs/references/STANDARDS_FOR_SVELTE.md
Comment thread docs/references/STANDARDS_FOR_SVELTE.md Outdated
Comment thread docs/references/STANDARDS_FOR_SVELTE.md Outdated
Comment thread docs/references/STANDARDS_FOR_SVELTE.md Outdated
Copy link
Copy Markdown
Contributor

@steciuk steciuk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a couple suggestions.

Thank you so much for this, Julie!

Comment thread docs/references/STANDARDS_FOR_SVELTE.md Outdated
Comment thread docs/references/STANDARDS_FOR_SVELTE.md Outdated
Comment thread docs/references/STANDARDS_FOR_SVELTE.md Outdated
Comment thread docs/references/STANDARDS_FOR_SVELTE.md
Comment thread docs/references/STANDARDS_FOR_SVELTE.md Outdated
Comment thread docs/references/STANDARDS_FOR_SVELTE.md Outdated
Comment thread docs/references/STANDARDS_FOR_SVELTE.md Outdated
Comment thread docs/references/STANDARDS_FOR_SVELTE.md Outdated
Copy link
Copy Markdown
Contributor

@mariadias143 mariadias143 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really well versed in Svelte so I only have some pointers on file structure. I think overall the doc is well aligned with the existing docs in this folder. It could be interesting to take a look at the code standards repo, I think we would possibly like to move to there (@advl correct me if I'm wrong). But I see this as a good starting point already 🥳

Comment thread docs/references/STANDARDS_FOR_SVELTE.md Outdated
Comment thread docs/references/STANDARDS_FOR_SVELTE.md Outdated
> <OptionsPanel {groups} submitLabel="Save" />
> ```

### Snippets for positioning, subcomponents for encapsulation (`svelte/composition/snippets-vs-subcomponents`)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@steciuk it would be useful to include an example the highlights the distinction between snippets and sub components as this one is an important rule but also a bit sophisticated WDYT?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What exactly would you like to capture in such example?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When a developer is designing a component API deciding between make a component that accepts sub components vs snippet. technically it is possible to achieve encapsulation with both patterns but this document already anticpates this and explain the preference depending on the situation.

However I think we lack examples showcasing the difference in choice between these two patterns to make it easier to understand.

@jmuzina jmuzina requested a review from steciuk March 12, 2026 22:07
Comment thread docs/references/STANDARDS_FOR_SVELTE.md Outdated
Comment thread docs/references/STANDARDS_FOR_SVELTE.md
@advl
Copy link
Copy Markdown
Contributor

advl commented Mar 13, 2026

Can we move this to the https://github.com/canonical/code-standards repo ?

@jmuzina
Copy link
Copy Markdown
Member Author

jmuzina commented Mar 13, 2026

Can we move this to the https://github.com/canonical/code-standards repo ?

Sure, I can. Do I need to write the standard in ttl and then run this script to generate markdown?

@advl
Copy link
Copy Markdown
Contributor

advl commented Apr 19, 2026

Closed to pursue the conversation on the code-standards repo

@advl advl closed this Apr 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Documentation 📝 Improvements or additions to documentation Review: Code needed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants