ESLINT: Added GH action and details to dev docs
This commit is contained in:
parent
da3ae3ba8b
commit
974390688d
2 changed files with 33 additions and 1 deletions
16
.github/workflows/lint-js.yml
vendored
Normal file
16
.github/workflows/lint-js.yml
vendored
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
name: lint-js
|
||||||
|
|
||||||
|
on: [push, pull_request]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
if: ${{ github.ref != 'refs/heads/l10n_development' }}
|
||||||
|
runs-on: ubuntu-22.04
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v1
|
||||||
|
|
||||||
|
- name: Install NPM deps
|
||||||
|
run: npm ci
|
||||||
|
|
||||||
|
- name: Run formatting check
|
||||||
|
run: npm run lint
|
|
@ -33,6 +33,10 @@ If the codebase needs to be tested with deprecations, this can be done via uncom
|
||||||
|
|
||||||
## Code Standards
|
## Code Standards
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
### PHP
|
||||||
|
|
||||||
PHP code standards are managed by [using PHP_CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer).
|
PHP code standards are managed by [using PHP_CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer).
|
||||||
Static analysis is in place using [PHPStan](https://phpstan.org/) & [Larastan](https://github.com/nunomaduro/larastan).
|
Static analysis is in place using [PHPStan](https://phpstan.org/) & [Larastan](https://github.com/nunomaduro/larastan).
|
||||||
The below commands can be used to utilise these tools:
|
The below commands can be used to utilise these tools:
|
||||||
|
@ -51,7 +55,19 @@ composer format
|
||||||
composer check-static
|
composer check-static
|
||||||
```
|
```
|
||||||
|
|
||||||
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.
|
### JavaScript
|
||||||
|
|
||||||
|
JavaScript code standards use managed using [ESLint](https://eslint.org/).
|
||||||
|
The ESLint rule configuration is managed within the `package.json` file.
|
||||||
|
The below commands can be used to lint and format:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Run code linting using ESLint
|
||||||
|
npm run lint
|
||||||
|
|
||||||
|
# Fix code where possible using ESLint
|
||||||
|
npm run fix
|
||||||
|
```
|
||||||
|
|
||||||
## Development using Docker
|
## Development using Docker
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue