Skip to content

Commit 4c16ea1

Browse files
committed
test(linter/plugins): check this is undefined in visit functions (#13811)
Add test coverage for the value of `this` within visit functions. It should be `undefined`, to match ESLint.
1 parent ef0e6c3 commit 4c16ea1

File tree

1 file changed

+5
-1
lines changed
  • apps/oxlint/test/fixtures/context_properties/test_plugin

1 file changed

+5
-1
lines changed

apps/oxlint/test/fixtures/context_properties/test_plugin/index.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,11 @@ const rule = {
2727

2828
if (this !== rule) context.report({ message: 'this !== rule', node: SPAN });
2929

30-
return {};
30+
return {
31+
VariableDeclaration(node) {
32+
if (this !== undefined) context.report({ message: 'this !== undefined', node });
33+
}
34+
};
3135
},
3236
};
3337

0 commit comments

Comments
 (0)