Fix linting errors
This commit is contained in:
parent
0b068dbe1d
commit
7e3956068b
@ -1,16 +1,16 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
roots: [
|
roots: [
|
||||||
'<rootDir>/src'
|
'<rootDir>/src',
|
||||||
],
|
],
|
||||||
transform: {
|
transform: {
|
||||||
'^.+\\.tsx?$': 'ts-jest'
|
'^.+\\.tsx?$': 'ts-jest',
|
||||||
},
|
},
|
||||||
testRegex: '(/__tests__/.*|\\.(test|spec))\\.tsx?$',
|
testRegex: '(/__tests__/.*|\\.(test|spec))\\.tsx?$',
|
||||||
moduleFileExtensions: [
|
moduleFileExtensions: [
|
||||||
'ts',
|
'ts',
|
||||||
'tsx',
|
'tsx',
|
||||||
'js',
|
'js',
|
||||||
'jsx'
|
'jsx',
|
||||||
],
|
],
|
||||||
setupFiles: ['<rootDir>/jest.setup.js']
|
setupFiles: ['<rootDir>/jest.setup.js'],
|
||||||
}
|
}
|
||||||
|
|||||||
@ -22,8 +22,8 @@
|
|||||||
"js:uglify": "minify build/index.prod.js -o build/index.js",
|
"js:uglify": "minify build/index.prod.js -o build/index.js",
|
||||||
"css": "node-sass ./src/scss/style.scss -o ./build/",
|
"css": "node-sass ./src/scss/style.scss -o ./build/",
|
||||||
"css:watch": "npm run css && node-sass --watch ./src/scss/style.scss -o ./build/",
|
"css:watch": "npm run css && node-sass --watch ./src/scss/style.scss -o ./build/",
|
||||||
"lint": "eslint .",
|
"lint": "eslint --ext ts,tsx .",
|
||||||
"lint:fix": "eslint . --fix",
|
"lint:fix": "eslint --ext ts,tsx --fix .",
|
||||||
"ci": "npm run lint && npm run test:coverage && npm run build",
|
"ci": "npm run lint && npm run test:coverage && npm run build",
|
||||||
"ts:watch": "tsc -p . --watch --preserveWatchOutput",
|
"ts:watch": "tsc -p . --watch --preserveWatchOutput",
|
||||||
"ts": "tsc -p .",
|
"ts": "tsc -p .",
|
||||||
|
|||||||
@ -15,11 +15,13 @@ export class MediaStream {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
export function getUserMedia () {
|
export function getUserMedia () {
|
||||||
return !(getUserMedia as any).shouldFail
|
return !getUserMedia.shouldFail
|
||||||
? Promise.resolve(getUserMedia.stream)
|
? Promise.resolve(getUserMedia.stream)
|
||||||
: Promise.reject(new Error('test'))
|
: Promise.reject(new Error('test'))
|
||||||
}
|
}
|
||||||
getUserMedia.fail = (shouldFail: boolean) => (getUserMedia as any).shouldFail = shouldFail
|
getUserMedia.shouldFail = false
|
||||||
|
getUserMedia.fail = (shouldFail: boolean) =>
|
||||||
|
getUserMedia.shouldFail = shouldFail
|
||||||
getUserMedia.stream = new MediaStream()
|
getUserMedia.stream = new MediaStream()
|
||||||
|
|
||||||
export const navigator = window.navigator
|
export const navigator = window.navigator
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { Action, Dispatch } from 'redux'
|
import { Action } from 'redux'
|
||||||
|
|
||||||
export type PendingAction<T extends string, P> = Action<T> & Promise<P> & {
|
export type PendingAction<T extends string, P> = Action<T> & Promise<P> & {
|
||||||
status: 'pending'
|
status: 'pending'
|
||||||
|
|||||||
@ -1,9 +1,8 @@
|
|||||||
import Input from './Input'
|
|
||||||
import PropTypes from 'prop-types'
|
|
||||||
import React from 'react'
|
|
||||||
import classnames from 'classnames'
|
import classnames from 'classnames'
|
||||||
|
import React from 'react'
|
||||||
import { Message as MessageType } from '../actions/ChatActions'
|
import { Message as MessageType } from '../actions/ChatActions'
|
||||||
import { TextMessage } from '../actions/PeerActions'
|
import { TextMessage } from '../actions/PeerActions'
|
||||||
|
import Input from './Input'
|
||||||
|
|
||||||
export interface MessageProps {
|
export interface MessageProps {
|
||||||
message: MessageType
|
message: MessageType
|
||||||
|
|||||||
@ -37,14 +37,11 @@ export default class Video extends React.PureComponent<VideoProps> {
|
|||||||
const video = this.videoRef.current!
|
const video = this.videoRef.current!
|
||||||
const mediaStream = stream && stream.stream || null
|
const mediaStream = stream && stream.stream || null
|
||||||
const url = stream && stream.url
|
const url = stream && stream.url
|
||||||
console.log('stream', stream)
|
|
||||||
if ('srcObject' in video as unknown) {
|
if ('srcObject' in video as unknown) {
|
||||||
if (video.srcObject !== mediaStream) {
|
if (video.srcObject !== mediaStream) {
|
||||||
console.log('setting srcObject')
|
|
||||||
video.srcObject = mediaStream
|
video.srcObject = mediaStream
|
||||||
}
|
}
|
||||||
} else if (video.src !== url) {
|
} else if (video.src !== url) {
|
||||||
console.log('setting src')
|
|
||||||
video.src = url || ''
|
video.src = url || ''
|
||||||
}
|
}
|
||||||
videos[socket.id] = video
|
videos[socket.id] = video
|
||||||
|
|||||||
@ -34,7 +34,7 @@ describe('reducers/alerts', () => {
|
|||||||
store.dispatch(StreamActions.addStream({ userId, stream }))
|
store.dispatch(StreamActions.addStream({ userId, stream }))
|
||||||
expect(store.getState().streams).toEqual({
|
expect(store.getState().streams).toEqual({
|
||||||
[userId]: {
|
[userId]: {
|
||||||
mediaStream: stream,
|
stream: stream,
|
||||||
url: jasmine.any(String),
|
url: jasmine.any(String),
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
@ -45,7 +45,7 @@ describe('reducers/alerts', () => {
|
|||||||
store.dispatch(StreamActions.addStream({ userId, stream }))
|
store.dispatch(StreamActions.addStream({ userId, stream }))
|
||||||
expect(store.getState().streams).toEqual({
|
expect(store.getState().streams).toEqual({
|
||||||
[userId]: {
|
[userId]: {
|
||||||
mediaStream: stream,
|
stream: stream,
|
||||||
url: null,
|
url: null,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|||||||
@ -9,7 +9,9 @@ export async function getUserMedia (constraints: MediaStreamConstraints) {
|
|||||||
|
|
||||||
return new Promise<MediaStream>((resolve, reject) => {
|
return new Promise<MediaStream>((resolve, reject) => {
|
||||||
const getMedia = navigator.getUserMedia ||
|
const getMedia = navigator.getUserMedia ||
|
||||||
(navigator as any).webkitGetUserMedia
|
(navigator as unknown as {
|
||||||
|
webkitGetUserMedia: typeof navigator.getUserMedia
|
||||||
|
}).webkitGetUserMedia
|
||||||
if (!getMedia) reject(new Error('Browser unsupported'))
|
if (!getMedia) reject(new Error('Browser unsupported'))
|
||||||
getMedia.call(navigator, constraints, resolve, reject)
|
getMedia.call(navigator, constraints, resolve, reject)
|
||||||
})
|
})
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user