Skip to content

Commit db05717

Browse files
committed
docs: update examples
1 parent 914b7aa commit db05717

File tree

15 files changed

+58
-63
lines changed

15 files changed

+58
-63
lines changed

examples/allow-js/eslint.config.js

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,24 @@
1+
import { globalIgnores } from 'eslint/config'
12
import pluginVue from 'eslint-plugin-vue'
2-
import vueTsEslintConfig from '@vue/eslint-config-typescript'
3+
import { defineConfigWithVueTs, vueTsConfigs } from '@vue/eslint-config-typescript'
4+
import standard from '@vue/eslint-config-standard-with-typescript'
5+
36
import pluginVitest from '@vitest/eslint-plugin'
47

5-
export default [
8+
export default defineConfigWithVueTs(
69
{
710
name: 'app/files-to-lint',
8-
files: ['**/*.{ts,mts,tsx,vue}'],
11+
files: ['**/*.{ts,mts,tsx,vue}']
912
},
1013

11-
{
12-
name: 'app/files-to-ignore',
13-
ignores: ['**/dist/**', '**/dist-ssr/**', '**/coverage/**'],
14-
},
14+
globalIgnores(['**/dist/**', '**/dist-ssr/**', '**/coverage/**']),
15+
16+
pluginVue.configs['flat/essential'],
17+
vueTsConfigs.recommended,
18+
standard,
1519

16-
...pluginVue.configs['flat/essential'],
17-
...vueTsEslintConfig(),
18-
1920
{
2021
...pluginVitest.configs.recommended,
21-
files: ['src/**/__tests__/*'],
22-
},
23-
]
22+
files: ['src/**/__tests__/*']
23+
}
24+
)

examples/allow-js/src/foo.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export const foo = () => console.log('foo')

examples/allow-js/src/main.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ import { createPinia } from 'pinia'
66
import App from './App.vue'
77
import router from './router'
88

9+
import { foo } from './foo'
10+
11+
foo()
12+
913
const app = createApp(App)
1014

1115
app.use(createPinia())

examples/allow-js/src/router/index.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,17 @@ const router = createRouter({
77
{
88
path: '/',
99
name: 'home',
10-
component: HomeView,
10+
component: HomeView
1111
},
1212
{
1313
path: '/about',
1414
name: 'about',
1515
// route level code-splitting
1616
// this generates a separate chunk (About.[hash].js) for this route
1717
// which is lazy-loaded when the route is visited.
18-
component: () => import('../views/AboutView.vue'),
19-
},
20-
],
18+
component: () => import('../views/AboutView.vue')
19+
}
20+
]
2121
})
2222

2323
export default router

examples/allow-js/src/stores/counter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { defineStore } from 'pinia'
44
export const useCounterStore = defineStore('counter', () => {
55
const count = ref(0)
66
const doubleCount = computed(() => count.value * 2)
7-
function increment() {
7+
function increment () {
88
count.value++
99
}
1010

examples/allow-js/tsconfig.app.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77

88
"paths": {
99
"@/*": ["./src/*"]
10-
}
10+
},
11+
12+
"allowJs": true
1113
}
1214
}

examples/allow-js/vite.config.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ export default defineConfig({
1010
plugins: [
1111
vue(),
1212
vueJsx(),
13-
vueDevTools(),
13+
vueDevTools()
1414
],
1515
resolve: {
1616
alias: {
1717
'@': fileURLToPath(new URL('./src', import.meta.url))
18-
},
19-
},
18+
}
19+
}
2020
})

examples/allow-js/vitest.config.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export default mergeConfig(
88
test: {
99
environment: 'jsdom',
1010
exclude: [...configDefaults.exclude, 'e2e/**'],
11-
root: fileURLToPath(new URL('./', import.meta.url)),
12-
},
13-
}),
11+
root: fileURLToPath(new URL('./', import.meta.url))
12+
}
13+
})
1414
)

examples/js/eslint.config.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
1+
import { defineConfig, globalIgnores } from 'eslint/config'
2+
13
import pluginVue from 'eslint-plugin-vue'
24
import pluginVitest from '@vitest/eslint-plugin'
35

46
import standard from '@vue/eslint-config-standard'
57

6-
export default [
8+
export default defineConfig([
79
{
810
name: 'app/files-to-lint',
911
files: ['**/*.{js,mjs,jsx,vue}']
1012
},
1113

12-
{
13-
name: 'app/files-to-ignore',
14-
ignores: ['**/dist/**', '**/dist-ssr/**', '**/coverage/**']
15-
},
14+
globalIgnores(['**/dist/**', '**/dist-ssr/**', '**/coverage/**']),
1615

1716
...pluginVue.configs['flat/essential'],
1817
...standard,
@@ -21,4 +20,4 @@ export default [
2120
...pluginVitest.configs.recommended,
2221
files: ['src/**/__tests__/*']
2322
}
24-
]
23+
])
Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,17 @@
1-
import pluginVue from 'eslint-plugin-vue'
1+
import { globalIgnores } from 'eslint/config'
22
import { defineConfigWithVueTs, vueTsConfigs } from '@vue/eslint-config-typescript'
3+
import pluginVue from 'eslint-plugin-vue'
34
import standard from '@vue/eslint-config-standard-with-typescript'
45
import pluginVitest from '@vitest/eslint-plugin'
5-
import oxlint from 'eslint-plugin-oxlint'
6+
import pluginOxlint from 'eslint-plugin-oxlint'
67

78
export default defineConfigWithVueTs(
89
{
910
name: 'app/files-to-lint',
1011
files: ['**/*.{ts,mts,tsx,vue}']
1112
},
1213

13-
{
14-
name: 'app/files-to-ignore',
15-
ignores: ['**/dist/**', '**/dist-ssr/**', '**/coverage/**']
16-
},
14+
globalIgnores(['**/dist/**', '**/dist-ssr/**', '**/coverage/**']),
1715

1816
pluginVue.configs['flat/essential'],
1917
vueTsConfigs.recommended,
@@ -23,5 +21,5 @@ export default defineConfigWithVueTs(
2321
...pluginVitest.configs.recommended,
2422
files: ['src/**/__tests__/*']
2523
},
26-
oxlint.configs['flat/recommended']
24+
pluginOxlint.configs['flat/recommended']
2725
)

0 commit comments

Comments
 (0)