1
1
/**
2
2
* @author Yosuke Ota <https://github.com/ota-meshi>
3
3
*/
4
- "use strict"
5
4
6
5
//------------------------------------------------------------------------------
7
6
// Requirements
8
7
//------------------------------------------------------------------------------
9
8
10
- const assert = require ( "assert" )
11
- const path = require ( "path" )
12
- const eslint = require ( "eslint" )
13
- const parser = require ( "../src/index.ts" )
14
-
15
- //------------------------------------------------------------------------------
16
- // Helpers
17
- //------------------------------------------------------------------------------
18
-
19
- const Linter = eslint . Linter
9
+ import type { ESLint } from "eslint"
10
+ import { Linter } from "eslint"
11
+ import { assert , describe , it } from "vitest"
12
+ import * as parser from "../src/index"
13
+ import type { CallExpression , Identifier } from "estree"
20
14
21
15
//------------------------------------------------------------------------------
22
16
// Tests
@@ -44,12 +38,12 @@ describe("parserServices.defineDocumentVisitor tests", () => {
44
38
45
39
const linter = new Linter ( { configType : "flat" } )
46
40
47
- const rules = {
41
+ const rules : ESLint . Plugin [ "rules" ] = {
48
42
"test-no-forbidden" : {
49
- create ( context ) {
43
+ create ( context : any ) {
50
44
return context . sourceCode . parserServices . defineDocumentVisitor (
51
45
{
52
- 'Identifier[name="forbidden"]' ( node ) {
46
+ 'Identifier[name="forbidden"]' ( node : Identifier ) {
53
47
context . report ( {
54
48
node,
55
49
message : 'no "forbidden"' ,
@@ -60,10 +54,10 @@ describe("parserServices.defineDocumentVisitor tests", () => {
60
54
} ,
61
55
} ,
62
56
"test-no-call" : {
63
- create ( context ) {
57
+ create ( context : any ) {
64
58
return context . sourceCode . parserServices . defineDocumentVisitor (
65
59
{
66
- CallExpression ( node ) {
60
+ CallExpression ( node : CallExpression ) {
67
61
context . report ( {
68
62
node,
69
63
message : "no call" ,
0 commit comments