You can check the current state of coding standards compliance using eslint:

yarn install
yarn run lint:core-js-passing

They are powered via the core/.eslintrc.passing.json configuration file

Background

We adapted the airbnb coding standard (#2815077: Adopt airbnb javascript style guide v14.1 as new baseline javascript coding standards for Drupal 8 core and contrib), but we are not fully compliant to it yet.

Proposed solution

We split up the work of fixing the coding standards into small chunks. These chunks should be one eslintrc rule, so the individual patches are easy to review, just like we are doing it in #2571965: [meta] Fix PHP coding standards in core.

Approach

  • Pick a rule, like “no-mutable-exports” and ensure they are not longer excluded from the .eslintrc.json file, see #2912961: Step 0 JS codestyle: Exclude non passing eslint rules
  • Copy the issue template, linked below, and put in your picked rule
  • Link this issue to it using the parent field in the issue
  • Fix all of the instances of this rule, but NO others
  • Verify by using yarn run lint:core-js | grep no-mutable-exports | wc -l
  • Review others people’s issues

Comments

dawehner created an issue. See original summary.

dawehner’s picture

Issue summary: View changes
dawehner’s picture

Issue summary: View changes
nod_’s picture

Title: [pp-1] Step 1 JS codestyle: [meta] Fix JS coding standards in core » Step 1 JS codestyle: [meta] Fix JS coding standards in core
Category: Task » Plan
Status: Postponed » Active
Issue tags: +JavaScript clean-up
xjm’s picture

I'm on the fence as to whether we should want to backport these standard fixes to 8.4.x. #2912961: Step 0 JS codestyle: Exclude non passing eslint rules is only available for 8.5.x and backporting it would not be semver-compliant, but we could still backport the cleanups themselves since if they're working as intended they shouldn't be making functional changes.

On the one hand, if we don't, the branches will diverge and make cherry-picking actual bugfixes harder. On the other hand, if we do, we could inadvertently break something we don't have test coverage for, especially for issues more complicated than this one. I'll ask other committers for an opinion.

dawehner’s picture

Personally I think the CS patches we had so far have been so minimal that i think the risk of diversion is quite small, but maybe I'm simply underestimating the problem.

xjm’s picture

The scope of what we've seen so far is small, yeah. OTOH there's thousands to go before we sleep, including patches like #2915784: 1/3 JS codestyle: camelcase which is big and also contains variable renaming -- which is a classic "gotcha" for introducing bugs with cleanups. So they could be risky and we might have the branches diverge. And that one is on the edge for a cleanup we'd commit as a scheduled RC target. Not sure.

We can probably continue committing them to 8.5.x for now and backport them if we have a concrete need or find that other backports are becoming tediously divergent from their parent patches.

dawehner’s picture

We can probably continue committing them to 8.5.x for now and backport them if we have a concrete need or find that other backports are becoming tediously divergent from their parent patches.

Good point, let's not have some premature optimization going on.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.0-alpha1 will be released the week of January 17, 2018, which means new developments and disruptive changes should now be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

elachlan’s picture

Issue summary: View changes
elachlan’s picture

Version: 8.6.x-dev » 8.7.x-dev

Drupal 8.6.0-alpha1 will be released the week of July 16, 2018, which means new developments and disruptive changes should now be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

quietone’s picture

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.