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

🎸 feat: accesibility のツールの導入 #357

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
11 changes: 11 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import pluginJs from '@eslint/js'
import eslintConfigPrettier from 'eslint-config-prettier'
import pluginVue from 'eslint-plugin-vue'
import pluginVueA11y from 'eslint-plugin-vuejs-accessibility'
import globals from 'globals'
import tseslint from 'typescript-eslint'

Expand Down Expand Up @@ -31,5 +32,15 @@ export default [
'vue/require-default-prop': 'off'
}
},
...pluginVueA11y.configs["flat/recommended"],
{
"rules": {
"vuejs-accessibility/label-has-for": ["error", {
"required": {
"some": ["nesting", "id"]
}
}]
},
},
eslintConfigPrettier
]
121 changes: 121 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,13 @@
"@vue/eslint-config-prettier": "^10.1.0",
"@vue/eslint-config-typescript": "^14.1.4",
"autoprefixer": "^10.4.20",
"axe-core": "^4.10.2",
"eslint": "^9.14.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-import": "^2.31.0",
"eslint-plugin-unused-imports": "^4.1.4",
"eslint-plugin-vue": "^9.30.0",
"eslint-plugin-vuejs-accessibility": "^2.4.1",
"esno": "^4.8.0",
"execa": "^9.5.1",
"globals": "^15.12.0",
Expand All @@ -58,6 +60,7 @@
"typescript": "^5.6.3",
"typescript-eslint": "^8.12.2",
"vite": "^5.4.10",
"vue-axe": "^3.1.2",
"vue-tsc": "^2.1.10"
},
"msw": {
Expand Down
18 changes: 10 additions & 8 deletions public/mockServiceWorker.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
* - Please do NOT serve this file on production.
*/

const PACKAGE_VERSION = '2.6.1'
const INTEGRITY_CHECKSUM = '07a8241b182f8a246a7cd39894799a9e'
const PACKAGE_VERSION = '2.6.6'
const INTEGRITY_CHECKSUM = 'ca7800994cc8bfb5eb961e037c877074'
const IS_MOCKED_RESPONSE = Symbol('isMockedResponse')
const activeClientIds = new Set()

Expand Down Expand Up @@ -192,12 +192,14 @@ async function getResponse(event, client, requestId) {
const requestClone = request.clone()

function passthrough() {
const headers = Object.fromEntries(requestClone.headers.entries())

// Remove internal MSW request header so the passthrough request
// complies with any potential CORS preflight checks on the server.
// Some servers forbid unknown request headers.
delete headers['x-msw-intention']
// Cast the request headers to a new Headers instance
// so the headers can be manipulated with.
const headers = new Headers(requestClone.headers)

// Remove the "accept" header value that marked this request as passthrough.
// This prevents request alteration and also keeps it compliant with the
// user-defined CORS policies.
headers.delete('accept', 'msw/passthrough')

return fetch(requestClone, { headers })
}
Expand Down
2 changes: 2 additions & 0 deletions src/env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@ declare module '*.vue' {
}

declare const _APP_VERSION: string

declare module 'vue-axe'
19 changes: 16 additions & 3 deletions src/main.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { createPinia } from 'pinia'
import { createApp } from 'vue'
import { Fragment, createApp, h } from 'vue'
import type { PluginOptions } from 'vue-toastification'
import Toast, { POSITION } from 'vue-toastification'
import 'vue-toastification/dist/index.css'
Expand All @@ -11,7 +11,20 @@ import router from './router'

initMock()

const app = createApp(App)
const setup = async () => {
if (import.meta.env.NODE_DEV === 'production') {
return createApp(App)
}

// NOTE: 開発環境では vue-axe を読み込む
const VueAxe = await import('vue-axe')
const app = createApp({
render: () => h(Fragment, [h(App), h(VueAxe.VueAxePopup)])
})
app.use(VueAxe.default)

return app
}

const options: PluginOptions = {
position: POSITION.BOTTOM_LEFT,
Expand All @@ -22,4 +35,4 @@ const options: PluginOptions = {
hideProgressBar: true
}

app.use(router).use(createPinia()).use(Toast, options).mount('#app')
setup().then((app) => app.use(router).use(createPinia()).use(Toast, options).mount('#app'))
7 changes: 5 additions & 2 deletions vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import vue from '@vitejs/plugin-vue'
import * as https from 'https'
import * as path from 'path'
import vue from '@vitejs/plugin-vue'
import brotli from 'rollup-plugin-brotli'
import { defineConfig } from 'vite'

Expand All @@ -23,5 +23,8 @@ export default defineConfig({
agent: keepAliveAgent
}
}
}
},
optimizeDeps: {
include: ["axe-core"],
},
})
Loading