Skip to content

Commit

Permalink
improve accessibility tests and add playground
Browse files Browse the repository at this point in the history
  • Loading branch information
VachetVirginie committed Jul 24, 2024
1 parent 387c819 commit 9e5ed84
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 10 deletions.
60 changes: 51 additions & 9 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,51 @@
export default [
{
rules: {
'vue/html-self-closing': 'off',
'vue/multi-word-component-names': 'off',
'@typescript-eslint/no-explicit-any': 'off',
},
},
]
import a11y from 'eslint-plugin-vuejs-accessibility';
import antfu from '@antfu/eslint-config';

export default antfu({
plugins: {
'vuejs-accessibility': a11y,
},
ignores: [
'src/elements/Logo/*',
'src/elements/CustomIcon/mixins/themeIcon.ts',
'src/assets/locales/*.json',
'src/assets/locales/*.json/**',
'public/**/*',
],
rules: {
...a11y.configs.recommended.rules,
'ts/semi': 'off',
'curly': ['error', 'all'],
'no-console': 'error',
'no-alert': 'off',
'no-shadow': 'off',
'vue/custom-event-name-casing': 'off',
'vue/html-self-closing': 'off',
'vue/no-template-shadow': 'off',
'@typescript-eslint/no-shadow': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'style/max-len': ['error', { code: 160, tabWidth: 4 }],
'style/semi': ['error', 'always'],
'style/indent': 'off',
'style/quotes': ['error', 'single'],
'style/no-tabs': 'off',
'vuejs-accessibility/no-aria-hidden-on-focusable':'error',
'vuejs-accessibility/no-onchange': 'error',
'vuejs-accessibility/no-role-presentation-on-focusable': 'error',
},
}, {
ignores: ['public/**/*'],
}, {
files: ['**/*.json', '**/*.md', '**/*.spec.ts'],
ignores: ['public/**/*.json'],
rules: {
'style/max-len': ['error', { code: 600, tabWidth: 4 }],
},

}, {
files: ['src/elements/FranceConnectBtn/FranceConnectBtn.vue', 'src/elements/FilePreview/FilePreview.vue'],
rules: {
'style/max-len': 'off',
},

});
21 changes: 20 additions & 1 deletion packages/synapse-bridge/eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,30 @@ export default antfu({
'vue/no-template-shadow': 'off',
'@typescript-eslint/no-shadow': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'style/max-len': ['error', { code: 120, tabWidth: 4 }],
'style/max-len': ['error', { code: 160, tabWidth: 4 }],
'style/semi': ['error', 'always'],
'style/indent': 'off',
'style/quotes': ['error', 'single'],
'style/no-tabs': 'off',
'vuejs-accessibility/alt-text': 'error', // Enforce alt text on images
'vuejs-accessibility/anchor-has-content': 'error', // Ensure anchors have content
'vuejs-accessibility/aria-props': 'error', // Enforce all aria-* props are valid
'vuejs-accessibility/aria-role': 'error', // Enforce ARIA state and property values are correct
'vuejs-accessibility/aria-unsupported-elements': 'error', // Enforce that elements with ARIA roles must use a valid, non-abstract ARIA role
'vuejs-accessibility/click-events-have-key-events': 'error', // Enforce a clickable non-interactive element has at least one keyboard event listener
'vuejs-accessibility/heading-has-content': 'error', // Ensure heading elements have content and are not aria-hidden
'vuejs-accessibility/iframe-has-title': 'error', // Ensure iframe elements have a title attribute
'vuejs-accessibility/interactive-supports-focus': 'error', // Ensure interactive elements are focusable
'vuejs-accessibility/media-has-caption': 'error', // Enforce media elements like <audio> and <video> have captions
'vuejs-accessibility/mouse-events-have-key-events': 'error', // Ensure mouse events are accompanied by keyboard events
'vuejs-accessibility/no-access-key': 'error', // Enforce no access key attribute
'vuejs-accessibility/no-autofocus': 'error', // Enforce no autoFocus attribute
'vuejs-accessibility/no-distracting-elements': 'error', // Enforce no distracting elements like <marquee> and <blink>
'vuejs-accessibility/no-redundant-roles': 'error', // Enforce explicit roles are not redundant
'vuejs-accessibility/no-static-element-interactions': 'error', // Ensure static elements have no interactive handlers
'vuejs-accessibility/role-has-required-aria-props': 'error', // Ensure elements with ARIA roles have all required properties
'vuejs-accessibility/tabindex-no-positive': 'error', // Ensure tabindex is not positive
'vuejs-accessibility/no-onchange': 'error', // Discourage usage of onChange, recommend using onBlur instead
},
}, {
ignores: ['public/**/*'],
Expand Down

0 comments on commit 9e5ed84

Please sign in to comment.