diff --git a/.lando.dist.yml b/.lando.dist.yml index 9c46dad..83e1125 100644 --- a/.lando.dist.yml +++ b/.lando.dist.yml @@ -115,3 +115,15 @@ tooling: update-solr-config: service: appserver cmd: /app/.lando/update-solr-config.sh + install-frontend: + service: node + cmd: cd /app/web/core && cp -f /app/web/core/.prettierrc.json /app/web/.prettierrc.json && cp -f /app/web/core/.prettierignore /app/.prettierignore && npm i + eslint-js: + service: node + cmd: /app/web/core/node_modules/eslint/bin/eslint.js --ext .js --resolve-plugins-relative-to=./web/core + eslint-yml: + service: node + cmd: /app/web/core/node_modules/eslint/bin/eslint.js --ext .yml --resolve-plugins-relative-to=./web/core + stylelint: + service: node + cmd: /app/web/core/node_modules/.bin/stylelint --ignore-path /app/web/core/.stylelintignore --config /app/web/core/.stylelintrc.json diff --git a/README_FRONTEND_TOOLING.md b/README_FRONTEND_TOOLING.md new file mode 100644 index 0000000..fb2db87 --- /dev/null +++ b/README_FRONTEND_TOOLING.md @@ -0,0 +1,73 @@ +# LocalGov Drupal Frontend Tooling + +Below details the steps required to run the frontend tooling such as ESLint and Stylelint via Lando or DDEV. + +## Prerequisites + +Run the following command to install the frontend dependencies. + +This installs Drupal Core's frontend packages and copies the Prettier config to the correct directory for tooling. + +```bash +lando install-frontend +``` + +## ESLint (Javascript) Usage + +Run: + +```bash +lando eslint-js web/modules/contrib/[project_name] +``` + +E.g. + +```bash +lando eslint-js web/modules/contrib/localgov_core +``` + +If you wish to fix some of the issues automatically, this can be run with the following: + +```bash +lando eslint-js --fix web/modules/contrib/[project_name] +``` + +## ESLint (Yaml) Usage + +Run: + +```bash +lando eslint-yml web/modules/contrib/[project_name] +``` + +E.g. + +```bash +lando eslint-yml web/modules/contrib/localgov_core +``` + +If you wish to fix some of the issues automatically, this can be run with the following: + +```bash +lando eslint-yml --fix web/modules/contrib/[project_name] +``` + +## Stylelint (CSS) Usage + +Run: + +```bash +lando stylelint web/modules/contrib/[project_name]/**/*.css +``` + +E.g. + +```bash +lando stylelint web/modules/contrib/localgov_base/**/*.css +``` + +If you wish to fix some of the issues automatically, this can be run with the following: + +```bash +lando stylelint --fix web/modules/contrib/[project_name]/**/*.css +```