Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vite migration: ESLint fixes #155

Merged
merged 8 commits into from
Mar 1, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ module.exports = {
"warn",
{ allowConstantExport: true },
],
"no-class-assign": "off",
"no-unused-vars": "off",
"simple-import-sort/imports": [
"error",
{
Expand Down
2 changes: 1 addition & 1 deletion src/components/DevWarning.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { Component } from 'react'
import { Component } from 'react'
import semver from 'semver'


Expand Down
2 changes: 1 addition & 1 deletion src/components/Footer.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { Component } from 'react'
import { Component } from 'react'

export default class Footer extends Component {
render() {
Expand Down
2 changes: 1 addition & 1 deletion src/components/Header.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import PropTypes from 'prop-types'
import React, { Component } from 'react'
import { Component } from 'react'
import { connect } from 'react-redux'
import { NavLink } from 'react-router-dom'

Expand Down
3 changes: 2 additions & 1 deletion src/components/Main.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import PropTypes from 'prop-types'
import React, { Component } from 'react'
import { Component } from 'react'
import { connect } from 'react-redux'

import { loadCurrentUser } from 'actions/authenticatedUser'
Expand All @@ -15,6 +15,7 @@ class Main extends Component {
isLoggedIn: PropTypes.bool.isRequired,
loadCurrentUser: PropTypes.func.isRequired,
loadServerSettings: PropTypes.func.isRequired,
children: PropTypes.node,
}

componentDidMount() {
Expand Down
7 changes: 6 additions & 1 deletion src/components/adapted/ReactRouterDom.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import PropTypes from 'prop-types'
import { stringify } from 'query-string'
import React, { Component } from 'react'
import { Component } from 'react'
import {
Link as OldLink,
useLocation,
Expand All @@ -12,6 +12,7 @@ import {
/**
* Add the location prop to a component
*/
// eslint-disable-next-line react/display-name
export const withLocation = (Component) => (props) => (
<Component
location={useLocation()}
Expand All @@ -22,6 +23,7 @@ export const withLocation = (Component) => (props) => (
/**
* Add the params prop to a component
*/
// eslint-disable-next-line react/display-name
export const withParams = (Component) => (props) => (
<Component
params={useParams()}
Expand All @@ -32,6 +34,7 @@ export const withParams = (Component) => (props) => (
/**
* Add the navigate prop to a component
*/
// eslint-disable-next-line react/display-name
export const withNavigate = (Component) => (props) => (
<Component
navigate={useNavigate()}
Expand All @@ -42,6 +45,7 @@ export const withNavigate = (Component) => (props) => (
/**
* Add the searchParams and setSearchParams props to a component
*/
// eslint-disable-next-line react/display-name
export const withSearchParams = (Component) => (props) => {
const [searchParams, setSearchParams] = useSearchParams()
return (
Expand All @@ -62,6 +66,7 @@ export default class Link extends Component {
PropTypes.object,
PropTypes.string,
]).isRequired,
children: PropTypes.node,
}

render () {
Expand Down
5 changes: 4 additions & 1 deletion src/components/adapted/ReactTransitionGroup.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react'
import PropTypes from 'prop-types'
import { CSSTransition } from 'react-transition-group'

/**
Expand Down Expand Up @@ -26,3 +26,6 @@ export const CSSTransitionLazy = ({children, ...props}) => (
{children}
</CSSTransition>
)
CSSTransitionLazy.propTypes = {
children: PropTypes.node,
}
2 changes: 1 addition & 1 deletion src/components/generics/ConfirmationBar.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import PropTypes from 'prop-types'
import React, { Component } from 'react'
import { Component } from 'react'

export default class ConfirmationBar extends Component {
static propTypes = {
Expand Down
3 changes: 2 additions & 1 deletion src/components/generics/ControlLink.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import classNames from 'classnames'
import PropTypes from 'prop-types'
import React, { Component } from 'react'
import { Component } from 'react'

import Link from 'components/adapted/ReactRouterDom'

Expand All @@ -12,6 +12,7 @@ export default class ControlLink extends Component {
PropTypes.string,
PropTypes.object
]).isRequired,
children: PropTypes.node,
}

render () {
Expand Down
1 change: 1 addition & 0 deletions src/components/generics/Delayer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { Component } from 'react'
export default class Delayer extends Component {
static propTypes = {
delay: PropTypes.number.isRequired,
children: PropTypes.node,
}

state = {display: false}
Expand Down
1 change: 1 addition & 0 deletions src/components/generics/Form.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ class Form extends Component {
]).isRequired,
title: PropTypes.string,
validate: PropTypes.func,
children: PropTypes.node,
}

static defaultProps = {
Expand Down
3 changes: 2 additions & 1 deletion src/components/generics/HighlighterQuery.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import PropTypes from 'prop-types'
import React, { Component } from 'react'
import { Component } from 'react'
import Highlighter from 'react-highlight-words'

/**
Expand Down Expand Up @@ -28,6 +28,7 @@ export default class HighlighterQuery extends Component {
PropTypes.array,
]).isRequired,
textToHighlight: PropTypes.string.isRequired,
children: PropTypes.node,
}

render() {
Expand Down
3 changes: 2 additions & 1 deletion src/components/generics/ListingFetchWrapper.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import PropTypes from 'prop-types'
import React, { Component } from 'react'
import { Component } from 'react'

import Delayer from 'components/generics/Delayer'
import Notification from 'components/generics/Notification'
Expand All @@ -8,6 +8,7 @@ import { Status } from 'reducers/alterationsResponse'
export default class ListingFetchWrapper extends Component {
static propTypes = {
status: PropTypes.symbol,
children: PropTypes.node,
}

render() {
Expand Down
6 changes: 4 additions & 2 deletions src/components/generics/Navigator.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import PropTypes from 'prop-types'
import { parse } from 'query-string'
import React, { Component } from 'react'
import { Component } from 'react'

import { withLocation } from 'components/adapted/ReactRouterDom'
import ControlLink from 'components/generics/ControlLink'
Expand Down Expand Up @@ -106,4 +106,6 @@ class Navigator extends Component {
}
}

export default withLocation(Navigator)
Navigator = withLocation(Navigator)

export default Navigator
5 changes: 5 additions & 0 deletions src/components/generics/Notification.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,11 @@ export default class Notification extends Component {
* Must be used on the cell of the first column.
*/
export class NotifiableForTable extends Component {
static propTypes = {
children: PropTypes.node,
className: PropTypes.string,
}

elementRef = React.createRef()

state = {
Expand Down
4 changes: 4 additions & 0 deletions src/components/generics/PlaylistEntryMinimal.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import UserWidget from 'components/generics/UserWidget'
import { playlistEntryPropType } from 'serverPropTypes/playlist'

const PlaylistEntryMinimal = (props) => (
<div className="playlist-entry-minimal">
Expand All @@ -8,5 +9,8 @@ const PlaylistEntryMinimal = (props) => (
<UserWidget user={props.playlistEntry.owner}/>
</div>
)
PlaylistEntryMinimal.propTypes = {
playlistEntry: playlistEntryPropType.isRequired
}

export default PlaylistEntryMinimal
3 changes: 2 additions & 1 deletion src/components/generics/Router.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import PropTypes from 'prop-types'
import { stringify } from 'query-string'
import React, { Component } from 'react'
import { Component } from 'react'
import { connect } from 'react-redux'
import {
Navigate,
Expand All @@ -14,6 +14,7 @@ class ProtectedRoute extends Component {
hasUserInfo: PropTypes.bool,
isLoggedIn: PropTypes.bool,
location: PropTypes.object.isRequired,
children: PropTypes.node,
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/components/generics/Tab.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import classNames from 'classnames'
import PropTypes from 'prop-types'
import React, { Component } from 'react'
import { Component } from 'react'
import { NavLink } from 'react-router-dom'

export default class Tab extends Component {
Expand Down
2 changes: 1 addition & 1 deletion src/components/generics/TokenWidget.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import PropTypes from 'prop-types'
import React, { Component } from 'react'
import { Component } from 'react'

import Notification from 'components/generics/Notification'
import { Status } from 'reducers/alterationsResponse'
Expand Down
3 changes: 2 additions & 1 deletion src/components/generics/UserWidget.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import classNames from 'classnames'
import PropTypes from 'prop-types'
import React, { Component } from 'react'
import { Component } from 'react'
import { connect } from 'react-redux'

import { userPropType } from 'serverPropTypes/users'
Expand All @@ -10,6 +10,7 @@ class UserWidget extends Component {
currentUser: userPropType.isRequired,
noResize: PropTypes.bool,
user: userPropType.isRequired,
className: PropTypes.string,
}

render() {
Expand Down
1 change: 0 additions & 1 deletion src/components/karaoke/KaraStatusNotification.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react'
import { Link } from 'react-router-dom'

const karaStatusNotification = () => (
Expand Down
4 changes: 3 additions & 1 deletion src/components/karaoke/Karaoke.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import classNames from 'classnames'
import PropTypes from 'prop-types'
import React, { Component } from 'react'
import { Component } from 'react'
import { connect } from 'react-redux'

import { loadPlaylistDigest } from 'actions/playlistDigest'
Expand All @@ -10,12 +10,14 @@ import PlaylistInfoBar from 'components/karaoke/PlaylistInfoBar'
import { IsPlaylistManager } from 'components/permissions/Playlist'
import { Status } from 'reducers/alterationsResponse'
import { karaokeStatePropType } from 'reducers/playlist'
import { userPropType } from 'serverPropTypes/users'
import { params } from 'utils'

class Karaoke extends Component {
static propTypes = {
loadPlaylistDigest: PropTypes.func.isRequired,
karaokeState: karaokeStatePropType.isRequired,
user: userPropType.isRequired,
}

state = {
Expand Down
2 changes: 1 addition & 1 deletion src/components/karaoke/PlaylistInfoBar.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import dayjs from 'dayjs'
import relativeTime from 'dayjs/plugin/relativeTime'
import React, { Component } from 'react'
import { Component } from 'react'
import { connect } from 'react-redux'
import { Link } from 'react-router-dom'

Expand Down
2 changes: 1 addition & 1 deletion src/components/karaoke/player/ManageButton.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import classNames from 'classnames'
import PropTypes from 'prop-types'
import React, { Component } from 'react'
import { Component } from 'react'

import { CSSTransitionLazy } from 'components/adapted/ReactTransitionGroup'
import { alterationResponsePropType, Status } from 'reducers/alterationsResponse'
Expand Down
2 changes: 1 addition & 1 deletion src/components/karaoke/player/Notification.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import PropTypes from 'prop-types'
import React, { Component } from 'react'
import { Component } from 'react'
import { CSSTransition, TransitionGroup } from 'react-transition-group'

import { alterationResponsePropType, Status } from 'reducers/alterationsResponse'
Expand Down
5 changes: 4 additions & 1 deletion src/components/karaoke/player/Player.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import classNames from 'classnames'
import PropTypes from 'prop-types'
import { stringify } from 'query-string'
import React, { Component } from 'react'
import { Component } from 'react'
import { connect } from 'react-redux'

import { sendPlayerCommand } from 'actions/playlist'
Expand All @@ -18,6 +18,7 @@ import { playerStatusStatePropType } from 'reducers/playlist'
import {
playerErrorsDigestStatePropType
} from 'reducers/playlistDigest'
import { userPropType } from 'serverPropTypes/users'
import { formatDuration } from 'utils'

class Player extends Component {
Expand All @@ -27,6 +28,8 @@ class Player extends Component {
responseOfSendPlayerCommands: PropTypes.objectOf(alterationResponsePropType),
sendPlayerCommand: PropTypes.func.isRequired,
setWithControls: PropTypes.func.isRequired,
user: userPropType.isRequired,
navigate: PropTypes.func.isRequired,
}

state = {
Expand Down
2 changes: 1 addition & 1 deletion src/components/library/Library.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import PropTypes from 'prop-types'
import React, { Component } from 'react'
import { Component } from 'react'
import { connect } from 'react-redux'
import { Outlet } from 'react-router-dom'

Expand Down
4 changes: 3 additions & 1 deletion src/components/library/SearchBox.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import PropTypes from 'prop-types'
import { parse } from 'query-string'
import React, { Component } from 'react'
import { Component } from 'react'
import { connect } from 'react-redux'

import { storeSearchBox } from 'actions/library'
Expand All @@ -14,6 +14,8 @@ class SearchBox extends Component {
placeholder: PropTypes.string.isRequired,
searchParams: PropTypes.object.isRequired,
setSearchParams: PropTypes.func.isRequired,
searchBox: PropTypes.object.isRequired,
storeSearchBox: PropTypes.func.isRequired,
}

state = {
Expand Down
6 changes: 4 additions & 2 deletions src/components/library/artist/Entry.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import PropTypes from 'prop-types'
import { stringify } from 'query-string'
import React, { Component } from 'react'
import { Component } from 'react'

import { withNavigate } from 'components/adapted/ReactRouterDom'
import HighlighterQuery from 'components/generics/HighlighterQuery'
Expand Down Expand Up @@ -54,4 +54,6 @@ class ArtistEntry extends Component {
}
}

export default withNavigate(ArtistEntry)
ArtistEntry = withNavigate(ArtistEntry)

export default ArtistEntry
5 changes: 4 additions & 1 deletion src/components/library/artist/List.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { Component } from 'react'
import PropTypes from 'prop-types'
import { Component } from 'react'
import { connect } from 'react-redux'

import { loadLibraryEntries } from 'actions/library'
Expand All @@ -12,6 +13,8 @@ import { artistStatePropType } from 'reducers/library'
class ArtistList extends Component {
static propTypes = {
artistState: artistStatePropType.isRequired,
searchParams: PropTypes.object.isRequired,
loadLibraryEntries: PropTypes.func.isRequired,
}

/**
Expand Down
Loading