Skip to content

Commit 96fadac

Browse files
committed
test: update examples to pass linting without errors
1 parent 31d1ca4 commit 96fadac

34 files changed

+313
-222
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# @vue/eslint-config-typescript
22

3-
> eslint-config-typescript for Vue
3+
ESLint configuration for Vue 3 + TypeScript projects.
44

55
See [@typescript-eslint/eslint-plugin](https://typescript-eslint.io/rules/) for available rules.
66

@@ -13,7 +13,7 @@ other parts of `create-vue` setups, such as `eslint-plugin-vue` being
1313
extended in the same resulting config.
1414

1515
> [!NOTE]
16-
> The current version doesn't support the legacy `.eslintrc*` configuraion format. For that you need to use version 9 or earlier. See the [corresponding README](https://www.npmjs.com/package/@vue/eslint-config-typescript/v/legacy-eslintrc) for more usage instructions.
16+
> The current version doesn't support the legacy `.eslintrc*` configuraion format. For that you need to use version 13 or earlier. See the [corresponding README](https://www.npmjs.com/package/@vue/eslint-config-typescript/v/legacy-eslintrc) for more usage instructions.
1717
1818
## Installation
1919

examples/allow-js/eslint.config.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@ import pluginVue from "eslint-plugin-vue";
22
import vueTsEslintConfig from "@vue/eslint-config-typescript";
33

44
export default [
5+
{
6+
name: 'app/files-to-lint',
7+
files: ['**/*.js', '**/*.mjs', '**/*.ts', '**/*.mts', '**/*.vue'],
8+
ignores: ['**/dist/**'],
9+
},
10+
511
...pluginVue.configs["flat/essential"],
612
...vueTsEslintConfig({
713
supportedScriptLangs: {

examples/minimal/eslint.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import vueTsEslintConfig from '@vue/eslint-config-typescript'
33

44
export default [
55
{
6-
name: 'app/setup-files',
6+
name: 'app/files-to-lint',
77
files: ['**/*.ts', '**/*.mts', '**/*.vue'],
88
ignores: ['**/dist/**'],
99
},
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import pluginVue from 'eslint-plugin-vue'
2+
import pluginCypress from 'eslint-plugin-cypress/flat'
3+
import vueTsEslintConfig from '@vue/eslint-config-typescript'
4+
5+
export default [
6+
{
7+
name: 'app/files-to-lint',
8+
files: ['**/*.ts', '**/*.mts', '**/*.vue'],
9+
ignores: ['**/dist/**'],
10+
},
11+
12+
...pluginVue.configs['flat/essential'],
13+
...vueTsEslintConfig(),
14+
15+
{
16+
files: [
17+
'**/__tests__/*.{cy,spec}.{js,ts,jsx,tsx}',
18+
'cypress/e2e/**/*.{cy,spec}.{js,ts,jsx,tsx}',
19+
'cypress/support/**/*.{js,ts,jsx,tsx}'
20+
],
21+
...pluginCypress.configs.recommended,
22+
}
23+
]

examples/with-jsx-in-vue/.eslintrc.cjs

Lines changed: 0 additions & 14 deletions
This file was deleted.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import pluginVue from 'eslint-plugin-vue'
2+
import vueTsEslintConfig from '@vue/eslint-config-typescript'
3+
4+
export default [
5+
{
6+
name: 'app/files-to-lint',
7+
files: ['**/*.js', '**/*.mjs', '**/*.jsx', '**/*.ts', '**/*.mts', '**/*.tsx', '**/*.vue'],
8+
ignores: ['**/dist/**'],
9+
},
10+
11+
...pluginVue.configs['flat/essential'],
12+
...vueTsEslintConfig({
13+
supportedScriptLangs: {
14+
ts: true,
15+
tsx: true,
16+
js: true,
17+
jsx: true
18+
}
19+
}),
20+
]

examples/with-jsx-in-vue/src/components/HelloWorld.vue

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,28 @@
1-
<script setup lang="ts">
2-
defineProps<{
3-
msg: string
4-
}>()
5-
</script>
1+
<script lang="jsx">
2+
import { defineComponent } from 'vue'
63
7-
<template>
8-
<div class="greetings">
9-
<h1 class="green">{{ msg }}</h1>
10-
<h3>
11-
You’ve successfully created a project with
12-
<a href="https://vitejs.dev/" target="_blank" rel="noopener">Vite</a> +
13-
<a href="https://vuejs.org/" target="_blank" rel="noopener">Vue 3</a>.
14-
</h3>
15-
</div>
16-
</template>
4+
export default defineComponent({
5+
props: { msg: String },
6+
setup(props) {
7+
return () => (
8+
<div class="greetings">
9+
<h1 class="green">{props.msg}</h1>
10+
<h3>
11+
You’ve successfully created a project with
12+
<a href="https://vitejs.dev/" target="_blank" rel="noopener">
13+
Vite
14+
</a>{' '}
15+
+
16+
<a href="https://vuejs.org/" target="_blank" rel="noopener">
17+
Vue 3
18+
</a>
19+
.
20+
</h3>
21+
</div>
22+
)
23+
},
24+
})
25+
</script>
1726

1827
<style scoped>
1928
h1 {

examples/with-jsx-in-vue/tsconfig.app.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
"baseUrl": ".",
1010
"paths": {
1111
"@/*": ["./src/*"]
12-
}
12+
},
13+
14+
"allowJs": true
1315
}
1416
}

examples/with-jsx/.eslintrc.cjs

Lines changed: 0 additions & 14 deletions
This file was deleted.

examples/with-jsx/eslint.config.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import pluginVue from 'eslint-plugin-vue'
2+
import vueTsEslintConfig from '@vue/eslint-config-typescript'
3+
4+
export default [
5+
{
6+
name: 'app/files-to-lint',
7+
files: ['**/*.js', '**/*.mjs', '**/*.jsx', '**/*.ts', '**/*.mts', '**/*.tsx', '**/*.vue'],
8+
ignores: ['**/dist/**'],
9+
},
10+
11+
...pluginVue.configs['flat/essential'],
12+
...vueTsEslintConfig(),
13+
]

0 commit comments

Comments
 (0)