Javascript Chat Summary – July 24th

Below is a summary of the discussion from this week’s JavaScriptJavaScript JavaScript or JS is an object-oriented computer programming language commonly used to create interactive effects within web browsers. WordPress makes extensive use of JS for a better user experience. While PHP is executed on the server, JS executes within a user’s browser. https://www.javascript.com/. chat (agenda, Slack transcript).

Have a topic for discussion for the next meeting? Leave a suggested edit on next week’s agenda.

Agenda Item: Administrative

Slack Conversation

It was raised that listing the attendees of a chat in the summary takes unnecessary time from the volunteers who take notes. We decided to no longer do it.

Agenda Item: JSJS JavaScript, a web scripting language typically executed in the browser. Often used for advanced user interfaces and behaviors. coding standards

Slack Conversation

This agenda item focused around normalizing JS coding standards between WordPress coreCore Core is the set of software required to run WordPress. The Core Development Team builds WordPress. and GutenbergGutenberg 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/. The overall consensus was that coding standards we decide on should be enforceable through ESlint. We agreed on the following decisions:

  • For multiline comments, we will stick to the current core standards. Aside from some personal preferences, no one raised a strong need to change them.
  • We’ll remove all spacing exceptions from the JS standards on spacing.
  • Yoda conditions will no longer be enforced for JS.
  • We won’t allow any exceptions for strict equality. The current exceptions in the core JS standards will be removed.
  • For multiline conditions we’ll enforce three rules (proposed by @youknowriad):
    • 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
  • For multiline conditions we’ll remove the indentation clause from the standards.
  • The Gutenberg naming conventions will be added to the standards. See:
  • CSSCSS Cascading Style Sheets. naming conventions also need to be normalized with core. This should be addressed separately.
  • We’ll start enforcing trailing comma’s.
  • With regard to variable declarations at the top of each function: `var` declarations should always be at the top, `let` and `const` shouldn’t. This is because `var` is hoisted, the others aren’t.
  • ES5 (non-transpiled) code should still be able to meet standards. We decided to have two rulesets, one baseset and one set specifically for ESnext (transpiled) code. It should be possible to disable the ESnext ruleset for legacy code. This will also be very useful for pluginPlugin A plugin is a piece of software containing a group of functions that can be added to a WordPress website. They can extend functionality or add new features to your WordPress websites. WordPress plugins are written in the PHP programming language and integrate seamlessly with WordPress. These can be free in the WordPress.org Plugin Directory https://wordpress.org/plugins/ or can be cost-based plugin from a third-party and theme authors.
  • The ESnext specific standards still need some more exploration. These will be explored in a tracTrac An open source project by Edgewall Software that serves as a bug tracker and project management tool for WordPress. ticketticket Created for both bug reports and feature development on the bug tracker. or GithubGitHub GitHub is a website that offers online implementation of git repositories that can easily be shared, copied and modified by other developers. Public repositories are free to host, private repositories require a paid subscription. GitHub introduced the concept of the ‘pull request’ where code changes done in branches by contributors can be reviewed and discussed before being merged be the repository owner. https://github.com/ issue / PR. There is already a related PR here: https://github.com/WordPress/gutenberg/pull/7965
  • We agreed the current JS in core should be updated to adhere as much as possible to the WordPress JS coding standards. This is also in line with the most recent practices regarding coding standards. We decided to at least fix what can be autofixed.

Agenda Item: deprecations

Slack Conversation

@jorbin created a PR on the deprecated package. The idea is that whenever a deprecated feature is encountered, an action is fired. This is necessary to log deprecation notices and to be able to easily log these deprecations or for plugins to handle and do something when something deprecated is encountered.

The approach was received positively. @jorbin will process the code review so we can merge.