Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions .ahoy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ commands:
ahoy up --build --force-recreate # Start the stack.
ahoy composer install # Install Composer dependencies.
ahoy fei # Install front-end dependencies.
#;< DRUPAL_THEME
ahoy fe # Build front-end assets.
#;> DRUPAL_THEME
ahoy provision # Provision the site.
VORTEX_SHOW_LOGIN=1 ahoy info # Show information and a login link.

Expand Down Expand Up @@ -160,11 +162,15 @@ commands:
ahoy confirm "All containers and build files will be removed. Proceed?" &&
AHOY_CONFIRM_RESPONSE=y ahoy down && ./scripts/vortex/reset.sh "$@"

#;< DRUPAL_THEME
fei:
usage: Install front-end assets.
cmd: ahoy cli "yarn --cwd=${WEBROOT}/themes/custom/${DRUPAL_THEME} install"
cmd: |
ahoy cli "yarn install --frozen-lockfile"
#;< DRUPAL_THEME
ahoy cli "yarn --cwd=${WEBROOT}/themes/custom/${DRUPAL_THEME} install --frozen-lock"
#;> DRUPAL_THEME

#;< DRUPAL_THEME
fe:
usage: Build front-end assets.
cmd: ahoy cli "cd ${WEBROOT}/themes/custom/${DRUPAL_THEME} && npm run build"
Expand Down Expand Up @@ -192,13 +198,14 @@ commands:
ahoy cli vendor/bin/rector --clear-cache --dry-run
ahoy cli vendor/bin/phpmd . text phpmd.xml

#;< DRUPAL_THEME
lint-fe:
usage: Lint front-end code.
cmd: |
ahoy cli vendor/bin/twig-cs-fixer lint
ahoy cli "yarn run lint"
#;< DRUPAL_THEME
ahoy cli "yarn run --cwd=\${WEBROOT}/themes/custom/\${DRUPAL_THEME} lint"
#;> DRUPAL_THEME
#;> DRUPAL_THEME

Comment on lines 204 to 209

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick (assertive)

Run theme lint only when theme exists
If DRUPAL_THEME is unset the root yarn run lint already covers all JS/CSS. Guard the theme-scoped lint with a [ -n "${DRUPAL_THEME}" ] check to avoid “No such file or directory” errors in projects without a custom theme.

🤖 Prompt for AI Agents
In the .ahoy.yml file around lines 204 to 209, the theme-specific lint command
runs unconditionally, causing errors if DRUPAL_THEME is unset. Wrap the theme
lint command in a conditional check that runs it only if DRUPAL_THEME is set and
non-empty by using a shell test like [ -n "${DRUPAL_THEME}" ] before executing
the theme-scoped lint command.

lint-tests:
usage: Lint tests code.
Expand All @@ -215,13 +222,14 @@ commands:
ahoy cli vendor/bin/rector --clear-cache
ahoy cli vendor/bin/phpcbf

#;< DRUPAL_THEME
lint-fe-fix:
usage: Fix lint issues of front-end code.
cmd: |
ahoy cli vendor/bin/twig-cs-fixer lint --fix
ahoy cli "yarn run lint-fix"
#;< DRUPAL_THEME
ahoy cli "yarn run --cwd=\${WEBROOT}/themes/custom/\${DRUPAL_THEME} lint-fix"
#;> DRUPAL_THEME
#;> DRUPAL_THEME

test:
usage: Run all tests.
Expand Down
11 changes: 9 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -263,9 +263,10 @@ jobs:
docker compose exec $(env | cut -f1 -d= | sed 's/^/-e /') -T cli bash -c " \
if [ -n \"${GITHUB_TOKEN:-}\" ]; then export COMPOSER_AUTH='{\"github-oauth\": {\"github.com\": \"${GITHUB_TOKEN-}\"}}'; fi && \
COMPOSER_MEMORY_LIMIT=-1 composer --ansi install --prefer-dist"
docker compose exec $(env | cut -f1 -d= | sed 's/^/-e /') -T cli bash -c "yarn install --frozen-lockfile"

- run:
name: Validate Composer configuration normalized
name: Validate Composer configuration is normalized
command: docker compose exec -T cli composer normalize --dry-run || [ "${VORTEX_CI_COMPOSER_NORMALIZE_IGNORE_FAILURE:-0}" -eq 1 ]

- run:
Expand Down Expand Up @@ -293,8 +294,14 @@ jobs:
command: docker compose exec -T cli vendor/bin/gherkinlint lint tests/behat/features || [ "${VORTEX_CI_GHERKIN_LINT_IGNORE_FAILURE:-0}" -eq 1 ]

- run:
name: Lint code with NodeJS linters
name: Lint module code with NodeJS linters
command: docker compose exec -T cli bash -c "yarn run lint" || [ "${VORTEX_CI_NODEJS_LINT_IGNORE_FAILURE:-0}" -eq 1 ]

#;< DRUPAL_THEME
- run:
name: Lint theme code with NodeJS linters
command: docker compose exec -T cli bash -c "yarn --cwd=\${WEBROOT}/themes/custom/\${DRUPAL_THEME} run lint" || [ "${VORTEX_CI_NODEJS_LINT_IGNORE_FAILURE:-0}" -eq 1 ]
#;> DRUPAL_THEME

- run:
name: Provision site
Expand Down
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ drush/contrib/
!.docker/scripts
!.env
!.eslintrc.json
!.eslintignore
!.sass-lint.yml
!.stylelintrc.js
!.twig-cs-fixer.php
!gherkinlint.json
!Gruntfile.js
Expand Down
10 changes: 10 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
node_modules/
vendor/
web/core/
web/libraries/
web/modules/contrib/
web/profiles/contrib/
web/themes/contrib/
web/sites/*/files/
*.min.js
*.min.css
Comment on lines +9 to +10

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick (assertive)

Use recursive pattern so minified assets nested in sub-dirs are ignored too

*.min.js and *.min.css only match files in the repo root.
Switch to a recursive glob so anything in deeper paths (web/**, themes/**, etc.) is excluded as well.

-*.min.js
-*.min.css
+**/*.min.js
+**/*.min.css
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
*.min.js
*.min.css
**/*.min.js
**/*.min.css
🤖 Prompt for AI Agents
In the .eslintignore file at lines 9 to 10, the patterns '*.min.js' and
'*.min.css' only ignore minified files in the root directory. To also ignore
minified files in all subdirectories, update these patterns to use a recursive
glob like '**/*.min.js' and '**/*.min.css'. This change ensures minified assets
nested in any folder are excluded from linting.

210 changes: 210 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,210 @@
{
"extends": "eslint:recommended",
"root": true,
"env": {
"browser": true
},
"parserOptions": {
"ecmaVersion": 2020
},
"globals": {
"Drupal": true,
"drupalSettings": true,
"drupalTranslations": true,
"domready": true,
"jQuery": true,
"_": true,
"matchMedia": true,
"Backbone": true
},
"rules": {
"array-bracket-spacing": [
"error",
"never"
],
"block-scoped-var": "error",
"brace-style": [
"error",
"stroustrup",
{
"allowSingleLine": true
}
],
"comma-dangle": [
"error",
"never"
],
"comma-spacing": "error",
"comma-style": [
"error",
"last"
],
"computed-property-spacing": [
"error",
"never"
],
"curly": [
"error",
"all"
],
"eol-last": "error",
"eqeqeq": [
"error",
"smart"
],
"guard-for-in": "error",
"indent": [
"error",
2,
{
"SwitchCase": 1
}
],
"key-spacing": [
"error",
{
"beforeColon": false,
"afterColon": true
}
],
"keyword-spacing": [
"error",
{
"before": true,
"after": true
}
],
"linebreak-style": [
"error",
"unix"
],
"lines-around-comment": [
"error",
{
"beforeBlockComment": true,
"afterBlockComment": false
}
],
"new-parens": "error",
"no-array-constructor": "error",
"no-caller": "error",
"no-catch-shadow": "error",
"no-eval": "error",
"no-extend-native": "error",
"no-extra-bind": "error",
"no-extra-parens": [
"error",
"functions"
],
"no-implied-eval": "error",
"no-iterator": "error",
"no-label-var": "error",
"no-labels": "error",
"no-lone-blocks": "error",
"no-loop-func": "error",
"no-multi-spaces": "error",
"no-multi-str": "error",
"no-native-reassign": "error",
"no-nested-ternary": "error",
"no-new-func": "error",
Comment on lines +90 to +109

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Deprecated ESLint rules will break the linter run
no-native-reassign, no-catch-shadow, and no-spaced-func were removed in ESLint ≥ v4 / v3. Keeping them yields “Configuration for rule ‹…› not found” and exits with code 2.

-        "no-catch-shadow": "error",-        "no-native-reassign": "error",-        "no-spaced-func": "error",
+        "no-shadow": ["error", { "builtinGlobals": false, "hoist": "functions" }],
+        "no-global-assign": "error",
+        "func-call-spacing": ["error", "never"],

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In the .eslintrc.json file between lines 90 and 109, the rules
"no-native-reassign", "no-catch-shadow", and "no-spaced-func" are deprecated and
cause the linter to fail. Remove these deprecated rules from the configuration
to prevent the "Configuration for rule ‹…› not found" error and allow the linter
to run successfully.

"no-new-object": "error",
"no-new-wrappers": "error",
"no-octal-escape": "error",
Comment on lines +88 to +112

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Deprecated / removed ESLint rule no-native-reassign

no-native-reassign was replaced by no-global-assign and has been removed from ESLint ≥ v4.
Keeping it causes “Configuration for rule … not found” and the linter exits with code 2.

-        "no-native-reassign": "error",
+        "no-global-assign": "error",

Ensure CI uses an ESLint version that supports every declared rule.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"new-parens": "error",
"no-array-constructor": "error",
"no-caller": "error",
"no-catch-shadow": "error",
"no-eval": "error",
"no-extend-native": "error",
"no-extra-bind": "error",
"no-extra-parens": [
"error",
"functions"
],
"no-implied-eval": "error",
"no-iterator": "error",
"no-label-var": "error",
"no-labels": "error",
"no-lone-blocks": "error",
"no-loop-func": "error",
"no-multi-spaces": "error",
"no-multi-str": "error",
"no-native-reassign": "error",
"no-nested-ternary": "error",
"no-new-func": "error",
"no-new-object": "error",
"no-new-wrappers": "error",
"no-octal-escape": "error",
"new-parens": "error",
"no-array-constructor": "error",
"no-caller": "error",
"no-catch-shadow": "error",
"no-eval": "error",
"no-extend-native": "error",
"no-extra-bind": "error",
"no-extra-parens": [
"error",
"functions"
],
"no-implied-eval": "error",
"no-iterator": "error",
"no-label-var": "error",
"no-labels": "error",
"no-lone-blocks": "error",
"no-loop-func": "error",
"no-multi-spaces": "error",
"no-multi-str": "error",
- "no-native-reassign": "error",
+ "no-global-assign": "error",
"no-nested-ternary": "error",
"no-new-func": "error",
"no-new-object": "error",
"no-new-wrappers": "error",
"no-octal-escape": "error",
🤖 Prompt for AI Agents
In the .eslintrc.json file between lines 88 and 112, replace the deprecated
ESLint rule "no-native-reassign" with "no-global-assign" to avoid configuration
errors. Verify that the ESLint version used in CI supports the
"no-global-assign" rule to prevent linter failures. Remove "no-native-reassign"
entirely and add "no-global-assign" with the appropriate error level.

"no-process-exit": "error",
"no-proto": "error",
"no-return-assign": "error",
"no-script-url": "error",
"no-sequences": "error",
"no-shadow-restricted-names": "error",
"no-spaced-func": "error",
"no-trailing-spaces": "error",
"no-undef-init": "error",
"no-undefined": "error",
"no-unused-expressions": "error",
"no-unused-vars": [
"error",
{
"vars": "all",
"args": "none"
}
],
"no-with": "error",
"object-curly-spacing": [
"error",
"never"
],
"one-var": [
"error",
"never"
],
"quote-props": [
"error",
"consistent-as-needed"
],
"quotes": [
"error",
"single",
"avoid-escape"
],
"semi": [
"error",
"always"
],
"semi-spacing": [
"error",
{
"before": false,
"after": true
}
],
"space-before-blocks": [
"error",
"always"
],
"space-before-function-paren": [
"error",
{
"anonymous": "always",
"named": "never"
}
],
"space-in-parens": [
"error",
"never"
],
"space-infix-ops": "error",
"space-unary-ops": [
"error",
{
"words": true,
"nonwords": false
}
],
"spaced-comment": [
"error",
"always"
],
"strict": [
"error",
"function"
],
"yoda": [
"error",
"never"
],
"max-nested-callbacks": [
"warn",
5
],
"valid-jsdoc": [
"warn",
{
"prefer": {
"returns": "return",
"property": "prop"
},
"requireReturn": false
}
]
}
}
9 changes: 7 additions & 2 deletions .github/workflows/build-test-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -251,8 +251,9 @@ jobs:
docker compose exec $(env | cut -f1 -d= | sed 's/^/-e /') -T cli bash -c " \
if [ -n \"${GITHUB_TOKEN:-}\" ]; then export COMPOSER_AUTH='{\"github-oauth\": {\"github.com\": \"${GITHUB_TOKEN-}\"}}'; fi && \
COMPOSER_MEMORY_LIMIT=-1 composer --ansi install --prefer-dist"
docker compose exec $(env | cut -f1 -d= | sed 's/^/-e /') -T cli bash -c "yarn install --frozen-lockfile"

Comment on lines +254 to 255

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick (assertive)

Missing dependency caching for Yarn install

yarn install --frozen-lockfile will download the full npm registry every run.
Add a actions/cache step (similar to Composer) keyed on yarn.lock to cut CI time drastically and avoid rate-limiting.

🤖 Prompt for AI Agents
In .github/workflows/build-test-deploy.yml around lines 254 to 255, the workflow
runs `yarn install --frozen-lockfile` without caching dependencies, causing
repeated full downloads and slower CI. Add an `actions/cache` step before this
command that caches the Yarn cache directory, using `yarn.lock` as the cache
key, to speed up installs and reduce network usage.

- name: Validate Composer configuration normalized
- name: Validate Composer configuration is normalized
run: docker compose exec -T cli composer normalize --dry-run
continue-on-error: ${{ vars.VORTEX_CI_COMPOSER_NORMALIZE_IGNORE_FAILURE == '1' }}

Expand Down Expand Up @@ -280,8 +281,12 @@ jobs:
run: docker compose exec -T cli vendor/bin/gherkinlint lint tests/behat/features
continue-on-error: ${{ vars.VORTEX_CI_GHERKIN_LINT_IGNORE_FAILURE == '1' }}

- name: Lint module code with NodeJS linters
run: docker compose exec -T cli bash -c "yarn run lint"
continue-on-error: ${{ vars.VORTEX_CI_NODEJS_LINT_IGNORE_FAILURE == '1' }}

#;< DRUPAL_THEME
- name: Lint code with NodeJS linters
- name: Lint theme code with NodeJS linters
run: docker compose exec -T cli bash -c "yarn --cwd=\${WEBROOT}/themes/custom/\${DRUPAL_THEME} run lint"
continue-on-error: ${{ vars.VORTEX_CI_NODEJS_LINT_IGNORE_FAILURE == '1' }}
#;> DRUPAL_THEME
Comment on lines +284 to 292

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Theme lint step runs without installing its dependencies

You run yarn run lint for the root package.json (good) but call the theme linter straight away:

yarn --cwd=${WEBROOT}/themes/custom/${DRUPAL_THEME} run lint

Unless the theme has already executed yarn install, this will fail or perform an ad-hoc, non-cached install.
Insert a dedicated install step first (mirrors the module install):

+      - name: Install NodeJS deps for theme
+        run: docker compose exec -T cli bash -c "yarn --cwd=\${WEBROOT}/themes/custom/\${DRUPAL_THEME} install --frozen-lockfile"
+
       - name: Lint theme code with NodeJS linters
🤖 Prompt for AI Agents
In .github/workflows/build-test-deploy.yml around lines 284 to 292, the theme
lint step runs the linter without first installing the theme's dependencies,
which can cause failures or inefficient installs. Add a step before the theme
lint step to run `yarn install` in the theme directory using `yarn
--cwd=${WEBROOT}/themes/custom/${DRUPAL_THEME} install` to ensure dependencies
are installed before linting.

Expand Down
39 changes: 39 additions & 0 deletions .stylelintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
module.exports = {
extends: [
'stylelint-config-standard'
],
plugins: [
'stylelint-order'
],
rules: {
'order/properties-alphabetical-order': true,
'at-rule-no-unknown': [
true,
{
ignoreAtRules: [
'extend',
'at-root',
'debug',
'warn',
'error',
'if',
'else',
'for',
'each',
'while',
'include',
'mixin',
'function',
'return',
'content'
]
}
],
'selector-class-pattern': null,
'selector-id-pattern': null,
'custom-property-pattern': null,
'keyframes-name-pattern': null,
'no-descending-specificity': null,
'font-family-no-missing-generic-family-keyword': null
}
};
1 change: 1 addition & 0 deletions .vortex/docs/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
module.exports = {
root: true,
env: {
browser: true,
es2021: true,
Expand Down
Loading