Skip to content

Commit

Permalink
added acccesibility workflow and packages
Browse files Browse the repository at this point in the history
  • Loading branch information
nitinawari committed Jan 18, 2025
1 parent cfcce45 commit db5e3da
Show file tree
Hide file tree
Showing 6 changed files with 325 additions and 18 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/ci-cd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,23 @@ jobs:
working-directory: frontend
run: npm run lint:check

- name: Run accessibility tests
working-directory: frontend
run: |
npm run test -- -t "accessibility"
- name: Generate accessibility report
working-directory: frontend
run: |
npm run test:a11y
continue-on-error: true

- name: Upload accessibility report
uses: actions/upload-artifact@v4
with:
name: accessibility-report
path: frontend/accessibility-report.json

- name: Check for uncommitted changes
run: |
git diff --exit-code || (echo 'Unstaged changes detected. \
Expand Down
18 changes: 18 additions & 0 deletions frontend/eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import typescriptParser from '@typescript-eslint/parser'
import prettierConfig from 'eslint-config-prettier'
import importPlugin from 'eslint-plugin-import'
import jest from 'eslint-plugin-jest'
import jsxA11y from 'eslint-plugin-jsx-a11y'
import prettier from 'eslint-plugin-prettier'
import react from 'eslint-plugin-react'
import reactHooks from 'eslint-plugin-react-hooks'
Expand Down Expand Up @@ -41,6 +42,7 @@ export default [
jest,
prettier,
react,
'jsx-a11y': jsxA11y,
},
settings: {
'import/resolver': {
Expand All @@ -59,6 +61,22 @@ export default [
rules: {
...jest.configs.recommended.rules,
...prettierConfig.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-unsupported-elements': 'error',
'jsx-a11y/role-has-required-aria-props': 'error',
'jsx-a11y/role-supports-aria-props': 'error',
'jsx-a11y/tabindex-no-positive': 'error',
'jsx-a11y/no-redundant-roles': 'error',
'jsx-a11y/label-has-associated-control': 'error',
'jsx-a11y/no-autofocus': 'warn',
'jsx-a11y/click-events-have-key-events': 'error',
'jsx-a11y/no-noninteractive-element-interactions': 'error',
'jsx-a11y/no-static-element-interactions': 'error',
'jsx-a11y/no-noninteractive-tabindex': 'error',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-explicit-any': 'warn',
Expand Down
1 change: 1 addition & 0 deletions frontend/jest.setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ global.React = React
global.TextEncoder = TextEncoder

beforeEach(() => {
window.scrollTo = jest.fn()
jest.spyOn(console, 'error').mockImplementation((...args) => {
throw new Error(`Console error: ${args.join(' ')}`)
})
Expand Down
Loading

0 comments on commit db5e3da

Please sign in to comment.