Skip to content

Commit fe55935

Browse files
committed
TS: do not import with extensions
1 parent 1fb5472 commit fe55935

File tree

162 files changed

+430
-383
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

162 files changed

+430
-383
lines changed

.eslintrc.js

-2
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,6 @@ module.exports = {
183183
message: 'Use h.JSX.Element, ComponentChild, or ComponentChildren from Preact',
184184
},
185185
],
186-
'import/extensions': ['error', 'ignorePackages'],
187186
},
188187
},
189188
{
@@ -287,7 +286,6 @@ module.exports = {
287286
message: 'Use import instead',
288287
},
289288
],
290-
'import/extensions': ['error', 'ignorePackages'],
291289
},
292290
},
293291
{

examples/react-native-expo/App.js

+23-25
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,14 @@ import { Text, View, Image, StyleSheet } from 'react-native'
33
import AsyncStorage from '@react-native-async-storage/async-storage'
44
import Uppy from '@uppy/core'
55
import Tus from '@uppy/tus'
6-
import FilePicker from '@uppy/react-native'
7-
import useUppy from '@uppy/react/lib/useUppy'
6+
import FilePicker from '@uppy/react-native'
87
import FileList from './FileList'
98
import PauseResumeButton from './PauseResumeButton'
109
import ProgressBar from './ProgressBar'
1110
import SelectFiles from './SelectFilesButton'
1211
import getTusFileReader from './tusFileReader'
1312

14-
export default function App () {
13+
export default function App() {
1514
const [state, _setState] = useState({
1615
progress: 0,
1716
total: 0,
@@ -25,17 +24,19 @@ export default function App () {
2524
totalProgress: 0,
2625
})
2726

28-
const setState = useCallback((newState) => _setState((oldState) => ({ ...oldState, ...newState })), [])
27+
const setState = useCallback(
28+
(newState) => _setState((oldState) => ({ ...oldState, ...newState })),
29+
[],
30+
)
2931

30-
const uppy = useUppy(() => {
31-
return new Uppy({ autoProceed: true, debug: true })
32-
.use(Tus, {
33-
endpoint: 'https://tusd.tusdemo.net/files/',
34-
urlStorage: AsyncStorage,
35-
fileReader: getTusFileReader,
36-
chunkSize: 10 * 1024 * 1024, // keep the chunk size small to avoid memory exhaustion
37-
})
38-
})
32+
const [uppy] = useState(() => {
33+
return new Uppy({ autoProceed: true, debug: true }).use(Tus, {
34+
endpoint: 'https://tusd.tusdemo.net/files/',
35+
urlStorage: AsyncStorage,
36+
fileReader: getTusFileReader,
37+
chunkSize: 10 * 1024 * 1024, // keep the chunk size small to avoid memory exhaustion
38+
})
39+
}, [])
3940

4041
useEffect(() => {
4142
uppy.on('upload-progress', (file, progress) => {
@@ -51,7 +52,8 @@ export default function App () {
5152
})
5253
uppy.on('complete', (result) => {
5354
setState({
54-
status: result.successful[0] ? 'Upload complete ✅' : 'Upload errored ❌',
55+
status:
56+
result.successful[0] ? 'Upload complete ✅' : 'Upload errored ❌',
5557
uploadURL: result.successful[0] ? result.successful[0].uploadURL : null,
5658
uploadComplete: true,
5759
uploadStarted: false,
@@ -101,14 +103,8 @@ export default function App () {
101103
}
102104

103105
return (
104-
<View
105-
style={styles.root}
106-
>
107-
<Text
108-
style={styles.title}
109-
>
110-
Uppy in React Native
111-
</Text>
106+
<View style={styles.root}>
107+
<Text style={styles.title}>Uppy in React Native</Text>
112108
<View style={{ alignItems: 'center' }}>
113109
<Image
114110
style={styles.logo}
@@ -118,7 +114,7 @@ export default function App () {
118114
</View>
119115
<SelectFiles showFilePicker={showFilePicker} />
120116

121-
{state.info ? (
117+
{state.info ?
122118
<Text
123119
style={{
124120
marginBottom: 10,
@@ -128,7 +124,7 @@ export default function App () {
128124
>
129125
{state.info.message}
130126
</Text>
131-
) : null}
127+
: null}
132128

133129
<ProgressBar progress={state.totalProgress} />
134130

@@ -151,7 +147,9 @@ export default function App () {
151147
{uppy && <FileList uppy={uppy} />}
152148

153149
{state.status && <Text>Status: {state.status}</Text>}
154-
<Text>{state.progress} of {state.total}</Text>
150+
<Text>
151+
{state.progress} of {state.total}
152+
</Text>
155153
</View>
156154
)
157155
}

packages/@uppy/audio/src/Audio.tsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ import type {
99
import type { Uppy } from '@uppy/core/lib/Uppy'
1010

1111
import getFileTypeExtension from '@uppy/utils/lib/getFileTypeExtension'
12-
import supportsMediaRecorder from './supportsMediaRecorder.ts'
13-
import RecordingScreen from './RecordingScreen.tsx'
14-
import PermissionsScreen from './PermissionsScreen.tsx'
15-
import locale from './locale.ts'
12+
import supportsMediaRecorder from './supportsMediaRecorder'
13+
import RecordingScreen from './RecordingScreen'
14+
import PermissionsScreen from './PermissionsScreen'
15+
import locale from './locale'
1616
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
1717
// @ts-ignore We don't want TS to generate types for the package.json
1818
import packageJson from '../package.json'

packages/@uppy/audio/src/RecordingLength.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { h } from 'preact'
22
import type { I18n } from '@uppy/utils/lib/Translator'
3-
import formatSeconds from './formatSeconds.ts'
3+
import formatSeconds from './formatSeconds'
44

55
interface RecordingLengthProps {
66
recordingLengthSeconds: number

packages/@uppy/audio/src/RecordingScreen.tsx

+6-6
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22
import { h } from 'preact'
33
import { useEffect, useRef } from 'preact/hooks'
44
import type { I18n } from '@uppy/utils/lib/Translator'
5-
import RecordButton from './RecordButton.tsx'
6-
import RecordingLength from './RecordingLength.tsx'
5+
import RecordButton from './RecordButton'
6+
import RecordingLength from './RecordingLength'
77
import AudioSourceSelect, {
88
type AudioSourceSelectProps,
9-
} from './AudioSourceSelect.tsx'
10-
import AudioOscilloscope from './audio-oscilloscope/index.ts'
11-
import SubmitButton from './SubmitButton.tsx'
12-
import DiscardButton from './DiscardButton.tsx'
9+
} from './AudioSourceSelect'
10+
import AudioOscilloscope from './audio-oscilloscope/index'
11+
import SubmitButton from './SubmitButton'
12+
import DiscardButton from './DiscardButton'
1313

1414
interface RecordingScreenProps extends AudioSourceSelectProps {
1515
stream: MediaStream | null | undefined

packages/@uppy/audio/src/formatSeconds.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { describe, expect, it } from 'vitest'
2-
import formatSeconds from './formatSeconds.ts'
2+
import formatSeconds from './formatSeconds'
33

44
describe('formatSeconds', () => {
55
it("should return a value of '0:43' when an argument of 43 seconds is supplied", () => {

packages/@uppy/audio/src/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
export { default } from './Audio.tsx'
2-
export type { AudioOptions } from './Audio.tsx'
1+
export { default } from './Audio'
2+
export type { AudioOptions } from './Audio'

packages/@uppy/audio/src/supportsMediaRecorder.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* eslint-disable max-classes-per-file, compat/compat */
22
import { describe, expect, it } from 'vitest'
3-
import supportsMediaRecorder from './supportsMediaRecorder.ts'
3+
import supportsMediaRecorder from './supportsMediaRecorder'
44

55
describe('supportsMediaRecorder', () => {
66
it('should return true if MediaRecorder is supported', () => {

packages/@uppy/aws-s3/src/HTTPCommunicationQueue.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ import type {
33
RateLimitedQueue,
44
WrapPromiseFunctionType,
55
} from '@uppy/utils/lib/RateLimitedQueue'
6-
import { pausingUploadReason, type Chunk } from './MultipartUploader.ts'
6+
import { pausingUploadReason, type Chunk } from './MultipartUploader'
77
import type AwsS3Multipart from './index.js'
8-
import { throwIfAborted } from './utils.ts'
8+
import { throwIfAborted } from './utils'
99
import type { Body, UploadPartBytesResult, UploadResult } from './utils.js'
1010
import type { AwsS3MultipartOptions, uploadPartBytes } from './index.js'
1111

packages/@uppy/aws-s3/src/createSignedURL.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {
66
PutObjectCommand,
77
} from '@aws-sdk/client-s3'
88
import { getSignedUrl } from '@aws-sdk/s3-request-presigner'
9-
import createSignedURL from './createSignedURL.ts'
9+
import createSignedURL from './createSignedURL'
1010

1111
const bucketName = 'some-bucket'
1212
const s3ClientOptions = {

packages/@uppy/aws-s3/src/index.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
33
import 'whatwg-fetch'
44
import nock from 'nock'
55
import Core from '@uppy/core'
6-
import AwsS3Multipart from './index.ts'
6+
import AwsS3Multipart from './index'
77
import type { Body } from './utils.js'
88

99
const KB = 1024

packages/@uppy/aws-s3/src/index.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,17 @@ import {
1414
} from '@uppy/utils/lib/fileFilters'
1515
import { createAbortError } from '@uppy/utils/lib/AbortController'
1616
import getAllowedMetaFields from '@uppy/utils/lib/getAllowedMetaFields'
17-
import MultipartUploader from './MultipartUploader.ts'
18-
import { throwIfAborted } from './utils.ts'
17+
import MultipartUploader from './MultipartUploader'
18+
import { throwIfAborted } from './utils'
1919
import type {
2020
UploadResult,
2121
UploadResultWithSignal,
2222
MultipartUploadResultWithSignal,
2323
UploadPartBytesResult,
2424
Body,
2525
} from './utils.js'
26-
import createSignedURL from './createSignedURL.ts'
27-
import { HTTPCommunicationQueue } from './HTTPCommunicationQueue.ts'
26+
import createSignedURL from './createSignedURL'
27+
import { HTTPCommunicationQueue } from './HTTPCommunicationQueue'
2828
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
2929
// @ts-ignore We don't want TS to generate types for the package.json
3030
import packageJson from '../package.json'

packages/@uppy/box/src/Box.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { h, type ComponentChild } from 'preact'
1010

1111
import type { UppyFile, Body, Meta } from '@uppy/utils/lib/UppyFile'
1212
import type { UnknownProviderPluginState } from '@uppy/core/lib/Uppy'
13-
import locale from './locale.ts'
13+
import locale from './locale'
1414
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
1515
// @ts-ignore We don't want TS to generate types for the package.json
1616
import packageJson from '../package.json'

packages/@uppy/box/src/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export { default } from './Box.tsx'
1+
export { default } from './Box'

packages/@uppy/companion-client/src/Provider.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import type {
66
CompanionClientProvider,
77
} from '@uppy/utils/lib/CompanionClientProvider'
88
import type { UnknownProviderPlugin } from '@uppy/core/lib/Uppy'
9-
import RequestClient, { authErrorStatusCode } from './RequestClient.ts'
9+
import RequestClient, { authErrorStatusCode } from './RequestClient'
1010
import type { CompanionPluginOptions } from './index.js'
1111

1212
export interface Opts extends PluginOpts, CompanionPluginOptions {

packages/@uppy/companion-client/src/RequestClient.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { describe, it, expect } from 'vitest'
2-
import RequestClient from './RequestClient.ts'
2+
import RequestClient from './RequestClient'
33

44
describe('RequestClient', () => {
55
it('has a hostname without trailing slash', () => {

packages/@uppy/companion-client/src/RequestClient.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import getSocketHost from '@uppy/utils/lib/getSocketHost'
1010
import type Uppy from '@uppy/core'
1111
import type { UppyFile, Meta, Body } from '@uppy/utils/lib/UppyFile'
1212
import type { RequestOptions } from '@uppy/utils/lib/CompanionClientProvider'
13-
import AuthError from './AuthError.ts'
13+
import AuthError from './AuthError'
1414
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
1515
// @ts-ignore We don't want TS to generate types for the package.json
1616
import packageJson from '../package.json'

packages/@uppy/companion-client/src/SearchProvider.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { Body, Meta } from '@uppy/utils/lib/UppyFile'
22
import type { Uppy } from '@uppy/core'
33
import type { CompanionClientSearchProvider } from '@uppy/utils/lib/CompanionClientProvider'
4-
import RequestClient, { type Opts } from './RequestClient.ts'
4+
import RequestClient, { type Opts } from './RequestClient'
55

66
const getName = (id: string): string => {
77
return id

packages/@uppy/companion-client/src/index.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
* Manages communications with Companion
33
*/
44

5-
export { default as RequestClient } from './RequestClient.ts'
6-
export { default as Provider } from './Provider.ts'
7-
export { default as SearchProvider } from './SearchProvider.ts'
5+
export { default as RequestClient } from './RequestClient'
6+
export { default as Provider } from './Provider'
7+
export { default as SearchProvider } from './SearchProvider'
88

9-
export { default as getAllowedHosts } from './getAllowedHosts.ts'
9+
export { default as getAllowedHosts } from './getAllowedHosts'
1010

11-
export * as tokenStorage from './tokenStorage.ts'
11+
export * as tokenStorage from './tokenStorage'
1212

13-
export type { CompanionPluginOptions } from './CompanionPluginOptions.ts'
13+
export type { CompanionPluginOptions } from './CompanionPluginOptions'

packages/@uppy/compressor/src/index.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import Core from '@uppy/core'
33
import getFileNameAndExtension from '@uppy/utils/lib/getFileNameAndExtension'
44
import fs from 'node:fs'
55
import path from 'node:path'
6-
import CompressorPlugin from './index.ts'
6+
import CompressorPlugin from './index'
77

88
// Compressor uses browser canvas API, so need to mock compress()
99
// @ts-expect-error mocked

packages/@uppy/compressor/src/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import CompressorJS from 'compressorjs'
99
import type { Body, Meta, UppyFile } from '@uppy/utils/lib/UppyFile'
1010
import type { PluginOpts } from '@uppy/core/lib/BasePlugin'
1111

12-
import locale from './locale.ts'
12+
import locale from './locale'
1313

1414
declare module '@uppy/core' {
1515
export interface UppyEventMap<M extends Meta, B extends Body> {

packages/@uppy/core/src/UIPlugin.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { describe, expect, it } from 'vitest'
2-
import UIPlugin from './UIPlugin.ts'
3-
import Core from './index.ts'
2+
import UIPlugin from './UIPlugin'
3+
import Core from './index'
44

55
describe('UIPlugin', () => {
66
describe('getPluginState', () => {

packages/@uppy/core/src/UIPlugin.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import findDOMElement from '@uppy/utils/lib/findDOMElement'
44
import getTextDirection from '@uppy/utils/lib/getTextDirection'
55

66
import type { Body, Meta } from '@uppy/utils/lib/UppyFile'
7-
import BasePlugin from './BasePlugin.ts'
7+
import BasePlugin from './BasePlugin'
88
import type { PluginOpts } from './BasePlugin.js'
99
import type { State } from './Uppy.js'
1010

packages/@uppy/core/src/Uppy.test.ts

+10-10
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,21 @@ import path from 'node:path'
88
import prettierBytes from '@transloadit/prettier-bytes'
99
import type { Body, Meta } from '@uppy/utils/lib/UppyFile'
1010
import type { Locale } from '@uppy/utils/lib/Translator'
11-
import Core from './index.ts'
12-
import UIPlugin from './UIPlugin.ts'
11+
import Core from './index'
12+
import UIPlugin from './UIPlugin'
1313
import BasePlugin, {
1414
type DefinePluginOpts,
1515
type PluginOpts,
16-
} from './BasePlugin.ts'
17-
import { debugLogger } from './loggers.ts'
18-
import AcquirerPlugin1 from './mocks/acquirerPlugin1.ts'
19-
import AcquirerPlugin2 from './mocks/acquirerPlugin2.ts'
20-
import InvalidPlugin from './mocks/invalidPlugin.ts'
21-
import InvalidPluginWithoutId from './mocks/invalidPluginWithoutId.ts'
22-
import InvalidPluginWithoutType from './mocks/invalidPluginWithoutType.ts'
16+
} from './BasePlugin'
17+
import { debugLogger } from './loggers'
18+
import AcquirerPlugin1 from './mocks/acquirerPlugin1'
19+
import AcquirerPlugin2 from './mocks/acquirerPlugin2'
20+
import InvalidPlugin from './mocks/invalidPlugin'
21+
import InvalidPluginWithoutId from './mocks/invalidPluginWithoutId'
22+
import InvalidPluginWithoutType from './mocks/invalidPluginWithoutType'
2323
// @ts-expect-error trying to import a file from outside the package
2424
import DeepFrozenStore from '../../../../e2e/cypress/fixtures/DeepFrozenStore.mjs'
25-
import type { State } from './Uppy.ts'
25+
import type { State } from './Uppy'
2626

2727
// eslint-disable-next-line no-restricted-globals
2828
const sampleImage = fs.readFileSync(

packages/@uppy/core/src/Uppy.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,18 @@ import type {
2929
I18n,
3030
OptionalPluralizeLocale,
3131
} from '@uppy/utils/lib/Translator'
32-
import supportsUploadProgress from './supportsUploadProgress.ts'
33-
import getFileName from './getFileName.ts'
34-
import { justErrorsLogger, debugLogger } from './loggers.ts'
32+
import supportsUploadProgress from './supportsUploadProgress'
33+
import getFileName from './getFileName'
34+
import { justErrorsLogger, debugLogger } from './loggers'
3535
import {
3636
Restricter,
3737
defaultOptions as defaultRestrictionOptions,
3838
RestrictionError,
39-
} from './Restricter.ts'
39+
} from './Restricter'
4040
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
4141
// @ts-ignore We don't want TS to generate types for the package.json
4242
import packageJson from '../package.json'
43-
import locale from './locale.ts'
43+
import locale from './locale'
4444

4545
import type BasePlugin from './BasePlugin.js'
4646
import type { Restrictions, ValidateableFile } from './Restricter.js'

0 commit comments

Comments
 (0)