Skip to content

Commit f77f9ad

Browse files
Merge pull request #2545 from johanrd/issue/1698-no-test-import-export-glint
[BUGFIX]: `no-test-import-export` false positive on package imports
2 parents 0f627db + dacfc42 commit f77f9ad

2 files changed

Lines changed: 5 additions & 0 deletions

File tree

lib/rules/no-test-import-export.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ module.exports = {
4747
const importSource = node.source.value;
4848

4949
if (
50+
importSource.startsWith('.') &&
5051
importSource.endsWith('-test') &&
5152
!isTestHelperFilename(path.resolve(path.dirname(context.getFilename()), importSource))
5253
) {

tests/lib/rules/no-test-import-export.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@ ruleTester.run('no-test-import-export', rule, {
5454
filename: 'my-app-name/tests/helpers/nested/foo.js',
5555
code: "import setupApplicationTest from '../setup-application-test';",
5656
},
57+
58+
// Package imports ending in -test should not be flagged
59+
"import { expectTypeOf } from '@glint/type-test';",
60+
"import something from 'some-package-test';",
5761
],
5862
invalid: [
5963
{

0 commit comments

Comments
 (0)