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

[TASK] Update eslint to v9 #810

Merged
merged 2 commits into from
Aug 1, 2024
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
13 changes: 0 additions & 13 deletions .eslintrc.js

This file was deleted.

12 changes: 6 additions & 6 deletions .github/workflows/cgl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'yarn'
cache: 'npm'

# Validation
- name: Validate composer.json
Expand All @@ -37,31 +37,31 @@ jobs:
- name: Install Composer dependencies
uses: ramsey/composer-install@v2
- name: Install node modules
run: yarn --frozen-lockfile
run: npm ci

# Audit packages
- name: Audit Composer dependencies
run: composer audit
- name: Audit Frontend dependencies
run: yarn audit
run: npm audit

# Check dependencies
- name: Check dependencies
run: composer-require-checker check
- name: Check for unused Composer dependencies
run: composer-unused --excludePackage=symfony/css-selector
- name: Check for unused Frontend dependencies
run: yarn check-dependencies
run: npm run check-dependencies

# Linting
- name: Lint composer.json
run: composer lint:composer
- name: Lint PHP
run: composer lint:php
- name: Lint CSS
run: yarn lint:css
run: npm run lint:css
- name: Lint JavaScript
run: yarn lint:js
run: npm run lint:js

# SCA
- name: SCA PHP
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,25 +31,25 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'yarn'
cache: 'npm'

# Install dependencies
- name: Install Composer dependencies
uses: ramsey/composer-install@v2
with:
composer-options: --no-dev --optimize-autoloader
- name: Install node modules
run: yarn --frozen-lockfile
run: npm ci

# Audit packages
- name: Audit Composer dependencies
run: composer audit
- name: Audit Frontend dependencies
run: yarn audit
run: npm audit

# Build Frontend
- name: Build Frontend dist files
run: yarn build
run: npm run build

# Deploy to production
- name: Deploy
Expand Down Expand Up @@ -86,19 +86,19 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v4
with:
cache: 'yarn'
cache: 'npm'

# Install dependencies
- name: Install Composer dependencies
uses: ramsey/composer-install@v2
with:
composer-options: --no-dev --optimize-autoloader
- name: Install node modules
run: yarn --frozen-lockfile
run: npm ci

# Build Frontend
- name: Build Frontend dist files
run: yarn build
run: npm run build

# Deploy to production
- name: Deploy
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,17 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'yarn'
cache: 'npm'

# Install dependencies
- name: Install Composer dependencies
uses: ramsey/composer-install@v2
- name: Install node modules
run: yarn --frozen-lockfile
run: npm ci

# Build Frontend assets (necessary for application tests)
- name: Build Frontend assets
run: yarn build
run: npm run build

# Run tests
- name: Build coverage directory
Expand Down
8 changes: 5 additions & 3 deletions assets/js/badge/codeTabs.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
* @license GPL-3.0-or-later
*/
export default class CodeTabs {
ARIA_SELECTED = 'aria-selected';

static observer;

static currentLanguage;
Expand All @@ -46,7 +48,7 @@ export default class CodeTabs {

// Observe all tab sync triggers
[...syncTriggers].forEach((trigger) => {
CodeTabs.observer.observe(trigger, { attributeFilter: ['aria-selected'] });
CodeTabs.observer.observe(trigger, { attributeFilter: [self.ARIA_SELECTED] });
});
}

Expand All @@ -68,8 +70,8 @@ export default class CodeTabs {

// Early return if mutation is unsupported
if (mutation.type !== 'attributes'
|| mutation.attributeName !== 'aria-selected'
|| target.getAttribute('aria-selected') !== 'true'
|| mutation.attributeName !== self.ARIA_SELECTED
|| target.getAttribute(self.ARIA_SELECTED) !== 'true'
) {
return;
}
Expand Down
2 changes: 1 addition & 1 deletion deploy.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@
'/.depcheckrc.json',
'/.editorconfig',
'/.env.test',
'/.eslintrc.js',
'/.gitattributes',
'/.gitignore',
'/.php-cs-fixer.dist.php',
'.stylelintrc.json',
'CODEOWNERS',
'deploy.php',
'eslint.config.js',
'phpstan.php',
'phpunit.xml',
'postcss.config.js',
Expand Down
19 changes: 19 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
const globals = require('globals');
const js = require('@eslint/js');
const sonarjs = require('eslint-plugin-sonarjs');

module.exports = [
js.configs.recommended,
sonarjs.configs.recommended,
{
languageOptions: {
globals: {
...globals.browser,
},
parserOptions: {
ecmaVersion: 13,
sourceType: 'module',
},
},
},
];
Loading
Loading