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

Diff for: README.md

+2-2
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

Diff for: examples/allow-js/eslint.config.js

+6
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: {

Diff for: examples/minimal/eslint.config.js

+1-1
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
},

Diff for: examples/with-cypress/eslint.config.js

+23
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+
]

Diff for: examples/with-jsx-in-vue/.eslintrc.cjs

-14
This file was deleted.

Diff for: examples/with-jsx-in-vue/eslint.config.js

+20
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+
]

Diff for: examples/with-jsx-in-vue/src/components/HelloWorld.vue

+24-15
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 {

Diff for: examples/with-jsx-in-vue/tsconfig.app.json

+3-1
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
}

Diff for: examples/with-jsx/.eslintrc.cjs

-14
This file was deleted.

Diff for: examples/with-jsx/eslint.config.js

+13
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+
]

Diff for: examples/with-jsx/src/App.vue

+3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<script setup lang="ts">
22
import HelloWorld from './components/HelloWorld.vue'
33
import TheWelcome from './components/TheWelcome.vue'
4+
import FooComp from './FooComp'
45
</script>
56

67
<template>
@@ -10,6 +11,8 @@ import TheWelcome from './components/TheWelcome.vue'
1011
<div class="wrapper">
1112
<HelloWorld msg="You did it!" />
1213
</div>
14+
15+
<FooComp />
1316
</header>
1417

1518
<main>

Diff for: examples/with-jsx/src/FooComp.jsx

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { defineComponent } from "vue"
2+
3+
export default defineComponent({
4+
setup() {
5+
return () => <div>Foo</div>
6+
},
7+
})

Diff for: examples/with-jsx/tsconfig.app.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"baseUrl": ".",
1010
"paths": {
1111
"@/*": ["./src/*"]
12-
}
12+
},
13+
"allowJs": true
1314
}
1415
}

Diff for: examples/with-nightwatch/.eslintrc.cjs

-14
This file was deleted.

Diff for: examples/with-nightwatch/eslint.config.js

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
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: ['**/*.ts', '**/*.mts', '**/*.vue'],
8+
ignores: ['**/dist/**'],
9+
},
10+
11+
...pluginVue.configs['flat/essential'],
12+
...vueTsEslintConfig(),
13+
14+
{
15+
files: ['tests/e2e/**/*.{js,ts}', '**/__tests__/**/*.{js,ts}'],
16+
rules: {
17+
'no-unused-expressions': 'off',
18+
'@typescript-eslint/no-unused-expressions': 'off',
19+
// You can use https://github.com/ihordiachenko/eslint-plugin-chai-friendly for more accurate linting
20+
},
21+
},
22+
]

Diff for: examples/with-nightwatch/nightwatch/nightwatch.d.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable @typescript-eslint/no-empty-object-type, @typescript-eslint/no-unused-vars */
12
import { NightwatchCustomAssertions, NightwatchCustomCommands } from 'nightwatch'
23

34
declare module 'nightwatch' {

Diff for: examples/with-nightwatch/tests/e2e/example.ts

+1
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ describe('My First Test', function () {
99

1010
after((browser) => browser.end())
1111
})
12+

Diff for: examples/with-playwright/.eslintrc.cjs

-24
This file was deleted.

Diff for: examples/with-playwright/eslint.config.js

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import pluginVue from 'eslint-plugin-vue'
2+
import pluginPlaywright from 'eslint-plugin-playwright'
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+
...pluginPlaywright.configs['flat/recommended'],
17+
files: ['e2e/**/*.{test,spec}.{js,ts,jsx,tsx}'],
18+
},
19+
]

Diff for: examples/with-prettier/.eslintrc.cjs

-15
This file was deleted.

Diff for: examples/with-prettier/eslint.config.js

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import pluginVue from 'eslint-plugin-vue'
2+
import vueTsEslintConfig from '@vue/eslint-config-typescript'
3+
import skipFormatting from '@vue/eslint-config-prettier/skip-formatting'
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+
skipFormatting
16+
]

Diff for: examples/with-prettier/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"@tsconfig/node20": "^20.1.4",
2020
"@types/node": "^20.16.5",
2121
"@vitejs/plugin-vue": "^5.1.4",
22-
"@vue/eslint-config-prettier": "^9.0.0",
22+
"@vue/eslint-config-prettier": "^10.0.0-rc.2",
2323
"@vue/eslint-config-typescript": "workspace:*",
2424
"@vue/tsconfig": "^0.5.1",
2525
"eslint": "^9.10.0",

Diff for: examples/with-tsx-in-vue/.eslintrc.cjs

-14
This file was deleted.

Diff for: examples/with-tsx-in-vue/eslint.config.js

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
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: ['**/*.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+
}
17+
}),
18+
]

0 commit comments

Comments
 (0)