From a91f1b3bd4fd14f6375152005f1166b113898aba Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Sat, 22 Aug 2020 08:10:31 +0200 Subject: [PATCH] Fixed coding styles --- .eslintrc | 6 ++- config/env.js | 6 +-- config/webpack.config.js | 14 +++--- scripts/build.js | 14 +++--- scripts/start.js | 12 ++--- src/App.js | 50 ++++++++++--------- src/common/MenuLayout.js | 4 +- src/common/services/provideServices.js | 2 +- src/container/index.js | 2 +- src/container/store.js | 2 +- src/index.js | 2 +- src/registerServiceWorker.js | 8 +-- src/servers/reducers/selectedServer.js | 4 +- src/servers/reducers/servers.js | 2 +- src/short-urls/SearchBar.js | 4 +- src/short-urls/helpers/ShortUrlsRow.js | 2 +- src/short-urls/reducers/shortUrlsList.js | 8 +-- src/short-urls/services/provideServices.js | 8 +-- src/tags/TagsList.js | 2 +- src/tags/reducers/tagEdit.js | 2 +- src/tags/services/provideServices.js | 4 +- src/visits/VisitsStats.js | 2 +- src/visits/VisitsTable.js | 4 +- src/visits/helpers/LineChartCard.js | 2 +- src/visits/helpers/SortableBarGraph.js | 8 +-- src/visits/services/VisitsParser.js | 2 +- src/visits/services/provideServices.js | 4 +- test/common/ErrorHandler.test.js | 2 +- test/common/NotFound.test.js | 2 +- test/servers/CreateServer.test.js | 2 +- test/servers/DeleteServerModal.test.js | 4 +- test/servers/EditServer.test.js | 2 +- test/servers/ServersDropdown.test.js | 2 +- test/servers/helpers/ForServerVersion.test.js | 2 +- test/servers/helpers/ImportServersBtn.test.js | 2 +- test/servers/helpers/ServerError.test.js | 2 +- test/short-urls/CreateShortUrl.test.js | 2 +- test/short-urls/SearchBar.test.js | 4 +- test/short-urls/ShortUrlsList.test.js | 2 +- .../helpers/DeleteShortUrlModal.test.js | 2 +- test/short-urls/helpers/EditMetaModal.test.js | 2 +- .../helpers/EditShortUrlModal.test.js | 2 +- test/short-urls/helpers/EditTagsModal.test.js | 2 +- .../helpers/ShortUrlVisitsCount.test.js | 2 +- test/short-urls/helpers/ShortUrlsRow.test.js | 2 +- .../helpers/ShortUrlsRowMenu.test.js | 4 +- .../reducers/shortUrlDeletion.test.js | 2 +- test/short-urls/reducers/shortUrlTags.test.js | 2 +- test/tags/TagsList.test.js | 2 +- .../helpers/DeleteTagConfirmModal.test.js | 2 +- test/utils/services/ShlinkApiClient.test.js | 2 +- test/visits/ShortUrlVisits.test.js | 2 +- test/visits/ShortUrlVisitsHeader.test.js | 2 +- test/visits/TagVisits.test.js | 2 +- test/visits/TagVisitsHeader.test.js | 2 +- test/visits/VisitsHeader.test.js | 4 +- test/visits/VisitsStats.test.js | 2 +- test/visits/VisitsTable.test.js | 4 +- test/visits/helpers/SortableBarGraph.test.js | 4 +- test/visits/reducers/visitCreation.test.js | 2 +- 60 files changed, 133 insertions(+), 125 deletions(-) diff --git a/.eslintrc b/.eslintrc index e4f13c20..dcf40fae 100644 --- a/.eslintrc +++ b/.eslintrc @@ -41,6 +41,7 @@ "no-magic-numbers": "off", "react/no-array-index-key": "off", "react/no-did-update-set-state": "off", + "react/display-name": "off", "react/jsx-curly-spacing": ["error", "never"], "react/jsx-indent-props": ["error", 2], "react/jsx-first-prop-new-line": ["error", "multiline-multiprop"], @@ -52,7 +53,10 @@ "files": ["**/*.ts", "**/*.tsx"], "extends": [ "@shlinkio/js-coding-standard" - ] + ], + "rules": { + "react/display-name": "off" + } } ] } diff --git a/config/env.js b/config/env.js index f04c21ad..b57375d1 100644 --- a/config/env.js +++ b/config/env.js @@ -10,7 +10,7 @@ const { NODE_ENV } = process.env; if (!NODE_ENV) { throw new Error( - 'The NODE_ENV environment variable is required but was not specified.' + 'The NODE_ENV environment variable is required but was not specified.', ); } @@ -36,7 +36,7 @@ dotenvFiles.forEach((dotenvFile) => { require('dotenv-expand')( require('dotenv').config({ path: dotenvFile, - }) + }), ); } }); @@ -82,7 +82,7 @@ function getClientEnvironment(publicUrl) { // This should only be used as an escape hatch. Normally you would put // images into the `src` and `import` them in code to get their paths. PUBLIC_URL: publicUrl, - } + }, ); // Stringify all values so we can feed into Webpack DefinePlugin diff --git a/config/webpack.config.js b/config/webpack.config.js index babf3b02..5134e5a2 100644 --- a/config/webpack.config.js +++ b/config/webpack.config.js @@ -75,7 +75,7 @@ module.exports = (webpackEnv) => { loader: MiniCssExtractPlugin.loader, options: Object.assign( {}, - shouldUseRelativeAssetPaths ? { publicPath: '../../' } : undefined + shouldUseRelativeAssetPaths ? { publicPath: '../../' } : undefined, ), }, { @@ -281,7 +281,7 @@ module.exports = (webpackEnv) => { modules: [ 'node_modules' ].concat( // It is guaranteed to exist because we tweak it in `env.js` - process.env.NODE_PATH.split(path.delimiter).filter(Boolean) + process.env.NODE_PATH.split(path.delimiter).filter(Boolean), ), // These are the reasonable defaults supported by the Node ecosystem. @@ -372,7 +372,7 @@ module.exports = (webpackEnv) => { loader: require.resolve('babel-loader'), options: { customize: require.resolve( - 'babel-preset-react-app/webpack-overrides' + 'babel-preset-react-app/webpack-overrides', ), plugins: [ @@ -470,7 +470,7 @@ module.exports = (webpackEnv) => { importLoaders: 2, sourceMap: isEnvProduction && shouldUseSourceMap, }, - 'sass-loader' + 'sass-loader', ), // Don't consider CSS imports dead code even if the @@ -491,7 +491,7 @@ module.exports = (webpackEnv) => { modules: true, getLocalIdent: getCSSModuleLocalIdent, }, - 'sass-loader' + 'sass-loader', ), }, @@ -544,8 +544,8 @@ module.exports = (webpackEnv) => { minifyURLs: true, }, } - : undefined - ) + : undefined, + ), ), // Inlines the webpack runtime script. This script is too small to warrant diff --git a/scripts/build.js b/scripts/build.js index f76af2d4..b8854055 100644 --- a/scripts/build.js +++ b/scripts/build.js @@ -75,12 +75,12 @@ checkBrowsers(paths.appPath, isInteractive) console.log( `\nSearch for the ${ chalk.underline(chalk.yellow('keywords')) - } to learn more about each warning.` + } to learn more about each warning.`, ); console.log( `To ignore, add ${ chalk.cyan('// eslint-disable-next-line') - } to the line before.\n` + } to the line before.\n`, ); } else { console.log(chalk.green('Compiled successfully.\n')); @@ -93,7 +93,7 @@ checkBrowsers(paths.appPath, isInteractive) previousFileSizes, paths.appBuild, WARN_AFTER_BUNDLE_GZIP_SIZE, - WARN_AFTER_CHUNK_GZIP_SIZE + WARN_AFTER_CHUNK_GZIP_SIZE, ); console.log(); }, @@ -101,7 +101,7 @@ checkBrowsers(paths.appPath, isInteractive) console.log(chalk.red('Failed to compile.\n')); printBuildError(err); process.exit(1); - } + }, ) .then(() => hasVersion && !withoutDist && zipDist(version)) .catch((err) => { @@ -133,7 +133,7 @@ function build(previousFileSizes) { }); } else { messages = formatWebpackMessages( - stats.toJson({ all: false, warnings: true, errors: true }) + stats.toJson({ all: false, warnings: true, errors: true }), ); } if (messages.errors.length) { @@ -154,8 +154,8 @@ function build(previousFileSizes) { console.log( chalk.yellow( '\nTreating warnings as errors because process.env.CI = true.\n' + - 'Most CI servers set it automatically.\n' - ) + 'Most CI servers set it automatically.\n', + ), ); return reject(new Error(messages.warnings.join('\n\n'))); diff --git a/scripts/start.js b/scripts/start.js index 73842edc..68a4a08c 100644 --- a/scripts/start.js +++ b/scripts/start.js @@ -49,15 +49,15 @@ if (process.env.HOST) { console.log( chalk.cyan( `Attempting to bind to HOST environment variable: ${chalk.yellow( - chalk.bold(process.env.HOST) - )}` - ) + chalk.bold(process.env.HOST), + )}`, + ), ); console.log( - 'If this was unintentional, check that you haven\'t mistakenly set it in your shell.' + 'If this was unintentional, check that you haven\'t mistakenly set it in your shell.', ); console.log( - `Learn more here: ${chalk.yellow('http://bit.ly/CRA-advanced-config')}` + `Learn more here: ${chalk.yellow('http://bit.ly/CRA-advanced-config')}`, ); console.log(); } @@ -91,7 +91,7 @@ checkBrowsers(paths.appPath, isInteractive) // Serve webpack assets generated by the compiler over a web server. const serverConfig = createDevServerConfig( proxyConfig, - urls.lanUrlForConfig + urls.lanUrlForConfig, ); const devServer = new WebpackDevServer(compiler, serverConfig); diff --git a/src/App.js b/src/App.js index 5ed710e8..3a8716eb 100644 --- a/src/App.js +++ b/src/App.js @@ -9,32 +9,36 @@ const propTypes = { servers: PropTypes.object, }; -const App = (MainHeader, Home, MenuLayout, CreateServer, EditServer, Settings) => ({ fetchServers, servers }) => { - // On first load, try to fetch the remote servers if the list is empty - useEffect(() => { - if (Object.keys(servers).length === 0) { - fetchServers(); - } - }, []); +const App = (MainHeader, Home, MenuLayout, CreateServer, EditServer, Settings) => { + const AppComp = ({ fetchServers, servers }) => { + // On first load, try to fetch the remote servers if the list is empty + useEffect(() => { + if (Object.keys(servers).length === 0) { + fetchServers(); + } + }, []); - return ( -
- + return ( +
+ -
- - - - - - - - +
+ + + + + + + + +
-
- ); + ); + }; + + AppComp.propTypes = propTypes; + + return AppComp; }; -App.propTypes = propTypes; - export default App; diff --git a/src/common/MenuLayout.js b/src/common/MenuLayout.js index 428eeb1a..f890223d 100644 --- a/src/common/MenuLayout.js +++ b/src/common/MenuLayout.js @@ -26,7 +26,7 @@ const MenuLayout = ( ShortUrlVisits, TagVisits, ShlinkVersions, - ServerError + ServerError, ) => { const MenuLayoutComp = ({ match, location, selectedServer }) => { const [ sidebarVisible, toggleSidebar, showSidebar, hideSidebar ] = useToggle(); @@ -44,7 +44,7 @@ const MenuLayout = ( }); const swipeMenuIfNoModalExists = (callback) => (e) => { const swippedOnVisitsTable = e.event.path.some( - ({ classList }) => classList && classList.contains('visits-table') + ({ classList }) => classList && classList.contains('visits-table'), ); if (swippedOnVisitsTable || document.querySelector('.modal')) { diff --git a/src/common/services/provideServices.js b/src/common/services/provideServices.js index 1d4b288b..87454117 100644 --- a/src/common/services/provideServices.js +++ b/src/common/services/provideServices.js @@ -29,7 +29,7 @@ const provideServices = (bottle, connect, withRouter) => { 'ShortUrlVisits', 'TagVisits', 'ShlinkVersions', - 'ServerError' + 'ServerError', ); bottle.decorator('MenuLayout', connect([ 'selectedServer', 'shortUrlsListParams' ], [ 'selectServer' ])); bottle.decorator('MenuLayout', withRouter); diff --git a/src/container/index.js b/src/container/index.js index 51309435..38ec382f 100644 --- a/src/container/index.js +++ b/src/container/index.js @@ -25,7 +25,7 @@ const mapActionService = (map, actionName) => ({ const connect = (propsFromState, actionServiceNames = []) => reduxConnect( propsFromState ? pick(propsFromState) : null, - actionServiceNames.reduce(mapActionService, {}) + actionServiceNames.reduce(mapActionService, {}), ); bottle.serviceFactory('App', App, 'MainHeader', 'Home', 'MenuLayout', 'CreateServer', 'EditServer', 'Settings'); diff --git a/src/container/store.js b/src/container/store.js index 5066521a..754f3569 100644 --- a/src/container/store.js +++ b/src/container/store.js @@ -15,7 +15,7 @@ const localStorageConfig = { }; const store = createStore(reducers, load(localStorageConfig), composeEnhancers( - applyMiddleware(save(localStorageConfig), ReduxThunk) + applyMiddleware(save(localStorageConfig), ReduxThunk), )); export default store; diff --git a/src/index.js b/src/index.js index 5b6446f9..333d5115 100644 --- a/src/index.js +++ b/src/index.js @@ -28,6 +28,6 @@ render( , - document.getElementById('root') + document.getElementById('root'), ); registerServiceWorker(); diff --git a/src/registerServiceWorker.js b/src/registerServiceWorker.js index 2d6cd0ce..023439b2 100644 --- a/src/registerServiceWorker.js +++ b/src/registerServiceWorker.js @@ -18,8 +18,8 @@ const isLocalhost = Boolean( // 127.0.0.1/8 is considered localhost for IPv4. window.location.hostname.match( - /^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/ - ) + /^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/, + ), ); export default function register() { @@ -46,7 +46,7 @@ export default function register() { return navigator.serviceWorker.ready.then(() => { console.log( 'This web app is being served cache-first by a service ' + - 'worker. To learn more, visit https://goo.gl/SC7cgQ' + 'worker. To learn more, visit https://goo.gl/SC7cgQ', ); }); } @@ -110,7 +110,7 @@ function checkValidServiceWorker(swUrl) { }) .catch(() => { console.log( - 'No internet connection found. App is running in offline mode.' + 'No internet connection found. App is running in offline mode.', ); }); } diff --git a/src/servers/reducers/selectedServer.js b/src/servers/reducers/selectedServer.js index 835df2a7..07ca284d 100644 --- a/src/servers/reducers/selectedServer.js +++ b/src/servers/reducers/selectedServer.js @@ -15,7 +15,7 @@ export const LATEST_VERSION_CONSTRAINT = 'latest'; const initialState = null; const versionToSemVer = pipe( (version) => version === LATEST_VERSION_CONSTRAINT ? MAX_FALLBACK_VERSION : version, - toSemVer(MIN_FALLBACK_VERSION) + toSemVer(MIN_FALLBACK_VERSION), ); const getServerVersion = memoizeWith(identity, (serverId, health) => health().then(({ version }) => ({ @@ -27,7 +27,7 @@ export const resetSelectedServer = createAction(RESET_SELECTED_SERVER); export const selectServer = (buildShlinkApiClient, loadMercureInfo) => (serverId) => async ( dispatch, - getState + getState, ) => { dispatch(resetSelectedServer()); dispatch(resetShortUrlParams()); diff --git a/src/servers/reducers/servers.js b/src/servers/reducers/servers.js index 61c60ac4..3173d1d6 100644 --- a/src/servers/reducers/servers.js +++ b/src/servers/reducers/servers.js @@ -27,7 +27,7 @@ const serversListToMap = reduce((acc, server) => assoc(server.id, server, acc), export const createServers = pipe( map(assocId), serversListToMap, - (newServers) => ({ type: CREATE_SERVERS, newServers }) + (newServers) => ({ type: CREATE_SERVERS, newServers }), ); export const editServer = (serverId, serverData) => ({ type: EDIT_SERVER, serverId, serverData }); diff --git a/src/short-urls/SearchBar.js b/src/short-urls/SearchBar.js index 2bda7245..53232f4e 100644 --- a/src/short-urls/SearchBar.js +++ b/src/short-urls/SearchBar.js @@ -23,7 +23,7 @@ const SearchBar = (colorGenerator, ForServerVersion) => { const selectedTags = shortUrlsListParams.tags || []; const setDate = (dateName) => pipe( formatDate(), - (date) => listShortUrls({ ...shortUrlsListParams, [dateName]: date }) + (date) => listShortUrls({ ...shortUrlsListParams, [dateName]: date }), ); return ( @@ -63,7 +63,7 @@ const SearchBar = (colorGenerator, ForServerVersion) => { { ...shortUrlsListParams, tags: selectedTags.filter((selectedTag) => selectedTag !== tag), - } + }, )} /> ))} diff --git a/src/short-urls/helpers/ShortUrlsRow.js b/src/short-urls/helpers/ShortUrlsRow.js index b6788da2..f2762a9f 100644 --- a/src/short-urls/helpers/ShortUrlsRow.js +++ b/src/short-urls/helpers/ShortUrlsRow.js @@ -23,7 +23,7 @@ const propTypes = { const ShortUrlsRow = ( ShortUrlsRowMenu, colorGenerator, - useStateFlagTimeout + useStateFlagTimeout, ) => { const ShortUrlsRowComp = ({ shortUrl, selectedServer, refreshList, shortUrlsListParams }) => { const [ copiedToClipboard, setCopiedToClipboard ] = useStateFlagTimeout(); diff --git a/src/short-urls/reducers/shortUrlsList.js b/src/short-urls/reducers/shortUrlsList.js index 9953e4e2..90d2b1c8 100644 --- a/src/short-urls/reducers/shortUrlsList.js +++ b/src/short-urls/reducers/shortUrlsList.js @@ -33,9 +33,9 @@ const initialState = { const setPropFromActionOnMatchingShortUrl = (prop) => (state, { shortCode, domain, [prop]: propValue }) => assocPath( [ 'shortUrls', 'data' ], state.shortUrls.data.map( - (shortUrl) => shortUrlMatches(shortUrl, shortCode, domain) ? assoc(prop, propValue, shortUrl) : shortUrl + (shortUrl) => shortUrlMatches(shortUrl, shortCode, domain) ? assoc(prop, propValue, shortUrl) : shortUrl, ), - state + state, ); export default handleActions({ @@ -55,9 +55,9 @@ export default handleActions({ state.shortUrls && state.shortUrls.data && state.shortUrls.data.map( (shortUrl) => shortUrlMatches(shortUrl, shortCode, domain) ? assoc('visitsCount', visitsCount, shortUrl) - : shortUrl + : shortUrl, ), - state + state, ), }, initialState); diff --git a/src/short-urls/services/provideServices.js b/src/short-urls/services/provideServices.js index 46254639..ad1f71fa 100644 --- a/src/short-urls/services/provideServices.js +++ b/src/short-urls/services/provideServices.js @@ -23,7 +23,7 @@ const provideServices = (bottle, connect) => { // Components bottle.serviceFactory('ShortUrls', ShortUrls, 'SearchBar', 'ShortUrlsList'); bottle.decorator('ShortUrls', reduxConnect( - (state) => assoc('shortUrlsList', state.shortUrlsList.shortUrls, state.shortUrlsList) + (state) => assoc('shortUrlsList', state.shortUrlsList.shortUrls, state.shortUrlsList), )); bottle.serviceFactory('SearchBar', SearchBar, 'ColorGenerator', 'ForServerVersion'); @@ -32,7 +32,7 @@ const provideServices = (bottle, connect) => { bottle.serviceFactory('ShortUrlsList', ShortUrlsList, 'ShortUrlsRow'); bottle.decorator('ShortUrlsList', connect( [ 'selectedServer', 'shortUrlsListParams', 'mercureInfo' ], - [ 'listShortUrls', 'resetShortUrlParams', 'createNewVisit', 'loadMercureInfo' ] + [ 'listShortUrls', 'resetShortUrlParams', 'createNewVisit', 'loadMercureInfo' ], )); bottle.serviceFactory('ShortUrlsRow', ShortUrlsRow, 'ShortUrlsRowMenu', 'ColorGenerator', 'useStateFlagTimeout'); @@ -44,14 +44,14 @@ const provideServices = (bottle, connect) => { 'EditTagsModal', 'EditMetaModal', 'EditShortUrlModal', - 'ForServerVersion' + 'ForServerVersion', ); bottle.serviceFactory('CreateShortUrlResult', CreateShortUrlResult, 'useStateFlagTimeout'); bottle.serviceFactory('CreateShortUrl', CreateShortUrl, 'TagsSelector', 'CreateShortUrlResult', 'ForServerVersion'); bottle.decorator( 'CreateShortUrl', - connect([ 'shortUrlCreationResult', 'selectedServer' ], [ 'createShortUrl', 'resetCreateShortUrl' ]) + connect([ 'shortUrlCreationResult', 'selectedServer' ], [ 'createShortUrl', 'resetCreateShortUrl' ]), ); bottle.serviceFactory('DeleteShortUrlModal', () => DeleteShortUrlModal); diff --git a/src/tags/TagsList.js b/src/tags/TagsList.js index 9e6e9492..a923bf1b 100644 --- a/src/tags/TagsList.js +++ b/src/tags/TagsList.js @@ -23,7 +23,7 @@ const propTypes = { const TagsList = (TagCard) => { const TagListComp = ( - { filterTags, forceListTags, tagsList, selectedServer, createNewVisit, loadMercureInfo, mercureInfo } + { filterTags, forceListTags, tagsList, selectedServer, createNewVisit, loadMercureInfo, mercureInfo }, ) => { const [ displayedTag, setDisplayedTag ] = useState(); diff --git a/src/tags/reducers/tagEdit.js b/src/tags/reducers/tagEdit.js index 095d87a0..137f36df 100644 --- a/src/tags/reducers/tagEdit.js +++ b/src/tags/reducers/tagEdit.js @@ -28,7 +28,7 @@ export default handleActions({ export const editTag = (buildShlinkApiClient, colorGenerator) => (oldName, newName, color) => async ( dispatch, - getState + getState, ) => { dispatch({ type: EDIT_TAG_START }); const { editTag } = buildShlinkApiClient(getState); diff --git a/src/tags/services/provideServices.js b/src/tags/services/provideServices.js index f1bc835d..66204c16 100644 --- a/src/tags/services/provideServices.js +++ b/src/tags/services/provideServices.js @@ -18,7 +18,7 @@ const provideServices = (bottle, connect) => { 'DeleteTagConfirmModal', 'EditTagModal', 'ForServerVersion', - 'ColorGenerator' + 'ColorGenerator', ); bottle.serviceFactory('DeleteTagConfirmModal', () => DeleteTagConfirmModal); @@ -30,7 +30,7 @@ const provideServices = (bottle, connect) => { bottle.serviceFactory('TagsList', TagsList, 'TagCard'); bottle.decorator('TagsList', connect( [ 'tagsList', 'selectedServer', 'mercureInfo' ], - [ 'forceListTags', 'filterTags', 'createNewVisit', 'loadMercureInfo' ] + [ 'forceListTags', 'filterTags', 'createNewVisit', 'loadMercureInfo' ], )); // Actions diff --git a/src/visits/VisitsStats.js b/src/visits/VisitsStats.js index c30b8aa2..dc4d539d 100644 --- a/src/visits/VisitsStats.js +++ b/src/visits/VisitsStats.js @@ -68,7 +68,7 @@ const VisitsStats = ({ processStatsFromVisits, normalizeVisits }, OpenMapModalBt const normalizedVisits = useMemo(() => normalizeVisits(visits), [ visits ]); const { os, browsers, referrers, countries, cities, citiesForMap } = useMemo( () => processStatsFromVisits(normalizedVisits), - [ normalizedVisits ] + [ normalizedVisits ], ); const mapLocations = values(citiesForMap); diff --git a/src/visits/VisitsTable.js b/src/visits/VisitsTable.js index 346143ac..0beb7635 100644 --- a/src/visits/VisitsTable.js +++ b/src/visits/VisitsTable.js @@ -96,7 +96,7 @@ const VisitsTable = ({ 'visits-table__sticky': isSticky, })} onClick={() => setSelectedVisits( - selectedVisits.length < resultSet.total ? resultSet.visitsGroups.flat() : [] + selectedVisits.length < resultSet.total ? resultSet.visitsGroups.flat() : [], )} > 0 })} /> @@ -149,7 +149,7 @@ const VisitsTable = ({ style={{ cursor: 'pointer' }} className={classNames({ 'table-primary': isSelected })} onClick={() => setSelectedVisits( - isSelected ? selectedVisits.filter((v) => v !== visit) : [ ...selectedVisits, visit ] + isSelected ? selectedVisits.filter((v) => v !== visit) : [ ...selectedVisits, visit ], )} > diff --git a/src/visits/helpers/LineChartCard.js b/src/visits/helpers/LineChartCard.js index 264d3dde..3daeb969 100644 --- a/src/visits/helpers/LineChartCard.js +++ b/src/visits/helpers/LineChartCard.js @@ -117,7 +117,7 @@ const LineChartCard = ({ title, visits, highlightedVisits, highlightedLabel = 'S ); const groupedHighlighted = useMemo( () => fillTheGaps(groupVisitsByStep(step, reverse(highlightedVisits)), labels), - [ highlightedVisits, step, labels ] + [ highlightedVisits, step, labels ], ); const data = { diff --git a/src/visits/helpers/SortableBarGraph.js b/src/visits/helpers/SortableBarGraph.js index efaa03f0..7ff4c123 100644 --- a/src/visits/helpers/SortableBarGraph.js +++ b/src/visits/helpers/SortableBarGraph.js @@ -44,9 +44,9 @@ const SortableBarGraph = ({ const sortedPairs = !order.orderField ? pairs : sortBy( pipe( prop(order.orderField === head(keys(sortingItems)) ? 0 : 1), - toLowerIfString + toLowerIfString, ), - pairs + pairs, ); return !order.orderDir || order.orderDir === 'ASC' ? sortedPairs : reverse(sortedPairs); @@ -56,7 +56,7 @@ const SortableBarGraph = ({ const sortedKeys = sortedPairs.map(pickKeyFromPair); // The highlighted stats have to be ordered based on the regular stats, not on its own values const sortedHighlightedPairs = highlightedStats && toPairs( - { ...zipObj(sortedKeys, sortedKeys.map(() => 0)), ...highlightedStats } + { ...zipObj(sortedKeys, sortedKeys.map(() => 0)), ...highlightedStats }, ); if (sortedPairs.length <= itemsPerPage) { @@ -94,7 +94,7 @@ const SortableBarGraph = ({ const { currentPageStats, currentPageHighlightedStats, pagination, max } = determineStats( stats, highlightedStats && keys(highlightedStats).length > 0 ? highlightedStats : undefined, - sortingItems + sortingItems, ); const activeCities = keys(currentPageStats); const computeTitle = () => ( diff --git a/src/visits/services/VisitsParser.js b/src/visits/services/VisitsParser.js index 5ab88f71..83f984bb 100644 --- a/src/visits/services/VisitsParser.js +++ b/src/visits/services/VisitsParser.js @@ -56,7 +56,7 @@ export const processStatsFromVisits = (normalizedVisits) => return stats; }, - { os: {}, browsers: {}, referrers: {}, countries: {}, cities: {}, citiesForMap: {} } + { os: {}, browsers: {}, referrers: {}, countries: {}, cities: {}, citiesForMap: {} }, ); export const normalizeVisits = map(({ userAgent, date, referer, visitLocation }) => { diff --git a/src/visits/services/provideServices.js b/src/visits/services/provideServices.js index 18da7c20..cc7062f5 100644 --- a/src/visits/services/provideServices.js +++ b/src/visits/services/provideServices.js @@ -17,12 +17,12 @@ const provideServices = (bottle, connect) => { bottle.serviceFactory('ShortUrlVisits', ShortUrlVisits, 'VisitsStats'); bottle.decorator('ShortUrlVisits', connect( [ 'shortUrlVisits', 'shortUrlDetail', 'mercureInfo' ], - [ 'getShortUrlVisits', 'getShortUrlDetail', 'cancelGetShortUrlVisits', 'createNewVisit', 'loadMercureInfo' ] + [ 'getShortUrlVisits', 'getShortUrlDetail', 'cancelGetShortUrlVisits', 'createNewVisit', 'loadMercureInfo' ], )); bottle.serviceFactory('TagVisits', TagVisits, 'VisitsStats', 'ColorGenerator'); bottle.decorator('TagVisits', connect( [ 'tagVisits', 'mercureInfo' ], - [ 'getTagVisits', 'cancelGetTagVisits', 'createNewVisit', 'loadMercureInfo' ] + [ 'getTagVisits', 'cancelGetTagVisits', 'createNewVisit', 'loadMercureInfo' ], )); // Services diff --git a/test/common/ErrorHandler.test.js b/test/common/ErrorHandler.test.js index 721d7a0d..a98437d0 100644 --- a/test/common/ErrorHandler.test.js +++ b/test/common/ErrorHandler.test.js @@ -30,7 +30,7 @@ describe('', () => { expect(wrapper.text()).toContain('Oops! This is awkward :S'); expect(wrapper.text()).toContain( - 'It seems that something went wrong. Try refreshing the page or just click this button.' + 'It seems that something went wrong. Try refreshing the page or just click this button.', ); expect(wrapper.find(Button)).toHaveLength(1); }); diff --git a/test/common/NotFound.test.js b/test/common/NotFound.test.js index 00d3739b..036db8a6 100644 --- a/test/common/NotFound.test.js +++ b/test/common/NotFound.test.js @@ -24,7 +24,7 @@ describe('', () => { const { content } = createWrapper(); expect(content).toContain( - 'Use your browser\'s back button to navigate to the page you have previously come from, or just press this button.' + 'Use your browser\'s back button to navigate to the page you have previously come from, or just press this button.', ); }); diff --git a/test/servers/CreateServer.test.js b/test/servers/CreateServer.test.js index cab51a60..98863b2f 100644 --- a/test/servers/CreateServer.test.js +++ b/test/servers/CreateServer.test.js @@ -15,7 +15,7 @@ describe('', () => { const CreateServer = createServerConstruct(ImportServersBtn, () => [ serversImported, () => '' ]); wrapper = shallow( - + , ); return wrapper; diff --git a/test/servers/DeleteServerModal.test.js b/test/servers/DeleteServerModal.test.js index 6aca966b..1114fd8f 100644 --- a/test/servers/DeleteServerModal.test.js +++ b/test/servers/DeleteServerModal.test.js @@ -22,7 +22,7 @@ describe('', () => { isOpen={true} deleteServer={deleteServerMock} history={historyMock} - /> + />, ); }); afterEach(() => wrapper.unmount()); @@ -38,7 +38,7 @@ describe('', () => { const modalBody = wrapper.find(ModalBody); expect(modalBody.find('p').first().text()).toEqual( - `Are you sure you want to remove ${serverName}?` + `Are you sure you want to remove ${serverName}?`, ); }); diff --git a/test/servers/EditServer.test.js b/test/servers/EditServer.test.js index 36d81d2c..366dd24f 100644 --- a/test/servers/EditServer.test.js +++ b/test/servers/EditServer.test.js @@ -28,7 +28,7 @@ describe('', () => { match={match} selectedServer={selectedServer} selectServer={jest.fn()} - /> + />, ); }); diff --git a/test/servers/ServersDropdown.test.js b/test/servers/ServersDropdown.test.js index d90dbba2..f2e6bd51 100644 --- a/test/servers/ServersDropdown.test.js +++ b/test/servers/ServersDropdown.test.js @@ -37,7 +37,7 @@ describe('', () => { it('shows a message when no servers exist yet', () => { wrapped = shallow( - + , ); const item = wrapped.find(DropdownItem); diff --git a/test/servers/helpers/ForServerVersion.test.js b/test/servers/helpers/ForServerVersion.test.js index 43f486bd..171d2feb 100644 --- a/test/servers/helpers/ForServerVersion.test.js +++ b/test/servers/helpers/ForServerVersion.test.js @@ -9,7 +9,7 @@ describe('', () => { wrapped = mount( Hello - + , ); return wrapped; diff --git a/test/servers/helpers/ImportServersBtn.test.js b/test/servers/helpers/ImportServersBtn.test.js index d4c68186..fc203d28 100644 --- a/test/servers/helpers/ImportServersBtn.test.js +++ b/test/servers/helpers/ImportServersBtn.test.js @@ -23,7 +23,7 @@ describe('', () => { const ImportServersBtn = importServersBtnConstruct(serversImporterMock); wrapper = shallow( - + , ); }); afterEach(() => wrapper.unmount()); diff --git a/test/servers/helpers/ServerError.test.js b/test/servers/helpers/ServerError.test.js index 01811564..0847afe2 100644 --- a/test/servers/helpers/ServerError.test.js +++ b/test/servers/helpers/ServerError.test.js @@ -33,7 +33,7 @@ describe('', () => { wrapper = shallow( - + , ); const wrapperText = wrapper.html(); const textPairs = Object.entries(textsToFind); diff --git a/test/short-urls/CreateShortUrl.test.js b/test/short-urls/CreateShortUrl.test.js index ae47aa10..e9ca10cb 100644 --- a/test/short-urls/CreateShortUrl.test.js +++ b/test/short-urls/CreateShortUrl.test.js @@ -17,7 +17,7 @@ describe('', () => { const CreateShortUrl = createShortUrlsCreator(TagsSelector, () => '', () => ''); wrapper = shallow( - + , ); }); afterEach(() => { diff --git a/test/short-urls/SearchBar.test.js b/test/short-urls/SearchBar.test.js index 95b9b1d6..efbdddc1 100644 --- a/test/short-urls/SearchBar.test.js +++ b/test/short-urls/SearchBar.test.js @@ -52,7 +52,7 @@ describe('', () => { it('updates short URLs list when a tag is removed', () => { wrapper = shallow( - + , ); const tag = wrapper.find(Tag).first(); @@ -63,7 +63,7 @@ describe('', () => { it.each([ 'startDateChange', 'endDateChange' ])('updates short URLs list when date range changes', (event) => { wrapper = shallow( - + , ); const dateRange = wrapper.find(DateRangeRow); diff --git a/test/short-urls/ShortUrlsList.test.js b/test/short-urls/ShortUrlsList.test.js index 050238b9..65246833 100644 --- a/test/short-urls/ShortUrlsList.test.js +++ b/test/short-urls/ShortUrlsList.test.js @@ -37,7 +37,7 @@ describe('', () => { ] } mercureInfo={{ loading: true }} - /> + />, ); }); diff --git a/test/short-urls/helpers/DeleteShortUrlModal.test.js b/test/short-urls/helpers/DeleteShortUrlModal.test.js index 1cb4dbb1..c950d642 100644 --- a/test/short-urls/helpers/DeleteShortUrlModal.test.js +++ b/test/short-urls/helpers/DeleteShortUrlModal.test.js @@ -20,7 +20,7 @@ describe('', () => { toggle={identity} deleteShortUrl={deleteShortUrl} resetDeleteShortUrl={identity} - /> + />, ); return wrapper; diff --git a/test/short-urls/helpers/EditMetaModal.test.js b/test/short-urls/helpers/EditMetaModal.test.js index e44be7bd..fb20f7ac 100644 --- a/test/short-urls/helpers/EditMetaModal.test.js +++ b/test/short-urls/helpers/EditMetaModal.test.js @@ -17,7 +17,7 @@ describe('', () => { toggle={toggle} editShortUrlMeta={editShortUrlMeta} resetShortUrlMeta={resetShortUrlMeta} - /> + />, ); return wrapper; diff --git a/test/short-urls/helpers/EditShortUrlModal.test.js b/test/short-urls/helpers/EditShortUrlModal.test.js index 976cde14..a7a4ab15 100644 --- a/test/short-urls/helpers/EditShortUrlModal.test.js +++ b/test/short-urls/helpers/EditShortUrlModal.test.js @@ -15,7 +15,7 @@ describe('', () => { shortUrlEdition={shortUrlEdition} toggle={toggle} editShortUrl={editShortUrl} - /> + />, ); return wrapper; diff --git a/test/short-urls/helpers/EditTagsModal.test.js b/test/short-urls/helpers/EditTagsModal.test.js index bb9866c2..ceef068b 100644 --- a/test/short-urls/helpers/EditTagsModal.test.js +++ b/test/short-urls/helpers/EditTagsModal.test.js @@ -26,7 +26,7 @@ describe('', () => { toggle={toggle} editShortUrlTags={editShortUrlTags} resetShortUrlsTags={resetShortUrlsTags} - /> + />, ); return wrapper; diff --git a/test/short-urls/helpers/ShortUrlVisitsCount.test.js b/test/short-urls/helpers/ShortUrlVisitsCount.test.js index f12d3fe3..c7f34659 100644 --- a/test/short-urls/helpers/ShortUrlVisitsCount.test.js +++ b/test/short-urls/helpers/ShortUrlVisitsCount.test.js @@ -21,7 +21,7 @@ describe('', () => { const maxVisitsTooltip = wrapper.find(UncontrolledTooltip); expect(wrapper.html()).toEqual( - `${visitsCount}` + `${visitsCount}`, ); expect(maxVisitsHelper).toHaveLength(0); expect(maxVisitsTooltip).toHaveLength(0); diff --git a/test/short-urls/helpers/ShortUrlsRow.test.js b/test/short-urls/helpers/ShortUrlsRow.test.js index 4c0d022c..38367d45 100644 --- a/test/short-urls/helpers/ShortUrlsRow.test.js +++ b/test/short-urls/helpers/ShortUrlsRow.test.js @@ -34,7 +34,7 @@ describe('', () => { const ShortUrlsRow = createShortUrlsRow(ShortUrlsRowMenu, colorGenerator, useStateFlagTimeout); wrapper = shallow( - + , ); }); afterEach(() => wrapper.unmount()); diff --git a/test/short-urls/helpers/ShortUrlsRowMenu.test.js b/test/short-urls/helpers/ShortUrlsRowMenu.test.js index aecd2d84..28e1c5c5 100644 --- a/test/short-urls/helpers/ShortUrlsRowMenu.test.js +++ b/test/short-urls/helpers/ShortUrlsRowMenu.test.js @@ -23,7 +23,7 @@ describe('', () => { EditTagsModal, EditMetaModal, EditShortUrlModal, - () => '' + () => '', ); wrapper = shallow( @@ -31,7 +31,7 @@ describe('', () => { selectedServer={selectedServer} shortUrl={shortUrl} onCopyToClipboard={onCopyToClipboard} - /> + />, ); return wrapper; diff --git a/test/short-urls/reducers/shortUrlDeletion.test.js b/test/short-urls/reducers/shortUrlDeletion.test.js index ad5b2649..c8437c25 100644 --- a/test/short-urls/reducers/shortUrlDeletion.test.js +++ b/test/short-urls/reducers/shortUrlDeletion.test.js @@ -60,7 +60,7 @@ describe('shortUrlDeletionReducer', () => { }); it.each( - [[ undefined ], [ null ], [ 'example.com' ]] + [[ undefined ], [ null ], [ 'example.com' ]], )('dispatches proper actions if API client request succeeds', async (domain) => { const apiClientMock = { deleteShortUrl: jest.fn(() => ''), diff --git a/test/short-urls/reducers/shortUrlTags.test.js b/test/short-urls/reducers/shortUrlTags.test.js index 98bd13a7..9be9f5ef 100644 --- a/test/short-urls/reducers/shortUrlTags.test.js +++ b/test/short-urls/reducers/shortUrlTags.test.js @@ -70,7 +70,7 @@ describe('shortUrlTagsReducer', () => { expect(dispatch).toHaveBeenNthCalledWith(1, { type: EDIT_SHORT_URL_TAGS_START }); expect(dispatch).toHaveBeenNthCalledWith( 2, - { type: SHORT_URL_TAGS_EDITED, tags: normalizedTags, shortCode, domain } + { type: SHORT_URL_TAGS_EDITED, tags: normalizedTags, shortCode, domain }, ); }); diff --git a/test/tags/TagsList.test.js b/test/tags/TagsList.test.js index c3bd3393..cd20409e 100644 --- a/test/tags/TagsList.test.js +++ b/test/tags/TagsList.test.js @@ -15,7 +15,7 @@ describe('', () => { const TagsList = createTagsList(TagCard); wrapper = shallow( - + , ); return wrapper; diff --git a/test/tags/helpers/DeleteTagConfirmModal.test.js b/test/tags/helpers/DeleteTagConfirmModal.test.js index aa45d921..a13881a1 100644 --- a/test/tags/helpers/DeleteTagConfirmModal.test.js +++ b/test/tags/helpers/DeleteTagConfirmModal.test.js @@ -17,7 +17,7 @@ describe('', () => { deleteTag={deleteTag} tagDeleted={tagDeleted} tagDelete={tagDelete} - /> + />, ); return wrapper; diff --git a/test/utils/services/ShlinkApiClient.test.js b/test/utils/services/ShlinkApiClient.test.js index c1889f5d..55a4fd3b 100644 --- a/test/utils/services/ShlinkApiClient.test.js +++ b/test/utils/services/ShlinkApiClient.test.js @@ -42,7 +42,7 @@ describe('ShlinkApiClient', () => { const { createShortUrl } = new ShlinkApiClient(axiosSpy); await createShortUrl( - { foo: 'bar', empty: undefined, anotherEmpty: null } + { foo: 'bar', empty: undefined, anotherEmpty: null }, ); expect(axiosSpy).toHaveBeenCalledWith(expect.objectContaining({ data: { foo: 'bar' } })); diff --git a/test/visits/ShortUrlVisits.test.js b/test/visits/ShortUrlVisits.test.js index 38297826..89310a55 100644 --- a/test/visits/ShortUrlVisits.test.js +++ b/test/visits/ShortUrlVisits.test.js @@ -30,7 +30,7 @@ describe('', () => { shortUrlDetail={{}} cancelGetShortUrlVisits={identity} matchMedia={() => ({ matches: false })} - /> + />, ); }); diff --git a/test/visits/ShortUrlVisitsHeader.test.js b/test/visits/ShortUrlVisitsHeader.test.js index 763efc57..fef9c2ca 100644 --- a/test/visits/ShortUrlVisitsHeader.test.js +++ b/test/visits/ShortUrlVisitsHeader.test.js @@ -21,7 +21,7 @@ describe('', () => { beforeEach(() => { wrapper = shallow( - + , ); }); afterEach(() => wrapper.unmount()); diff --git a/test/visits/TagVisits.test.js b/test/visits/TagVisits.test.js index 96d3368f..023b5caf 100644 --- a/test/visits/TagVisits.test.js +++ b/test/visits/TagVisits.test.js @@ -25,7 +25,7 @@ describe('', () => { history={history} tagVisits={{ loading: true, visits: [] }} cancelGetTagVisits={identity} - /> + />, ); }); diff --git a/test/visits/TagVisitsHeader.test.js b/test/visits/TagVisitsHeader.test.js index d35d3b50..15a8defc 100644 --- a/test/visits/TagVisitsHeader.test.js +++ b/test/visits/TagVisitsHeader.test.js @@ -13,7 +13,7 @@ describe('', () => { beforeEach(() => { wrapper = shallow( - + , ); }); afterEach(() => wrapper.unmount()); diff --git a/test/visits/VisitsHeader.test.js b/test/visits/VisitsHeader.test.js index ade980e8..a23cf5ee 100644 --- a/test/visits/VisitsHeader.test.js +++ b/test/visits/VisitsHeader.test.js @@ -10,7 +10,7 @@ describe('', () => { beforeEach(() => { wrapper = shallow( - + , ); }); @@ -21,7 +21,7 @@ describe('', () => { const visitsBadge = wrapper.find('.badge'); expect(visitsBadge.html()).toContain( - `Visits: ${visits.length}` + `Visits: ${visits.length}`, ); }); diff --git a/test/visits/VisitsStats.test.js b/test/visits/VisitsStats.test.js index c3872512..b4670d22 100644 --- a/test/visits/VisitsStats.test.js +++ b/test/visits/VisitsStats.test.js @@ -24,7 +24,7 @@ describe('', () => { visitsInfo={visitsInfo} cancelGetVisits={identity} matchMedia={() => ({ matches: false })} - /> + />, ); return wrapper; diff --git a/test/visits/VisitsTable.test.js b/test/visits/VisitsTable.test.js index 0cf9e26b..fdee519d 100644 --- a/test/visits/VisitsTable.test.js +++ b/test/visits/VisitsTable.test.js @@ -16,7 +16,7 @@ describe('', () => { selectedVisits={selectedVisits} setSelectedVisits={setSelectedVisits} matchMedia={matchMedia} - /> + />, ); return wrapper; @@ -64,7 +64,7 @@ describe('', () => { }); it.each( - rangeOf(20, (value) => [ value ]) + rangeOf(20, (value) => [ value ]), )('does not render footer when there is only one page to render', (visitsCount) => { const wrapper = createWrapper(rangeOf(visitsCount, () => ({ browser: '', date: '', referer: '' }))); const tr = wrapper.find('tbody').find('tr'); diff --git a/test/visits/helpers/SortableBarGraph.test.js b/test/visits/helpers/SortableBarGraph.test.js index 12f1d09a..4ea06650 100644 --- a/test/visits/helpers/SortableBarGraph.test.js +++ b/test/visits/helpers/SortableBarGraph.test.js @@ -24,7 +24,7 @@ describe('', () => { stats={{ ...stats, ...extraStats }} sortingItems={sortingItems} withPagination={withPagination} - /> + />, ); return wrapper; @@ -108,7 +108,7 @@ describe('', () => { )} /> - + , ).find(SortableBarGraph); const header = wrapper.renderProp('extraHeaderContent')(); diff --git a/test/visits/reducers/visitCreation.test.js b/test/visits/reducers/visitCreation.test.js index e010255e..7f8dbe3b 100644 --- a/test/visits/reducers/visitCreation.test.js +++ b/test/visits/reducers/visitCreation.test.js @@ -4,7 +4,7 @@ describe('visitCreationReducer', () => { describe('createNewVisit', () => { it('just returns the action with proper type', () => expect(createNewVisit({ shortUrl: {}, visit: {} })).toEqual( - { type: CREATE_VISIT, shortUrl: {}, visit: {} } + { type: CREATE_VISIT, shortUrl: {}, visit: {} }, )); }); });