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
3 changes: 3 additions & 0 deletions .docker/database.dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# check=skip=SecretsUsedInArgOrEnv
# Database container.
#
# The check skipped above is BuildKit's twin of DL3064, ignored inline below.
#
# @see https://hub.docker.com/r/uselagoon/mysql-8.4/tags
# @see https://github.com/uselagoon/lagoon-images/tree/main/images/mysql
#
Expand Down
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ indent_size = 4
[*.xml]
indent_size = 4

[.eslintrc.json]
[eslint.config.mjs]
indent_size = 2

[.prettierrc.json]
Expand Down
10 changes: 0 additions & 10 deletions .eslintignore

This file was deleted.

84 changes: 0 additions & 84 deletions .eslintrc.json

This file was deleted.

5 changes: 2 additions & 3 deletions .gitignore.artifact
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ web/sites/simpletest
/.docker
/.dockerignore
/.editorconfig
/.eslintignore
/.eslintrc.json
/.gitattributes
/.github
/.gitignore.artifact
Expand All @@ -45,6 +43,7 @@ web/sites/simpletest
/AGENTS.md
/CLAUDE.md
/docker-compose.yml
/eslint.config.mjs
/renovate.json

#;< CI_PROVIDER_GHA
Expand Down Expand Up @@ -87,7 +86,7 @@ web/sites/simpletest
web/themes/**/node_modules

# Custom theme asset sources - only compiled assets in 'build' are deployed.
web/themes/custom/your_site_theme/.eslintrc.json
web/themes/custom/your_site_theme/eslint.config.mjs
web/themes/custom/your_site_theme/fonts
web/themes/custom/your_site_theme/images
web/themes/custom/your_site_theme/js
Expand Down
1 change: 1 addition & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"plugins": ["@homer0/prettier-plugin-jsdoc"],
"jsdocPrintWidth": 80,
"jsdocReplaceTagsSynonyms": false,
"jsdocUseTypeScriptTypesCasing": false,
"overrides": [
{
"files": ["*.css"],
Expand Down
42 changes: 0 additions & 42 deletions .vortex/docs/.eslintrc.js

This file was deleted.

51 changes: 31 additions & 20 deletions .vortex/docs/content/development/code-quality/eslint.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ sidebar_label: ESLint

> ESLint is a tool for identifying and reporting on patterns found in ECMAScript/JavaScript code, with the goal of making code more consistent and avoiding bugs.

**Vortex** comes with [pre-configured ESLint ruleset](https://github.com/drevops/vortex/blob/main/.eslintrc.json) for Drupal projects, along with [Prettier](https://prettier.io/) integration for automatic code formatting.
**Vortex** comes with [pre-configured ESLint ruleset](https://github.com/drevops/vortex/blob/main/eslint.config.mjs) for Drupal projects, along with [Prettier](https://prettier.io/) integration for automatic code formatting.

:::info
ESLint in **Vortex** is configured to lint **custom modules only** (`web/modules/custom`). Custom themes should maintain their own ESLint configuration within the theme directory.
Expand Down Expand Up @@ -63,13 +63,20 @@ Prettier integration reformats the code at the same time.

See [configuration reference](https://eslint.org/docs/latest/use/configure/).

All global configuration takes place in the [`.eslintrc.json`](https://github.com/drevops/vortex/blob/main/.eslintrc.json) file.
All global configuration takes place in the [`eslint.config.mjs`](https://github.com/drevops/vortex/blob/main/eslint.config.mjs) file.

By default, ESLint will check against the following rules:

- `airbnb-base` - Airbnb's base JavaScript style guide
- `plugin:prettier/recommended` - Prettier integration for code formatting
- `plugin:yml/recommended` - YAML file linting
- `@eslint/js` recommended - the rules ESLint itself ships
- `eslint-plugin-import` recommended - module resolution and import order
- `eslint-plugin-jsdoc` recommended - documentation block correctness
- `eslint-plugin-prettier` recommended - Prettier integration for code formatting
- `eslint-plugin-yml` recommended - YAML file linting
- `eslint-plugin-no-jquery` - the full rule set, discouraging jQuery where the
browser has an equivalent

The configuration follows the one Drupal core adopts for its own JavaScript, so
the two stay comparable as core evolves.

The configuration includes Drupal-specific globals:

Expand All @@ -84,7 +91,7 @@ warnings fail the check too:
```json
{
"scripts": {
"lint-js": "eslint web/modules/custom --ext .js --max-warnings=0 --no-error-on-unmatched-pattern"
"lint-js": "eslint web/modules/custom --max-warnings=0 --no-error-on-unmatched-pattern"
}
}
```
Expand All @@ -94,7 +101,7 @@ Adding or removing targets in `package.json`:
```json
{
"scripts": {
"lint-js": "eslint web/modules/custom web/sites/default --ext .js --max-warnings=0 --no-error-on-unmatched-pattern"
"lint-js": "eslint web/modules/custom web/sites/default --max-warnings=0 --no-error-on-unmatched-pattern"
}
}
```
Expand All @@ -117,19 +124,23 @@ The custom theme ships a second `.prettierrc.json` with the same settings, becau

### Global ignoring

Ignoring paths **globally** takes place in the [`.eslintignore`](https://github.com/drevops/vortex/blob/main/.eslintignore) file:

```text
node_modules/
vendor/
web/core/
web/libraries/
web/modules/contrib/
web/profiles/contrib/
web/themes/contrib/
web/sites/*/files/
*.min.js
*.min.css
Ignoring paths **globally** takes place in the `ignores` entry of the [`eslint.config.mjs`](https://github.com/drevops/vortex/blob/main/eslint.config.mjs) file:

```js
{
ignores: [
'node_modules/**/*',
'vendor/**/*',
'web/core/**/*',
'web/libraries/**/*',
'web/modules/contrib/**/*',
'web/profiles/contrib/**/*',
'web/themes/contrib/**/*',
'web/sites/*/files/**/*',
'**/build/**/*',
'**/*.min.js',
],
}
```

### Inline ignoring
Expand Down
6 changes: 3 additions & 3 deletions .vortex/docs/content/development/testing/jest.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,9 @@ jest.useRealTimers();

### ESLint compatibility

The `.eslintrc.json` includes an override for `*.test.js` files that enables
the `jest` environment and allows `global-require`. No additional ESLint
configuration is needed for test files.
The `eslint.config.mjs` includes an override for `*.test.js` files that adds the
Jest globals and relaxes the nesting limit that test suites routinely exceed. No
additional ESLint configuration is needed for test files.

### Boilerplate

Expand Down
43 changes: 43 additions & 0 deletions .vortex/docs/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// The documentation site is a React application rather than Drupal front-end
// code, so it carries its own rules. It shares the flat config format with the
// template because a config at the repository root is otherwise picked up here.
import { defineConfig } from 'eslint/config';
import js from '@eslint/js';
import react from 'eslint-plugin-react';
import reactHooks from 'eslint-plugin-react-hooks';
import globals from 'globals';

export default defineConfig(
{
ignores: ['node_modules/**/*', 'build/**/*', '.docusaurus/**/*', 'coverage/**/*'],
},
js.configs.recommended,
react.configs.flat.recommended,
reactHooks.configs.flat.recommended,
{
languageOptions: {
ecmaVersion: 12,
sourceType: 'module',
parserOptions: {
ecmaFeatures: { jsx: true },
},
globals: {
...globals.browser,
...globals.node,
...globals.jest,
},
},
settings: {
react: { version: 'detect' },
},
rules: {
'react/react-in-jsx-scope': 'off',
'react/prop-types': 'off',
'no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
'prefer-const': 'error',
'no-var': 'error',
curly: ['error', 'all'],
'brace-style': ['error', '1tbs', { allowSingleLine: false }],
},
},
);
8 changes: 5 additions & 3 deletions .vortex/docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,11 @@
"@testing-library/user-event": "^14.0.0",
"babel-jest": "^29.7.0",
"cspell": "^8.6.1",
"eslint": "^8.0.0",
"eslint-plugin-react": "^7.0.0",
"eslint-plugin-react-hooks": "^4.0.0",
"@eslint/js": "^9.39.4",
"eslint": "^9.39.4",
"eslint-plugin-react": "^7.37.5",
"eslint-plugin-react-hooks": "^7.1.1",
"globals": "^16.5.0",
"identity-obj-proxy": "^3.0.0",
"jest": "^29.0.0",
"jest-environment-jsdom": "^29.0.0",
Expand Down
2 changes: 1 addition & 1 deletion .vortex/docs/src/pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ function fallbackCopy(text) {

try {
ok = document.execCommand('copy');
} catch (e) {
} catch {
ok = false;
}

Expand Down
Loading