Files
bookorbit/client/eslint.config.ts
neon fdbdc8c990 feat(library): rebuild the browse header as a title row and one command bar
Library, smart scope, collection, authors and series pages share a new
BrowseHeader: the place and its actions on one row, then search, sort,
filters and facets in one bar that folds groups instead of wrapping.
Format chips count from the new POST /libraries/:id/books/facets, built
on the listing's own query; scopes and collections gain filter and sort.
2026-10-16 06:08:13 +00:00

92 lines
3.5 KiB
TypeScript

import { globalIgnores } from 'eslint/config'
import { defineConfigWithVueTs, vueTsConfigs } from '@vue/eslint-config-typescript'
import pluginVue from 'eslint-plugin-vue'
import pluginVitest from '@vitest/eslint-plugin'
import pluginOxlint from 'eslint-plugin-oxlint'
import skipFormatting from 'eslint-config-prettier/flat'
// To allow more languages other than `ts` in `.vue` files, uncomment the following lines:
// import { configureVueProject } from '@vue/eslint-config-typescript'
// configureVueProject({ scriptLangs: ['ts', 'tsx'] })
// More info at https://github.com/vuejs/eslint-config-typescript/#advanced-setup
export default defineConfigWithVueTs(
{
name: 'app/files-to-lint',
files: ['**/*.{vue,ts,mts,tsx}'],
},
globalIgnores(['**/dist/**', '**/dist-ssr/**', '**/coverage/**', 'public/**', '**/dev-dist/**']),
...pluginVue.configs['flat/essential'],
vueTsConfigs.recommended,
{
...pluginVitest.configs.recommended,
// Specs are colocated as `*.spec.ts`; `__tests__/` remains only in features not yet converted.
files: ['src/**/__tests__/*', 'src/**/*.spec.ts', 'src/**/*.test.ts'],
},
// Named handlers only: an inline arrow in a template cannot be named, reused or tested, and the
// podcast feature was swept clean of them. The rest of the app still carries several hundred, so
// widening this is its own task rather than a side effect of one feature's refactor.
{
files: [
'src/features/podcast/**/*.vue',
'src/components/FormSheet.vue',
'src/features/collection/components/CollectionMembershipList.vue',
'src/features/book/components/metadata-match/*.vue',
'src/components/browse-header/*.vue',
],
rules: { 'vue/v-on-handler-style': ['error', ['method', 'inline']] },
},
{
files: ['src/components/ui/**/*.vue'],
rules: {
'vue/multi-word-component-names': 'off',
},
},
{
files: ['src/**/*.{vue,ts,mts,tsx}'],
ignores: ['src/lib/clipboard.ts'],
rules: {
'no-restricted-syntax': [
'error',
{
selector:
"MemberExpression[property.name='clipboard'][object.name='navigator'], MemberExpression[property.value='clipboard'][object.name='navigator'], MemberExpression[property.name='clipboard'][object.property.name='navigator'], MemberExpression[property.value='clipboard'][object.property.name='navigator']",
message: "Use copyToClipboard from '@/lib/clipboard' so copy actions work on HTTP/self-hosted origins.",
},
{
selector:
"CallExpression[callee.property.name='execCommand'][arguments.0.value='copy'], CallExpression[callee.property.value='execCommand'][arguments.0.value='copy']",
message: "Use copyToClipboard from '@/lib/clipboard' instead of adding another copy fallback.",
},
],
},
},
// randomUUID exists only in secure contexts, so a self-hosted install opened over plain HTTP throws
// on the first call. A separate rule from the one above, because a second no-restricted-syntax
// block would replace that block's options rather than add to them.
{
files: ['src/**/*.{vue,ts,mts,tsx}'],
ignores: ['src/lib/uuid.ts', 'src/**/__tests__/*', 'src/**/*.spec.ts', 'src/**/*.test.ts'],
rules: {
'no-restricted-properties': [
'error',
{
property: 'randomUUID',
message: "Use createUuid from '@/lib/uuid' so IDs can be created on HTTP/self-hosted origins.",
},
],
},
},
...pluginOxlint.buildFromOxlintConfigFile('.oxlintrc.json'),
skipFormatting,
)