Have a topic for discussion for the next meeting? Leave a suggested edit on next week’s agenda.
Agenda Item: Coding standards
- Remove: Whitespace exceptions for object and array literal member access.
- Remove: Enforcement of Yoda conditional.
- Remove: Strict equality exception for “== null”.
- Change: New standard for multi-line conditions
- If the condition is short enough to fit in a line, just use a single line.
- If not, one condition per line separated from the opening/closing parenthesis.
- The operator position at the end.
- New: ES2015: Prefer “const” variable assignment, then “let”, never “var”.
- New: Adopt Gutenberg The Gutenberg project is the new Editor Interface for WordPress. The editor improves the process and experience of creating new content, making writing rich content much simpler. It uses ‘blocks’ to add richness rather than shortcodes, custom HTML etc. https://wordpress.org/gutenberg/ camel-case clarifications.
- New: Adopt dangling comma enforcement.
- No change: Multi-line comments.
- Provide presets for ES5-only and ESnext code.
While we agreed last week on multiline/single line comments separation, it was argued that:
- Converting comment styles is not easy (moving from single to multiline as we type).
// comments are easier to deal with when debugging.
- All IDEs don’t allow configuring this rule (multi/single line comment difference).
We agreed on the following rules for comments:
/** is to be used for JSDoc.
/* is to be used for intra-line comments.
// is to be used in all other instances.
- Update the ESlint Preset package Pull Request in Gutenberg: https://github.com/WordPress/gutenberg/pull/7965 @aduth @gziolo
Agenda Item: Source Maps
While we splitted Gutenberg Code Base into reusable packages, we updated our build scripts to rely on “transpired” code in our application code which means it’s harder to debug because browsers don’t have the source maps correctly mapped to the original source files.
Potential solutions discussed
- Use untranspiled code when building Gutenberg itself (cons: we should be the first consumers of our packages).
- Source maps per package used by webpack to generate other source maps.
The best solution is not clear yet, we’re going to do some exploration to see what’s the best path forward. @youknowriad @gziolo
Some new packages are ready to be released and should be published to
npm soon. We still need to figure out the best option to support 2FA when publishing a big number of packages at the same time.
How to lazy-load WP scripts/styles given their handle names?
/wp-admin/load-styles.php only work for WordPress default scripts/styles and don’t support dependencies discovery? There’s no alternative at the moment, work must be done to add these features or propose an alternative endpoint for that.