From 4adb909a64bfad6d78173d460f0fe80be6ed04d1 Mon Sep 17 00:00:00 2001 From: Philipp Fritsche Date: Sun, 28 Nov 2021 11:26:48 +0100 Subject: [PATCH] fix: use relative imports (#795) --- .eslintrc.js | 4 +++- src/utility/upload.ts | 10 ++++++++-- src/utils/index.ts | 1 + tests/tsconfig.json | 12 ++++++++++++ tests/utils/edit/setFiles.ts | 3 +-- .../misc/{isElementType.js => isElementType.ts} | 0 tests/utils/misc/{isVisible.js => isVisible.ts} | 0 tsconfig.json | 11 +++-------- 8 files changed, 28 insertions(+), 13 deletions(-) create mode 100644 tests/tsconfig.json rename tests/utils/misc/{isElementType.js => isElementType.ts} (100%) rename tests/utils/misc/{isVisible.js => isVisible.ts} (100%) diff --git a/.eslintrc.js b/.eslintrc.js index f9cf0de7..3a6031bc 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,6 +1,8 @@ module.exports = { extends: './node_modules/kcd-scripts/eslint.js', - parser: '@typescript-eslint/parser', + parserOptions: { + project: ['./tsconfig.json', './tests/tsconfig.json'], + }, settings: { 'import/resolver': { typescript: {}, diff --git a/src/utility/upload.ts b/src/utility/upload.ts index 82b692ab..d3562ccb 100644 --- a/src/utility/upload.ts +++ b/src/utility/upload.ts @@ -1,7 +1,13 @@ import {fireEvent} from '@testing-library/dom' -import {blur, createFileList, focus, isDisabled, isElementType} from '../utils' +import { + blur, + createFileList, + focus, + isDisabled, + isElementType, + setFiles, +} from '../utils' import {Config, UserEvent} from '../setup' -import {setFiles} from '#src/utils/edit/setFiles' export interface uploadInit { changeInit?: EventInit diff --git a/src/utils/index.ts b/src/utils/index.ts index 3a345bd8..58d3d1a4 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -15,6 +15,7 @@ export * from './edit/isValidDateValue' export * from './edit/isValidInputTimeValue' export * from './edit/maxLength' export * from './edit/prepareInput' +export * from './edit/setFiles' export * from './focus/blur' export * from './focus/copySelection' diff --git a/tests/tsconfig.json b/tests/tsconfig.json new file mode 100644 index 00000000..b16d4358 --- /dev/null +++ b/tests/tsconfig.json @@ -0,0 +1,12 @@ +{ + "extends": "../tsconfig.json", + "compilerOptions": { + "baseUrl": "..", + "paths": { + "#src": ["./src/index"], + "#src/*": ["./src/*"], + "#testHelpers/*": ["./tests/_helpers/*"] + } + }, + "include": ["."] +} diff --git a/tests/utils/edit/setFiles.ts b/tests/utils/edit/setFiles.ts index 6c528a5b..58b5a35b 100644 --- a/tests/utils/edit/setFiles.ts +++ b/tests/utils/edit/setFiles.ts @@ -1,5 +1,4 @@ -import {createFileList} from '#src/utils' -import {setFiles} from '#src/utils/edit/setFiles' +import {createFileList, setFiles} from '#src/utils' import {setup} from '#testHelpers/utils' test('set files', () => { diff --git a/tests/utils/misc/isElementType.js b/tests/utils/misc/isElementType.ts similarity index 100% rename from tests/utils/misc/isElementType.js rename to tests/utils/misc/isElementType.ts diff --git a/tests/utils/misc/isVisible.js b/tests/utils/misc/isVisible.ts similarity index 100% rename from tests/utils/misc/isVisible.js rename to tests/utils/misc/isVisible.ts diff --git a/tsconfig.json b/tsconfig.json index 6e179a96..5ea41274 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,16 +1,11 @@ { "extends": "./node_modules/kcd-scripts/shared-tsconfig.json", "compilerOptions": { - "allowJs": true, "esModuleInterop": true, "target": "ES5", - "baseUrl": ".", - "paths": { - "#src": ["./src/index"], - "#src/*": ["./src/*"], - "#testHelpers/*": ["./tests/_helpers/*"] - }, + "baseUrl": "/dev/null", + "paths": {}, "noEmit": true }, - "include": ["./src", "./tests"] + "include": ["./src"] }