Commit b85fb24c authored by catch's avatar catch
Browse files

Issue #2591827 by longwave, neclimdul, elachlan, daffie: Add YAML linting to...

Issue #2591827 by longwave, neclimdul, elachlan, daffie: Add YAML linting to core coding standards checks
parent 30fc03b1
......@@ -8,3 +8,9 @@ modules/locale/tests/locale_test.es6.js
misc/polyfills/array.find.es6.js
misc/polyfills/element.closest.es6.js
misc/polyfills/object.assign.es6.js
# Ignore deliberately malformed YAML files.
modules/system/tests/fixtures/HtaccessTest/access_test.yml
modules/system/tests/themes/test_theme_libraries_empty/test_theme_libraries_empty.info.yml
tests/Drupal/Tests/Core/Asset/library_test_files/empty.libraries.yml
tests/Drupal/Tests/Core/Asset/library_test_files/invalid_file.libraries.yml
{
"extends": [
"airbnb",
"plugin:prettier/recommended"
"plugin:prettier/recommended",
"plugin:yml/recommended"
],
"root": true,
"env": {
......
modules/locale/tests/locale_test.es6.js
*.yml
......@@ -1245,11 +1245,9 @@ services:
arguments: ['@current_user']
ajax_response.attachments_processor:
class: Drupal\Core\Ajax\AjaxResponseAttachmentsProcessor
tags:
arguments: ['@asset.resolver', '@config.factory', '@asset.css.collection_renderer', '@asset.js.collection_renderer', '@request_stack', '@renderer', '@module_handler']
html_response.attachments_processor:
class: Drupal\Core\Render\HtmlResponseAttachmentsProcessor
tags:
arguments: ['@asset.resolver', '@config.factory', '@asset.css.collection_renderer', '@asset.js.collection_renderer', '@request_stack', '@renderer', '@module_handler']
html_response.subscriber:
class: Drupal\Core\EventSubscriber\HtmlResponseSubscriber
......
......@@ -3,8 +3,6 @@
# https://www.drupal.org/drupalorg/docs/drupal-ci/customizing-drupalci-testing
build:
assessment:
validate_codebase:
# Core's code quality is checked by container_command.commit_checks.
testing:
# Run code quality checks.
container_command.commit-checks:
......@@ -45,4 +43,4 @@ build:
halt-on-fail: false
# Run nightwatch testing.
# @see https://www.drupal.org/project/drupal/issues/2869825
nightwatchjs:
nightwatchjs: {}
......@@ -22,6 +22,7 @@
"lint:core-js-stats": "node ./node_modules/eslint/bin/eslint.js --format=./scripts/js/eslint-stats-by-type.js .",
"lint:css": "stylelint \"**/*.css\"",
"lint:css-checkstyle": "stylelint \"**/*.css\" --custom-formatter ./node_modules/stylelint-checkstyle-formatter/index.js",
"lint:yaml": "node ./node_modules/eslint/bin/eslint.js --ext .yml .",
"test:nightwatch": "cross-env BABEL_ENV=development node -r dotenv-safe/config -r @babel/register ./node_modules/.bin/nightwatch --config ./tests/Drupal/Nightwatch/nightwatch.conf.js",
"prettier": "prettier --write \"./**/*.es6.js\" \"./tests/Drupal/Nightwatch/**/*.js\"",
"spellcheck": "cspell",
......@@ -54,6 +55,7 @@
"eslint-plugin-prettier": "^3.1.2",
"eslint-plugin-react": "^7.10.0",
"eslint-plugin-react-hooks": "^4.1.2",
"eslint-plugin-yml": "^0.10.0",
"farbtastic": "https://github.com/mattfarina/farbtastic/archive/1.3u.tar.gz",
"glob": "^7.1.2",
"joyride": "https://github.com/zurb/joyride/archive/refs/heads/v2.1.tar.gz",
......
......@@ -11,7 +11,7 @@
# - File modes.
# - No changes to core/node_modules directory.
# - PHPCS checks PHP and YAML files.
# - Eslint checks JavaScript files.
# - ESLint checks JavaScript and YAML files.
# - Checks .es6.js and .js files are equivalent.
# - Stylelint checks CSS files.
# - Checks .pcss.css and .css files are equivalent.
......@@ -232,6 +232,23 @@
fi
fi
############################################################################
### YAML FILES
############################################################################
if [[ -f "$TOP_LEVEL/$FILE" ]] && [[ $FILE =~ \.yml$ ]]; then
# Test files with ESLint.
cd "$TOP_LEVEL/core"
node ./node_modules/eslint/bin/eslint.js --quiet --resolve-plugins-relative-to . "$TOP_LEVEL/$FILE"
YAMLLINT=$?
if [ "$YAMLLINT" -ne "0" ]; then
# If there are failures set the status to a number other than 0.
STATUS=1
else
printf "ESLint: $FILE ${green}passed${reset}\n"
fi
cd $TOP_LEVEL
fi
############################################################################
### JAVASCRIPT FILES
############################################################################
......
......@@ -2449,6 +2449,16 @@ eslint-plugin-react@^7.10.0:
resolve "^2.0.0-next.3"
string.prototype.matchall "^4.0.4"
eslint-plugin-yml@^0.10.0:
version "0.10.0"
resolved "https://registry.yarnpkg.com/eslint-plugin-yml/-/eslint-plugin-yml-0.10.0.tgz#edab6f859121fb66740a631d27bfb68d42316e1d"
integrity sha512-N3F9Zcq9SeEphK02FdLWAg4eMbOzXTZ9K6QrPuv27mW212yOmEIrTiqzA29w2NBQGsfKMxfEQRV86JVfJmWJ8w==
dependencies:
debug "^4.1.1"
lodash "^4.17.19"
natural-compare "^1.4.0"
yaml-eslint-parser "^0.4.0"
eslint-scope@^5.1.1:
version "5.1.1"
resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-5.1.1.tgz#e786e59a66cb92b3f6c1fb0d508aab174848f48c"
......@@ -2469,7 +2479,7 @@ eslint-visitor-keys@^1.1.0, eslint-visitor-keys@^1.3.0:
resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz#30ebd1ef7c2fdff01c3a4f151044af25fab0523e"
integrity sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==
eslint-visitor-keys@^2.0.0:
eslint-visitor-keys@^2.0.0, eslint-visitor-keys@^2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz#f65328259305927392c938ed44eb0a5c9b2bd303"
integrity sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==
......@@ -3731,7 +3741,7 @@ lodash.truncate@^4.4.2:
resolved "https://registry.yarnpkg.com/lodash.truncate/-/lodash.truncate-4.4.2.tgz#5a350da0b1113b837ecfffd5812cbe58d6eae193"
integrity sha1-WjUNoLERO4N+z//VgSy+WNbq4ZM=
lodash@^4.17.10, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.19, lodash@^4.17.21:
lodash@^4.17.10, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.19, lodash@^4.17.20, lodash@^4.17.21:
version "4.17.21"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c"
integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==
......@@ -6136,6 +6146,15 @@ yallist@^4.0.0:
resolved "https://registry.yarnpkg.com/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72"
integrity sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==
yaml-eslint-parser@^0.4.0:
version "0.4.1"
resolved "https://registry.yarnpkg.com/yaml-eslint-parser/-/yaml-eslint-parser-0.4.1.tgz#66966662010ac6ab372e61b99618e59dc903ccf1"
integrity sha512-GoJ/p1EW8O2tbTbuhfxjo1XhfUFU3uX3kwvfEQoOaZjO2Lubx8POjlsSqB+18b3SxkujAdQYT9r9nURaUWNYWQ==
dependencies:
eslint-visitor-keys "^2.1.0"
lodash "^4.17.20"
yaml "^1.10.0"
yaml@^1.10.0:
version "1.10.2"
resolved "https://registry.yarnpkg.com/yaml/-/yaml-1.10.2.tgz#2301c5ffbf12b467de8da2333a459e29e7920e4b"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment