Skip to content

Coding conventions

Mark Reeves edited this page Jan 4, 2018 · 5 revisions

Java coding conventions

The Java coding conventions are found in sun_checks_wc.xml. The conventions mostly follow CheckStyle default conventions Variations from the CheckStyle defaults are marked in sun_checks_wc.xml with a comment marker <!-- WC -->

Theme code conventions

The following comprises the expected code standards for the core WComponents theme code. This is a work in progress.

General theme coding conventions

In the WComponents default theme code should comply with relevant standards as defined by:

  • Ecma International for [JavaScript];
  • [W3C] for CSS, [XSLT], [XPath] and [SVG];
  • [WHATWG] for [HTML5]. Note: the HTML5 specification copy republished and amended by the W3C is not to be used as it does not accurately reflect the HTML5 specification and provides no easily accessible documentation of the changes made by the W3C to the WHATWG specification. For further details see the [note in the WHATWG specification][note]; or
  • other relevant standards body for other technologies.

JavaScript coding conventions

The JavaScript coding standards are described in the file wcomponents-theme/src/main/js/wc/README.md. The actual rules are in the wcomponents-theme/.eslintrc file.

Sass coding conventions

The Sass coding standards are described in the file wcomponents-theme/src/main/sass/README.md. We do not currently lint on build the way we do for JavaScript but we recommend linting using [sass-lint]. Sass lint rules are in the wcomponents-theme/.sass-lint.yml file and mostly comply with sass-lint defaults.

[HTML5] https://html.spec.whatwg.org/ [JavaScript]: http://www.ecma-international.org/publications/standards/Ecma-262.htm [note]: https://html.spec.whatwg.org/multipage/introduction.html#is-this-html5? [sass-lint]: https://github.com/sasstools/sass-lint [SVG]: http://www.w3.org/Graphics/SVG/ [WHATWG]: https://whatwg.org/ [W3C]: http://www.w3.org/ [XPath]:http://www.w3.org/TR/xpath/ [XSLT]: http://www.w3.org/TR/xslt

Clone this wiki locally