Skip to content

Commit 387cda2

Browse files
committed
fix: update no-dom-import rule to report the right module name
1 parent f634bfd commit 387cda2

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

lib/rules/no-dom-import.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,11 @@ export default createTestingLibraryRule<Options, MessageIds>({
4747
moduleName: string
4848
) {
4949
if (framework) {
50-
const correctModuleName = moduleName.replace('dom', framework);
50+
// marko TL is called @marko/testing-library
51+
const correctModuleName =
52+
framework === 'marko'
53+
? moduleName.replace('dom-', `@${framework}/`)
54+
: moduleName.replace('dom', framework);
5155
context.report({
5256
node,
5357
messageId: 'noDomImportFramework',

tests/lib/rules/no-dom-import.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,11 @@ ruleTester.run(RULE_NAME, rule, {
7474
{
7575
messageId: 'noDomImportFramework',
7676
data: {
77-
module: 'marko-testing-library',
77+
module: '@marko/testing-library',
7878
},
7979
},
8080
],
81-
output: `import { fireEvent } from "marko-testing-library"`,
81+
output: `import { fireEvent } from "@marko/testing-library"`,
8282
},
8383
// Single quote or double quotes should not be replaced
8484
{

0 commit comments

Comments
 (0)