Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] feat: add frontend tooling #184

Draft
wants to merge 3 commits into
base: 3.x
Choose a base branch
from
Draft
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
12 changes: 12 additions & 0 deletions .lando.dist.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
73 changes: 73 additions & 0 deletions README_FRONTEND_TOOLING.md
Original file line number Diff line number Diff line change
@@ -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
```
Loading