Skip to content
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
48 changes: 48 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: "(Lint): CSS, JS, PHP"

on:
pull_request:
types: [opened, synchronize, reopened, labeled]
push:
branches:
- 'core'
- 'pro'
paths-ignore:
- '**.md'
- '**.txt'
- '.gitignore'
- 'docs/**'
workflow_dispatch:

permissions:
contents: read

concurrency:
group: lint-${{ github.workflow }}-${{ github.event_name }}-${{ github.event_name == 'pull_request' && github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
lint:
name: stylelint, eslint, phpcs
runs-on: ubuntu-22.04
steps:
- name: Checkout source code
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version-file: .node-version
cache: 'npm'

- name: Install npm dependencies
run: npm ci

- name: Run Stylelint
run: npm run lint:styles

- name: Run ESLint
run: npm run lint:js

- name: Run PHP CS
run: npm run lint:php
Comment on lines +38 to +48
27 changes: 26 additions & 1 deletion eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import eslintTs from 'typescript-eslint'
import stylistic from '@stylistic/eslint-plugin'
import reactHooks from 'eslint-plugin-react-hooks'
import importPlugin from 'eslint-plugin-import'
import jsxA11yPlugin from 'eslint-plugin-jsx-a11y'
import reactPlugin from 'eslint-plugin-react'
import { FlatCompat } from '@eslint/eslintrc'

Expand All @@ -21,6 +22,7 @@ export default eslintTs.config(
...compat.extends('plugin:react-hooks/recommended'),
reactPlugin.configs.flat.recommended,
importPlugin.flatConfigs.recommended,
jsxA11yPlugin.flatConfigs.strict,
{
plugins: { 'react-hooks': reactHooks },
rules: reactHooks.configs.recommended.rules,
Expand Down Expand Up @@ -127,7 +129,30 @@ export default eslintTs.config(
'prefer-named-capture-group': 'error',
'prefer-template': 'error',
'sort-imports': ['error', { ignoreDeclarationSort: true }],
'yoda': ['error', 'always']
'yoda': ['error', 'always'],
// Accessibility rules.
'jsx-a11y/alt-text': 'error',
'jsx-a11y/anchor-has-content': 'error',
'jsx-a11y/anchor-is-valid': 'error',
'jsx-a11y/aria-props': 'error',
'jsx-a11y/aria-proptypes': 'error',
'jsx-a11y/aria-role': 'error',
'jsx-a11y/aria-unsupported-elements': 'error',
'jsx-a11y/click-events-have-key-events': 'error',
'jsx-a11y/control-has-associated-label': 'error',
'jsx-a11y/heading-has-content': 'error',
'jsx-a11y/iframe-has-title': 'error',
'jsx-a11y/img-redundant-alt': 'error',
'jsx-a11y/interactive-supports-focus': 'error',
'jsx-a11y/label-has-associated-control': 'error',
'jsx-a11y/no-autofocus': 'error',
'jsx-a11y/no-noninteractive-element-interactions': 'error',
'jsx-a11y/no-noninteractive-tabindex': 'error',
'jsx-a11y/no-redundant-roles': 'error',
'jsx-a11y/no-static-element-interactions': 'error',
'jsx-a11y/role-has-required-aria-props': 'error',
'jsx-a11y/role-supports-aria-props': 'error',
'jsx-a11y/tabindex-no-positive': 'error'
}
},
{
Expand Down
Loading
Loading