Skip to content
Snippets Groups Projects
Commit 9ca1eba6 authored by James Shields's avatar James Shields Committed by Chris Wells
Browse files

Issue #3421699 by lostcarpark, fjgarlin, chrisfromredfin: Gitlab CI - get ESLint running

parent 15d99e72
No related branches found
No related tags found
No related merge requests found
......@@ -47,9 +47,6 @@ include:
# Docs at https://git.drupalcode.org/project/gitlab_templates/-/blob/1.0.x/includes/include.drupalci.variables.yml
################
variables:
# eslint doesn't work right now because Project Browser's dev dependencies are not added on CI: https://git.drupalcode.org/issue/project_browser-3415079/-/jobs/644818#L34
# Fix this in a follow-up.
SKIP_ESLINT: '1'
# These two variables allow PHPUnit to run in a parallel job matrix.
_PHPUNIT_CONCURRENT: '1'
_PHPUNIT_TESTGROUPS: ''
......@@ -64,6 +61,27 @@ phpstan:
before_script:
- sed -i "s/\/core\//\/web\/core\//" phpstan.neon.dist
################
# We want to run standard eslint for /js directory, but not /sveltejs directory.
# .eslintignore patterns do not work due to ESLint scanning for .eslintrc.js
################
eslint:
before_script:
- rm -fr sveltejs
################
# Add a new section for validation of Svelte JS.
################
eslint-sveltejs:
stage: validate
allow_failure: true
needs:
- composer
script:
- cd sveltejs
- yarn install
- yarn lint:svelte
################
# Split tests by test type for parallel running.
################
......
......@@ -7,7 +7,7 @@
* @see core/modules/block/js/block.es6.js
*/
(function ($, window, Drupal, once) {
(function enableDisablePlugin($, window, Drupal, once) {
/**
* Enable/Disable a Plugin in the table via select list.
*
......@@ -20,7 +20,7 @@
* Attaches the tableDrag behavior plugin settings form.
*/
Drupal.behaviors.projectBrowserPluginSourceDrag = {
attach(context, settings) {
attach(context) {
// Only proceed if tableDrag is present and we are on the settings page.
if (!Drupal.tableDrag || !Drupal.tableDrag.project_browser) {
return;
......@@ -63,7 +63,10 @@
// absolute minimum available weight. This way we always have an
// unused upper and lower bound, which makes manually setting the
// weights easier for users who prefer to do it that way.
() => ++weight,
() => {
weight += 1;
return weight;
},
);
}
......@@ -71,13 +74,13 @@
// Get the tableDrag object.
const tableDrag = Drupal.tableDrag.project_browser;
// Add a handler for when a row is swapped.
tableDrag.row.prototype.onSwap = function (swappedRow) {
tableDrag.row.prototype.onSwap = function swapHandler() {
updateLastPlaced(table, this);
};
// Add a handler so when a row is dropped, update fields dropped into
// new regions.
tableDrag.onDrop = function () {
tableDrag.onDrop = function dropHandler() {
const dragObject = this;
const $rowElement = $(dragObject.rowObject.element);
const regionRow = $rowElement.prevAll('tr.status-title').get(0);
......@@ -105,12 +108,12 @@
// Add the behavior to each region select list.
$(
once('source-status-select', 'select.source-status-select', context),
).on('change', function (event) {
).on('change', function addBehaviorOnce() {
// Make our new row and select field.
const row = $(this).closest('tr');
const select = $(this);
// Find the correct region and insert the row as the last in the
// region.
// Find the correct region and insert the row as the last in the region.
// eslint-disable-next-line new-cap
tableDrag.rowObject = new tableDrag.row(row[0]);
const regionMessage = table.find(`.status-title-${select[0].value}`);
const regionItems = regionMessage.nextUntil('.status-title');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment