Page MenuHomePhabricator

docs: Set conventions for demo code in component documentation
Open, LowPublic3 Estimated Story Points

Description

Goal

We should decide what conventions to use in the component demos, then document those in the repo and apply them everywhere.

Decision background

Component tag casing (resolved)

The Vue style guide recommends PascalCase (e.g. <CdxButton>), but in DOM templates and in MediaWiki that doesn't work, and kebab-case (e.g. <cdx-button>) has to be used instead. Should we use PascalCase in our documentation, and assume that consumers in MediaWiki will know (or be told by their eslint rules) to know kebab-case instead? Or should the demos use kebab-case, so that MediaWiki consumers can copy code more easily? It's worth noting that PascalCase breaks in a MediaWiki environment, but kebab-case doesn't break in a build step environment (even though PascalCase is recommended in those environments and eslint could enforce that).

Update: we have decided to use kebab-case

Composition API or options API

  • Should we use the composition API in the demo examples, or the options API?
  • Or should we use the options API where possible for simplicity, and the composition API where needed?

Criteria for done

  • Component and event tag casing decided
  • Composition API or options API decided
  • Conventions are documented in contributing code docs

Event Timeline

Ad Component tag casing: I'd go for the simplest solution for the majority of our users, which for the foreseeable future will be MediaWiki bound.

Change 754052 had a related patch set uploaded (by Catrope; author: Catrope):

[design/codex@main] build: Enforce kebab-case for component names and event names

https://gerrit.wikimedia.org/r/754052

Change 754052 merged by jenkins-bot:

[design/codex@main] build, components: Enforce kebab-case for component names and event names

https://gerrit.wikimedia.org/r/754052

Component and event tag casing decided and enforced

appears to have been decided to be kebab-case

Composition API or options API decided

I'd say just use composition API because thats what we use elsewhere, though it might be helpful to have a single example with the options API just for demonstration

ldelench_wmf moved this task from Inbox to Needs Refinement on the Design-System-Team board.
ldelench_wmf set the point value for this task to 3.Sep 19 2022, 3:42 PM
Volker_E renamed this task from Set conventions for demo code in component documentation to docs: Set conventions for demo code in component documentation.Sep 21 2022, 10:42 PM