Skip to content

Commit

Permalink
lint: adapt new ESLint config
Browse files Browse the repository at this point in the history
  • Loading branch information
Tony Jiang committed Jul 8, 2024
1 parent 1736603 commit 8b7eda6
Show file tree
Hide file tree
Showing 19 changed files with 1,589 additions and 1,957 deletions.
8 changes: 6 additions & 2 deletions docs/.vitepress/plugins/externalLinkIcon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const externalIcon = `
`


const externalLinkIcon = (md: MarkdownIt): void => {
function externalLinkIcon(md: MarkdownIt): void {
const renderToken: RenderRule = (tokens, idx, options, env, self) =>
self.renderToken(tokens, idx, options)

Expand All @@ -31,7 +31,11 @@ const externalLinkIcon = (md: MarkdownIt): void => {
}

md.renderer.rules.link_close = (
tokens, idx, options, env, self,
tokens,
idx,
options,
env,
self,
): string => {
if (isExternalLink) {
isExternalLink = false
Expand Down
8 changes: 4 additions & 4 deletions docs/.vitepress/theme/Layout.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
<script setup lang="ts">
/* eslint-disable ts/restrict-template-expressions */
import { useData } from 'vitepress'
import DefaultTheme from 'vitepress/theme'
import { nextTick, provide } from 'vue'
Expand All @@ -9,8 +7,10 @@ import { nextTick, provide } from 'vue'
const { isDark } = useData()
const enableTransitions = (): boolean => 'startViewTransition' in document
&& window.matchMedia('(prefers-reduced-motion: no-preference)').matches
function enableTransitions(): boolean {
return 'startViewTransition' in document
&& window.matchMedia('(prefers-reduced-motion: no-preference)').matches
}
provide('toggle-appearance', async ({ clientX: x, clientY: y }: MouseEvent) => {
if (!enableTransitions()) {
Expand Down
7 changes: 1 addition & 6 deletions docs/.vitepress/theme/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,5 @@ import './style.scss'

export default {
'extends': DefaultTheme,
Layout: () => h(Layout, null, {
// https://vitepress.dev/guide/extending-default-theme#layout-slots
}),
enhanceApp({ app, router, siteData }) {
// ...
},
Layout: () => h(Layout, null, {}),
} satisfies Theme
23 changes: 3 additions & 20 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,5 @@
import defineConfig from '@aelita-dev/eslint-config'
import { bundleRequire } from 'bundle-require'


export default defineConfig(
{
typescript: {
tsconfigPath: ['./tsconfig.json', './tsconfig.node.js.json'],
projectType: 'lib',
},
vue: {
ruleOptions: {
multiWordComponentNames: { ignores: ['Layout'] },
},
},
},
{
files: ['docs/.vitepress/config.ts'],
rules: {
'ts/comma-dangle': ['error', 'always-multiline'],
},
},
)
export default await bundleRequire({ filepath: './eslintConfig.ts' })
.then(({ mod }) => mod.default)
16 changes: 16 additions & 0 deletions eslintConfig.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { defineConfig } from '@aelita-dev/eslint-config'


export default defineConfig(
{
typescript: {
tsconfigPath: ['./tsconfig.json', './tsconfig.node.js.json'],
projectType: 'lib',
},
vue: {
ruleOptions: {
multiWordComponentNames: { ignores: ['Layout'] },
},
},
},
)
8 changes: 7 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,23 @@
"docs:preview": "vitepress preview docs"
},
"devDependencies": {
"@aelita-dev/eslint-config": "2.3.4",
"@aelita-dev/eslint-config": "2.3.5",
"@iconify/json": "^2.2.225",
"@types/dom-view-transitions": "^1.0.4",
"@types/markdown-it": "^14.1.1",
"@types/node": "^20.14.10",
"@unocss/core": "^0.61.3",
"@unocss/eslint-plugin": "^0.61.3",
"@unocss/preset-mini": "^0.61.3",
"@vue/language-server": "^2.0.26",
"bumpp": "^9.4.1",
"bundle-require": "^5.0.0",
"changelogithub": "^0.13.7",
"eslint": "^8.57.0",
"eslint-plugin-vitest": "^0.5.4",
"eslint-plugin-vue": "^9.27.0",
"eslint-plugin-vuejs-accessibility": "^2.3.1",
"eslint-processor-vue-blocks": "^0.1.2",
"markdown-it": "^14.1.0",
"sass": "^1.77.6",
"typescript": "^5.5.3",
Expand Down
Loading

0 comments on commit 8b7eda6

Please sign in to comment.