Skip to content

Commit 9743906

Browse files
committed
ESLINT: Added GH action and details to dev docs
1 parent da3ae3b commit 9743906

2 files changed

Lines changed: 33 additions & 1 deletion

File tree

.github/workflows/lint-js.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: lint-js
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
build:
7+
if: ${{ github.ref != 'refs/heads/l10n_development' }}
8+
runs-on: ubuntu-22.04
9+
steps:
10+
- uses: actions/checkout@v1
11+
12+
- name: Install NPM deps
13+
run: npm ci
14+
15+
- name: Run formatting check
16+
run: npm run lint

dev/docs/development.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ If the codebase needs to be tested with deprecations, this can be done via uncom
3333

3434
## Code Standards
3535

36+
We use tools to manage code standards and formatting within the project. If submitting a PR, formatting as per our project standards would help for clarity but don't worry too much about using/understanding these tools as we can always address issues at a later stage when they're picked up by our automated tools.
37+
38+
### PHP
39+
3640
PHP code standards are managed by [using PHP_CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer).
3741
Static analysis is in place using [PHPStan](https://phpstan.org/) & [Larastan](https://github.com/nunomaduro/larastan).
3842
The below commands can be used to utilise these tools:
@@ -51,7 +55,19 @@ composer format
5155
composer check-static
5256
```
5357

54-
If submitting a PR, formatting as per our project standards would help for clarity but don't worry too much about using/understanding these tools as we can always address issues at a later stage when they're picked up by our automated tools.
58+
### JavaScript
59+
60+
JavaScript code standards use managed using [ESLint](https://eslint.org/).
61+
The ESLint rule configuration is managed within the `package.json` file.
62+
The below commands can be used to lint and format:
63+
64+
```bash
65+
# Run code linting using ESLint
66+
npm run lint
67+
68+
# Fix code where possible using ESLint
69+
npm run fix
70+
```
5571

5672
## Development using Docker
5773

0 commit comments

Comments
 (0)