Skip to content

Commit 86115a6

Browse files
committed
test(require-event-prefix): added tests
1 parent c587629 commit 86115a6

File tree

10 files changed

+77
-0
lines changed

10 files changed

+77
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"options": [{ "checkAsyncFunctions": true }]
3+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
- message: Component event name must start with "on".
2+
line: 6
3+
column: 27
4+
suggestions: null
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<script lang="ts">
2+
interface Props {
3+
custom(): Promise<void>;
4+
}
5+
6+
let { custom }: Props = $props();
7+
8+
void custom();
9+
</script>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
- message: Component event name must start with "on".
2+
line: 6
3+
column: 27
4+
suggestions: null
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<script lang="ts">
2+
interface Props {
3+
custom(): void;
4+
}
5+
6+
let { custom }: Props = $props();
7+
8+
custom();
9+
</script>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<script lang="ts">
2+
interface Props {
3+
custom: any;
4+
}
5+
6+
let { custom }: Props = $props();
7+
8+
console.log(custom);
9+
</script>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<script lang="ts">
2+
interface Props {
3+
custom(): Promise<void>;
4+
}
5+
6+
let { custom }: Props = $props();
7+
8+
void custom();
9+
</script>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<script lang="ts">
2+
interface Props {
3+
custom: number;
4+
}
5+
6+
let { custom }: Props = $props();
7+
8+
console.log(custom);
9+
</script>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<script lang="ts">
2+
interface Props {
3+
oncustom(): void;
4+
}
5+
6+
let { oncustom }: Props = $props();
7+
8+
oncustom();
9+
</script>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { RuleTester } from '../../utils/eslint-compat.js';
2+
import rule from '../../../src/rules/require-event-prefix.js';
3+
import { loadTestCases } from '../../utils/utils.js';
4+
5+
const tester = new RuleTester({
6+
languageOptions: {
7+
ecmaVersion: 2020,
8+
sourceType: 'module'
9+
}
10+
});
11+
12+
tester.run('require-event-prefix', rule as any, loadTestCases('require-event-prefix'));

0 commit comments

Comments
 (0)