diff --git a/.eslintrc b/.eslintrc index 7949dda21f..5a16d1eb03 100644 --- a/.eslintrc +++ b/.eslintrc @@ -30,6 +30,6 @@ "@typescript-eslint/no-empty-interface": "warn", "react/prop-types": "off", "react/no-unknown-property": "warn", - "@typescript-eslint/no-var-requires":"off" + "@typescript-eslint/no-var-requires": "off" } } diff --git a/cypress/support/custom-assertions.ts b/cypress/support/custom-assertions.ts index 33449e9ba4..451639f5f6 100644 --- a/cypress/support/custom-assertions.ts +++ b/cypress/support/custom-assertions.ts @@ -40,7 +40,6 @@ const eqHowto = (chaiObj, utils) => { expected.cover_image.name, ) - expected.steps.forEach((step, index) => { expect(subject.steps[index], `Have step ${index}`).to.eqHowtoStep( step, diff --git a/functions/package.json b/functions/package.json index 05cd9dcb53..cbd84f9235 100644 --- a/functions/package.json +++ b/functions/package.json @@ -21,7 +21,7 @@ "cors": "^2.8.5", "dateformat": "^3.0.3", "express": "^4.16.4", - "firebase-admin": "8.3.0", + "firebase-admin": "^8.3.0", "firebase-functions": "^3.2.0", "fs-extra": "^7.0.1", "google-auth-library": "^2.0.1", diff --git a/functions/src/Integrations/firebase-discord.ts b/functions/src/Integrations/firebase-discord.ts index 54ccb370d5..d837720d43 100644 --- a/functions/src/Integrations/firebase-discord.ts +++ b/functions/src/Integrations/firebase-discord.ts @@ -30,7 +30,10 @@ export const notifyHowToAccepted = functions.firestore .document('v3_howtos/{id}') .onWrite(async (change, context) => { const info = change.after.exists ? change.after.data() : null - if (info === null || info.moderation !== 'accepted') { + const prevInfo = change.before.exists ? change.before.data() : null + const beenAccepted = + prevInfo !== null ? prevInfo.moderation === 'accepted' : null + if (info === null || info.moderation !== 'accepted' || beenAccepted) { return } const { _createdBy, title, slug } = info diff --git a/functions/src/Integrations/firebase-slack.ts b/functions/src/Integrations/firebase-slack.ts index 9c3ee7012a..41d736c649 100644 --- a/functions/src/Integrations/firebase-slack.ts +++ b/functions/src/Integrations/firebase-slack.ts @@ -16,6 +16,9 @@ export const notifyNewPin = functions.firestore if (info === null || info.moderation !== 'awaiting-moderation' || prevModeration === 'awaiting-moderation') { return } + if (prevModeration === 'accepted' && info.moderation !== 'awaiting-moderation'){ // If edited after being accepted keep it accepted and avoid message #1008 + return change.after.ref.parent.child('moderation').set('accepted'); + } const id = info._id const type = info.type @@ -42,9 +45,14 @@ export const notifyNewHowTo = functions.firestore .document('v3_howtos/{id}') .onWrite((change, context) => { const info = change.after.exists ? change.after.data() : null + const prevInfo = change.before.exists ? change.before.data() : null + const prevModeration = (prevInfo !== null) ? prevInfo.moderation : null; if (info === null || info.moderation !== 'awaiting-moderation') { return } + if (prevModeration === 'accepted' && info.moderation !== 'awaiting-moderation'){ // If edited after being accepted keep it accepted and avoid message #1008 + return change.after.ref.parent.child('moderation').set('accepted'); + } const user = info._createdBy const title = info.title diff --git a/functions/yarn.lock b/functions/yarn.lock index 318df14abf..2efa3c9643 100644 --- a/functions/yarn.lock +++ b/functions/yarn.lock @@ -837,9 +837,9 @@ diff@^3.2.0: integrity sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA== dot-prop@^5.1.0: - version "5.1.0" - resolved "https://registry.yarnpkg.com/dot-prop/-/dot-prop-5.1.0.tgz#bdd8c986a77b83e3fca524e53786df916cabbd8a" - integrity sha512-n1oC6NBF+KM9oVXtjmen4Yo7HyAVWV2UUl50dCYJdw2924K6dX9bf9TTTWaKtYlRn0FEtxG27KS80ayVLixxJA== + version "5.2.0" + resolved "https://registry.yarnpkg.com/dot-prop/-/dot-prop-5.2.0.tgz#c34ecc29556dc45f1f4c22697b6f4904e0cc4fcb" + integrity sha512-uEUyaDKoSQ1M4Oq8l45hSE26SnTxL6snNnqvK/VWx5wJhmff5z0FUVJDKDanor/6w3kzE3i7XZOk+7wC0EXr1A== dependencies: is-obj "^2.0.0" diff --git a/package.json b/package.json index 962d183b14..d1c72fc1b0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "precious-plastic-community-platform", - "version": "1.2.0", + "version": "1.2.1", "private": true, "scripts": { "start": "react-app-rewired start", diff --git a/scripts/build.js b/scripts/build.js new file mode 100644 index 0000000000..6424383395 --- /dev/null +++ b/scripts/build.js @@ -0,0 +1,190 @@ +'use strict' + +// Do this as the first thing so that any code reading it knows the right env. +process.env.BABEL_ENV = 'production' +process.env.NODE_ENV = 'production' + +// Makes the script crash on unhandled rejections instead of silently +// ignoring them. In the future, promise rejections that are not handled will +// terminate the Node.js process with a non-zero exit code. +process.on('unhandledRejection', err => { + throw err +}) + +// Ensure environment variables are read. +require('../config/env') + +const path = require('path') +const chalk = require('react-dev-utils/chalk') +const fs = require('fs-extra') +const webpack = require('webpack') +const bfj = require('bfj') +const configFactory = require('../config/webpack.config') +const paths = require('../config/paths') +const checkRequiredFiles = require('react-dev-utils/checkRequiredFiles') +const formatWebpackMessages = require('react-dev-utils/formatWebpackMessages') +const printHostingInstructions = require('react-dev-utils/printHostingInstructions') +const FileSizeReporter = require('react-dev-utils/FileSizeReporter') +const printBuildError = require('react-dev-utils/printBuildError') + +const measureFileSizesBeforeBuild = FileSizeReporter.measureFileSizesBeforeBuild +const printFileSizesAfterBuild = FileSizeReporter.printFileSizesAfterBuild +const useYarn = fs.existsSync(paths.yarnLockFile) + +// These sizes are pretty large. We'll warn for bundles exceeding them. +const WARN_AFTER_BUNDLE_GZIP_SIZE = 512 * 1024 +const WARN_AFTER_CHUNK_GZIP_SIZE = 1024 * 1024 + +const isInteractive = process.stdout.isTTY + +// Warn and crash if required files are missing +if (!checkRequiredFiles([paths.appHtml, paths.appIndexJs])) { + process.exit(1) +} + +// Process CLI arguments +const argv = process.argv.slice(2) +const writeStatsJson = argv.indexOf('--stats') !== -1 + +// Generate configuration +const config = configFactory('production') + +// We require that you explicitly set browsers and do not fall back to +// browserslist defaults. +const { checkBrowsers } = require('react-dev-utils/browsersHelper') +checkBrowsers(paths.appPath, isInteractive) + .then(() => { + // First, read the current file sizes in build directory. + // This lets us display how much they changed later. + return measureFileSizesBeforeBuild(paths.appBuild) + }) + .then(previousFileSizes => { + // Remove all content but keep the directory so that + // if you're in it, you don't end up in Trash + fs.emptyDirSync(paths.appBuild) + // Merge with the public folder + copyPublicFolder() + // Start the webpack build + return build(previousFileSizes) + }) + .then( + ({ stats, previousFileSizes, warnings }) => { + if (warnings.length) { + console.log(chalk.yellow('Compiled with warnings.\n')) + console.log(warnings.join('\n\n')) + console.log( + '\nSearch for the ' + + chalk.underline(chalk.yellow('keywords')) + + ' to learn more about each warning.', + ) + console.log( + 'To ignore, add ' + + chalk.cyan('// eslint-disable-next-line') + + ' to the line before.\n', + ) + } else { + console.log(chalk.green('Compiled successfully.\n')) + } + + console.log('File sizes after gzip:\n') + printFileSizesAfterBuild( + stats, + previousFileSizes, + paths.appBuild, + WARN_AFTER_BUNDLE_GZIP_SIZE, + WARN_AFTER_CHUNK_GZIP_SIZE, + ) + console.log() + + const appPackage = require(paths.appPackageJson) + const publicUrl = paths.publicUrl + const publicPath = config.output.publicPath + const buildFolder = path.relative(process.cwd(), paths.appBuild) + printHostingInstructions( + appPackage, + publicUrl, + publicPath, + buildFolder, + useYarn, + ) + }, + err => { + console.log(chalk.red('Failed to compile.\n')) + printBuildError(err) + process.exit(1) + }, + ) + .catch(err => { + if (err && err.message) { + console.log(err.message) + } + process.exit(1) + }) + +// Create the production build and print the deployment instructions. +function build(previousFileSizes) { + console.log('Creating an optimized production build...') + + const compiler = webpack(config) + return new Promise((resolve, reject) => { + compiler.run((err, stats) => { + let messages + if (err) { + if (!err.message) { + return reject(err) + } + messages = formatWebpackMessages({ + errors: [err.message], + warnings: [], + }) + } else { + messages = formatWebpackMessages( + stats.toJson({ all: false, warnings: true, errors: true }), + ) + } + if (messages.errors.length) { + // Only keep the first error. Others are often indicative + // of the same problem, but confuse the reader with noise. + if (messages.errors.length > 1) { + messages.errors.length = 1 + } + return reject(new Error(messages.errors.join('\n\n'))) + } + if ( + process.env.CI && + (typeof process.env.CI !== 'string' || + process.env.CI.toLowerCase() !== 'false') && + messages.warnings.length + ) { + console.log( + chalk.yellow( + '\nTreating warnings as errors because process.env.CI = true.\n' + + 'Most CI servers set it automatically.\n', + ), + ) + return reject(new Error(messages.warnings.join('\n\n'))) + } + + const resolveArgs = { + stats, + previousFileSizes, + warnings: messages.warnings, + } + if (writeStatsJson) { + return bfj + .write(paths.appBuild + '/bundle-stats.json', stats.toJson()) + .then(() => resolve(resolveArgs)) + .catch(error => reject(new Error(error))) + } + + return resolve(resolveArgs) + }) + }) +} + +function copyPublicFolder() { + fs.copySync(paths.appPublic, paths.appBuild, { + dereference: true, + filter: file => file !== paths.appHtml, + }) +} diff --git a/scripts/start.js b/scripts/start.js new file mode 100644 index 0000000000..82f844655b --- /dev/null +++ b/scripts/start.js @@ -0,0 +1,115 @@ +'use strict' + +// Do this as the first thing so that any code reading it knows the right env. +process.env.BABEL_ENV = 'development' +process.env.NODE_ENV = 'development' + +// Makes the script crash on unhandled rejections instead of silently +// ignoring them. In the future, promise rejections that are not handled will +// terminate the Node.js process with a non-zero exit code. +process.on('unhandledRejection', err => { + throw err +}) + +// Ensure environment variables are read. +require('../config/env') + +const fs = require('fs') +const chalk = require('react-dev-utils/chalk') +const webpack = require('webpack') +const WebpackDevServer = require('webpack-dev-server') +const clearConsole = require('react-dev-utils/clearConsole') +const checkRequiredFiles = require('react-dev-utils/checkRequiredFiles') +const { + choosePort, + createCompiler, + prepareProxy, + prepareUrls, +} = require('react-dev-utils/WebpackDevServerUtils') +const openBrowser = require('react-dev-utils/openBrowser') +const paths = require('../config/paths') +const configFactory = require('../config/webpack.config') +const createDevServerConfig = require('../config/webpackDevServer.config') + +const useYarn = fs.existsSync(paths.yarnLockFile) +const isInteractive = process.stdout.isTTY + +// Warn and crash if required files are missing +if (!checkRequiredFiles([paths.appHtml, paths.appIndexJs])) { + process.exit(1) +} + +// Tools like Cloud9 rely on this. +const DEFAULT_PORT = parseInt(process.env.PORT, 10) || 3000 +const HOST = process.env.HOST || '0.0.0.0' + +if (process.env.HOST) { + console.log( + chalk.cyan( + `Attempting to bind to HOST environment variable: ${chalk.yellow( + chalk.bold(process.env.HOST), + )}`, + ), + ) + console.log( + `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')}`, + ) + console.log() +} + +// We require that you explictly set browsers and do not fall back to +// browserslist defaults. +const { checkBrowsers } = require('react-dev-utils/browsersHelper') +checkBrowsers(paths.appPath, isInteractive) + .then(() => { + // We attempt to use the default port but if it is busy, we offer the user to + // run on a different port. `choosePort()` Promise resolves to the next free port. + return choosePort(HOST, DEFAULT_PORT) + }) + .then(port => { + if (port == null) { + // We have not found a port. + return + } + const config = configFactory('development') + const protocol = process.env.HTTPS === 'true' ? 'https' : 'http' + const appName = require(paths.appPackageJson).name + const urls = prepareUrls(protocol, HOST, port) + // Create a webpack compiler that is configured with custom messages. + const compiler = createCompiler(webpack, config, appName, urls, useYarn) + // Load proxy config + const proxySetting = require(paths.appPackageJson).proxy + const proxyConfig = prepareProxy(proxySetting, paths.appPublic) + // Serve webpack assets generated by the compiler over a web server. + const serverConfig = createDevServerConfig( + proxyConfig, + urls.lanUrlForConfig, + ) + const devServer = new WebpackDevServer(compiler, serverConfig) + // Launch WebpackDevServer. + devServer.listen(port, HOST, err => { + if (err) { + return console.log(err) + } + if (isInteractive) { + clearConsole() + } + console.log(chalk.cyan('Starting the development server...\n')) + openBrowser(urls.localUrlForBrowser) + }) + ;['SIGINT', 'SIGTERM'].forEach(function(sig) { + process.on(sig, function() { + devServer.close() + process.exit() + }) + }) + }) + .catch(err => { + if (err && err.message) { + console.log(err.message) + } + process.exit(1) + }) diff --git a/scripts/test.js b/scripts/test.js new file mode 100644 index 0000000000..0d37420b55 --- /dev/null +++ b/scripts/test.js @@ -0,0 +1,58 @@ +'use strict' + +// Do this as the first thing so that any code reading it knows the right env. +process.env.BABEL_ENV = 'test' +process.env.NODE_ENV = 'test' +process.env.PUBLIC_URL = '' + +// Makes the script crash on unhandled rejections instead of silently +// ignoring them. In the future, promise rejections that are not handled will +// terminate the Node.js process with a non-zero exit code. +process.on('unhandledRejection', err => { + throw err +}) + +// Ensure environment variables are read. +require('../config/env') + +const jest = require('jest') +const execSync = require('child_process').execSync +let argv = process.argv.slice(2) + +function isInGitRepository() { + try { + execSync('git rev-parse --is-inside-work-tree', { stdio: 'ignore' }) + return true + } catch (e) { + return false + } +} + +function isInMercurialRepository() { + try { + execSync('hg --cwd . root', { stdio: 'ignore' }) + return true + } catch (e) { + return false + } +} + +// Watch unless on CI, in coverage mode, explicitly adding `--no-watch`, +// or explicitly running all tests +if ( + !process.env.CI && + argv.indexOf('--coverage') === -1 && + argv.indexOf('--no-watch') === -1 && + argv.indexOf('--watchAll') === -1 +) { + // https://github.com/facebook/create-react-app/issues/5210 + const hasSourceControl = isInGitRepository() || isInMercurialRepository() + argv.push(hasSourceControl ? '--watch' : '--watchAll') +} + +// Jest doesn't have this option so we'll remove it +if (argv.indexOf('--no-watch') !== -1) { + argv = argv.filter(arg => arg !== '--no-watch') +} + +jest.run(argv) diff --git a/src/common/ErrorBoundary.tsx b/src/common/ErrorBoundary.tsx index 6ed8ce40da..bdbc5093f0 100644 --- a/src/common/ErrorBoundary.tsx +++ b/src/common/ErrorBoundary.tsx @@ -20,6 +20,7 @@ export default class extends React.Component { render() { if (this.state.error) { // render fallback UI + // eslint-disable-next-line return Sentry.showReportDialog()}>Report feedback } else { // when there's not an error, render children untouched diff --git a/src/components/ExternalEmbed/ExternalEmbed.tsx b/src/components/ExternalEmbed/ExternalEmbed.tsx index 323b65199f..793432cb6c 100644 --- a/src/components/ExternalEmbed/ExternalEmbed.tsx +++ b/src/components/ExternalEmbed/ExternalEmbed.tsx @@ -72,6 +72,7 @@ export class ExternalEmbed extends React.Component { height: '100%', width: '100%', }} + title="precious plastic academy" /> ) diff --git a/src/components/Icons/DownloadIcon.tsx b/src/components/Icons/DownloadIcon.tsx index cfa8dc854e..26f82031b4 100644 --- a/src/components/Icons/DownloadIcon.tsx +++ b/src/components/Icons/DownloadIcon.tsx @@ -2,5 +2,5 @@ import React from 'react' import SvgDownloadIcon from '../../assets/icons/icon-download.svg' export const DownloadIcon: React.FC<{}> = () => ( - + download-icon ) diff --git a/src/components/Icons/index.tsx b/src/components/Icons/index.tsx index 5149829329..1bbeb0d9b0 100644 --- a/src/components/Icons/index.tsx +++ b/src/components/Icons/index.tsx @@ -156,6 +156,7 @@ const Glyph = ({ glyph = '' }: IGlyphProps) => { } export class Icon extends Component { + // eslint-disable-next-line constructor(props: WrapperProps) { super(props) } diff --git a/src/components/Icons/svgs.tsx b/src/components/Icons/svgs.tsx index 351c02d984..1b189bc435 100644 --- a/src/components/Icons/svgs.tsx +++ b/src/components/Icons/svgs.tsx @@ -5,7 +5,7 @@ import loadingSVG from '../../assets/images/loading.svg' const imgStyle = { maxWidth: '100%', } -const loading = +const loading = icon export default { loading, diff --git a/src/components/ImageInput/ImageConverter.tsx b/src/components/ImageInput/ImageConverter.tsx index 66e73e45ef..a4ab3dec1b 100644 --- a/src/components/ImageInput/ImageConverter.tsx +++ b/src/components/ImageInput/ImageConverter.tsx @@ -1,6 +1,5 @@ import * as React from 'react' -import { Flex, Box } from 'rebass' -import { Button } from '../Button' +import { Flex } from 'rebass' import * as clientCompress from 'client-compress' import { IConvertedFileMeta, bytesToSize } from './ImageInput' import styled from 'styled-components' diff --git a/src/components/Loader/index.tsx b/src/components/Loader/index.tsx index 7e8b769d03..fed8f38e21 100644 --- a/src/components/Loader/index.tsx +++ b/src/components/Loader/index.tsx @@ -25,6 +25,7 @@ const RotatingLogo = styled(Image)` ` export class Loader extends React.Component { + // eslint-disable-next-line constructor(props: any) { super(props) } diff --git a/src/components/ModerationStatusText/index.tsx b/src/components/ModerationStatusText/index.tsx index a02199367a..ce66c5bfe8 100644 --- a/src/components/ModerationStatusText/index.tsx +++ b/src/components/ModerationStatusText/index.tsx @@ -1,7 +1,6 @@ import React, { FunctionComponent } from 'react' import { IHowto } from '../../models/howto.models' import { IEvent } from 'src/models/events.models' -import { Box } from 'rebass' import Text from 'src/components/Text' interface IProps { @@ -35,6 +34,7 @@ export const ModerationStatusText: FunctionComponent = ({ switch (status) { case 'accepted': return null + // eslint-disable-next-line break case 'rejected': text = 'howto' === type ? 'Needs to improve to be accepted' : 'Rejected' diff --git a/src/components/MoreContainer/MoreContainer.tsx b/src/components/MoreContainer/MoreContainer.tsx index 448524d2e1..a7ae67ccbf 100644 --- a/src/components/MoreContainer/MoreContainer.tsx +++ b/src/components/MoreContainer/MoreContainer.tsx @@ -1,5 +1,5 @@ import React from 'react' -import { Box, BoxProps, Text } from 'rebass/styled-components' +import { Box, BoxProps } from 'rebass/styled-components' import styled from 'styled-components' import theme from 'src/themes/styled.theme' import WhiteBubble0 from 'src/assets/images/white-bubble_0.svg' @@ -44,14 +44,6 @@ const MoreModalContainer = styled(Box)` } ` -const MoreText = styled(Text)` - text-align: center; - font-size: 26px; - - margin: 0 auto; - padding: 0px 20px; -` - export const MoreContainer = (props: BoxProps) => ( {props.children} ) diff --git a/src/components/ProfileModal/ProfileModal.tsx b/src/components/ProfileModal/ProfileModal.tsx index d9e9dba269..322d50bc51 100644 --- a/src/components/ProfileModal/ProfileModal.tsx +++ b/src/components/ProfileModal/ProfileModal.tsx @@ -64,6 +64,7 @@ const ModalLink = styled(NavLink).attrs(({ name }) => ({ @inject('userStore') @observer export class ProfileModal extends React.Component { + // eslint-disable-next-line constructor(props: IProps) { super(props) } diff --git a/src/components/Tags/TagDisplay/TagDisplay.tsx b/src/components/Tags/TagDisplay/TagDisplay.tsx index 3fdedfb0a6..d065ea0ea9 100644 --- a/src/components/Tags/TagDisplay/TagDisplay.tsx +++ b/src/components/Tags/TagDisplay/TagDisplay.tsx @@ -2,7 +2,6 @@ import * as React from 'react' import { inject, observer } from 'mobx-react' import { TagsStore } from 'src/stores/Tags/tags.store' import Text from 'src/components/Text' -import Styled from 'styled-components' /* This component takes a tag key as an input, looks up the tag information from the global store @@ -18,6 +17,7 @@ interface InjectedProps extends IProps { @inject('tagsStore') @observer export default class TagDisplay extends React.Component { + // eslint-disable-next-line constructor(props: any) { super(props) } diff --git a/src/mocks/maps.mock.tsx b/src/mocks/maps.mock.tsx index 4b54b6b83d..bb2e0a1153 100644 --- a/src/mocks/maps.mock.tsx +++ b/src/mocks/maps.mock.tsx @@ -1,9 +1,5 @@ import { loremIpsum } from 'lorem-ipsum' -import { - IMapPin, - IMapPinWithDetail, - IMapPinDetail, -} from 'src/models/maps.models' +import { IMapPin, IMapPinDetail } from 'src/models/maps.models' import { MOCK_DB_META } from './db.mock' import { MAP_GROUPINGS } from 'src/stores/Maps/maps.groupings' diff --git a/src/pages/Events/Content/EventsCreate/EventsCreate.tsx b/src/pages/Events/Content/EventsCreate/EventsCreate.tsx index 9eaf46da30..7ebe109636 100644 --- a/src/pages/Events/Content/EventsCreate/EventsCreate.tsx +++ b/src/pages/Events/Content/EventsCreate/EventsCreate.tsx @@ -13,7 +13,7 @@ import Flex from 'src/components/Flex' import { TagsSelectField } from 'src/components/Form/TagsSelect.field' import { inject } from 'mobx-react' import { PostingGuidelines } from './PostingGuidelines' -import { IEvent, IEventFormInput } from 'src/models/events.models' +import { IEventFormInput } from 'src/models/events.models' import { LocationSearchField } from 'src/components/Form/LocationSearch.field' import styled from 'styled-components' import theme from 'src/themes/styled.theme' diff --git a/src/pages/Events/Content/EventsList/EventsList.tsx b/src/pages/Events/Content/EventsList/EventsList.tsx index 12a41dc7ee..c05f19ee1b 100644 --- a/src/pages/Events/Content/EventsList/EventsList.tsx +++ b/src/pages/Events/Content/EventsList/EventsList.tsx @@ -2,7 +2,7 @@ import * as React from 'react' import { IEvent, IEventDB } from 'src/models/events.models' import { Button } from 'src/components/Button' import { Link } from 'src/components/Links' -import { Flex, Link as ExternalLink, Box } from 'rebass' +import { Flex, Box } from 'rebass' import { AuthWrapper } from 'src/components/Auth/AuthWrapper' import MoreContainer from 'src/components/MoreContainer/MoreContainer' import Heading from 'src/components/Heading' @@ -16,11 +16,12 @@ interface InjectedProps { eventStore: EventStore } -const filterArrayDuplicates = (array: string[]) => Array.from(new Set(array)) +// const filterArrayDuplicates = (array: string[]) => Array.from(new Set(array)) @inject('eventStore') @observer export class EventsList extends React.Component { + // eslint-disable-next-line constructor(props: any) { super(props) } diff --git a/src/pages/Events/Events.tsx b/src/pages/Events/Events.tsx index f2e72e90c6..9150e7eaea 100644 --- a/src/pages/Events/Events.tsx +++ b/src/pages/Events/Events.tsx @@ -15,6 +15,7 @@ interface IProps { @inject('eventStore') @observer class EventsPageClass extends React.Component { + // eslint-disable-next-line constructor(props: any) { super(props) } @@ -37,4 +38,4 @@ class EventsPageClass extends React.Component { ) } } -export const EventsPage = withRouter(EventsPageClass as any) +export const EventsPage: any = withRouter(EventsPageClass as any) diff --git a/src/pages/Home/Home.tsx b/src/pages/Home/Home.tsx index f43dbf8c2a..9d6af17067 100644 --- a/src/pages/Home/Home.tsx +++ b/src/pages/Home/Home.tsx @@ -28,4 +28,4 @@ class HomePageClass extends React.Component { } } -export const HomePage = withRouter(HomePageClass as any) +export const HomePage: any = withRouter(HomePageClass as any) diff --git a/src/pages/Howto/Content/Common/Howto.form.tsx b/src/pages/Howto/Content/Common/Howto.form.tsx index b99d43b5bb..f325a32c59 100644 --- a/src/pages/Howto/Content/Common/Howto.form.tsx +++ b/src/pages/Howto/Content/Common/Howto.form.tsx @@ -5,7 +5,7 @@ import styled from 'styled-components' import { FieldArray } from 'react-final-form-arrays' import arrayMutators from 'final-form-arrays' import createDecorator from 'final-form-calculate' -import { IHowtoFormInput, IHowto } from 'src/models/howto.models' +import { IHowtoFormInput } from 'src/models/howto.models' import Text from 'src/components/Text' import { UploadedFile } from 'src/pages/common/UploadedFile/UploadedFile' import { InputField, TextAreaField } from 'src/components/Form/Fields' @@ -24,7 +24,7 @@ import { stripSpecialCharacters } from 'src/utils/helpers' import { PostingGuidelines } from './PostingGuidelines' import theme from 'src/themes/styled.theme' import { DIFFICULTY_OPTIONS, TIME_OPTIONS } from './FormSettings' -import { Image, Box } from 'rebass' +import { Box } from 'rebass' import { FileInfo } from 'src/components/FileInfo/FileInfo' import { HowToSubmitStatus } from './SubmitStatus' import { required } from 'src/utils/validators' diff --git a/src/pages/Howto/Content/Common/HowtoStep.form.tsx b/src/pages/Howto/Content/Common/HowtoStep.form.tsx index c72cdb5081..51d3f960c4 100644 --- a/src/pages/Howto/Content/Common/HowtoStep.form.tsx +++ b/src/pages/Howto/Content/Common/HowtoStep.form.tsx @@ -1,4 +1,4 @@ -import React, { Component } from 'react' +import React from 'react' import { Field } from 'react-final-form' import { TextAreaField, InputField } from 'src/components/Form/Fields' import Heading from 'src/components/Heading' diff --git a/src/pages/Howto/Content/Common/PostingGuidelines.tsx b/src/pages/Howto/Content/Common/PostingGuidelines.tsx index 8072edab14..9eb9d1e8cf 100644 --- a/src/pages/Howto/Content/Common/PostingGuidelines.tsx +++ b/src/pages/Howto/Content/Common/PostingGuidelines.tsx @@ -11,7 +11,10 @@ export const PostingGuidelines = () => ( How does it work? - 1. Choose what you want to share πŸ™Œ + 1. Choose what you want to share{' '} + + πŸ™Œ + 2. Read{' '} @@ -20,26 +23,44 @@ export const PostingGuidelines = () => ( target="_blank" href="/academy/create/howto" > - our guidelines πŸ€“ + our guidelines{' '} + + πŸ€“ + - 3. Prepare your text & images πŸ—„οΈ + 3. Prepare your text & images{' '} + + πŸ—„οΈ + - 4. Create your How-to ✍️ + 4. Create your How-to{' '} + + ✍️ + - 5. Click on β€œPublish” πŸ–±οΈ + 5. Click on β€œPublish”{' '} + + πŸ–±οΈ + 6. We will either send you feedback, or - 7. Approve if everything is okay βœ… + 7. Approve if everything is okay{' '} + + βœ… + - 8. Be proud πŸ™‚ + 8. Be proud{' '} + + πŸ™‚ + ) diff --git a/src/pages/Howto/Content/Common/SubmitStatus.tsx b/src/pages/Howto/Content/Common/SubmitStatus.tsx index 3b626861e4..6dac17fd8d 100644 --- a/src/pages/Howto/Content/Common/SubmitStatus.tsx +++ b/src/pages/Howto/Content/Common/SubmitStatus.tsx @@ -20,6 +20,7 @@ interface IInjected extends IProps { @inject('howtoStore') @observer export class HowToSubmitStatus extends React.Component { + // eslint-disable-next-line constructor(props: IProps) { super(props) } diff --git a/src/pages/Howto/Content/Howto/Howto.tsx b/src/pages/Howto/Content/Howto/Howto.tsx index bf5dafa324..ca0d10213a 100644 --- a/src/pages/Howto/Content/Howto/Howto.tsx +++ b/src/pages/Howto/Content/Howto/Howto.tsx @@ -1,7 +1,6 @@ import * as React from 'react' import { RouteComponentProps } from 'react-router' // TODO add loader (and remove this material-ui dep) -import Heading from 'src/components/Heading' import { inject, observer } from 'mobx-react' import { HowtoStore } from 'src/stores/Howto/howto.store' import HowtoDescription from './HowtoDescription/HowtoDescription' diff --git a/src/pages/Howto/Content/Howto/HowtoDescription/HowtoDescription.tsx b/src/pages/Howto/Content/Howto/HowtoDescription/HowtoDescription.tsx index d11b7e4127..a1c5e45b41 100644 --- a/src/pages/Howto/Content/Howto/HowtoDescription/HowtoDescription.tsx +++ b/src/pages/Howto/Content/Howto/HowtoDescription/HowtoDescription.tsx @@ -1,4 +1,4 @@ -import React, { FC } from 'react' +import React from 'react' import TagDisplay from 'src/components/Tags/TagDisplay/TagDisplay' import { format } from 'date-fns' import { IHowtoDB } from 'src/models/howto.models' @@ -25,6 +25,7 @@ interface IProps { } export default class HowtoDescription extends React.PureComponent { + // eslint-disable-next-line constructor(props: IProps) { super(props) } diff --git a/src/pages/Howto/Howto.tsx b/src/pages/Howto/Howto.tsx index 8356492dee..574d1b0c71 100644 --- a/src/pages/Howto/Howto.tsx +++ b/src/pages/Howto/Howto.tsx @@ -4,9 +4,9 @@ import { Howto } from './Content/Howto/Howto' import CreateHowto from './Content/CreateHowto/CreateHowto' import { EditHowto } from './Content/EditHowto/EditHowto' import { HowtoList } from './Content/HowtoList/HowtoList' -import { AuthRoute } from '../common/AuthRoute' class HowtoPageClass extends React.Component { + // eslint-disable-next-line constructor(props: any) { super(props) } @@ -39,4 +39,4 @@ class HowtoPageClass extends React.Component { ) } } -export const HowtoPage = withRouter(HowtoPageClass as any) +export const HowtoPage: any = withRouter(HowtoPageClass as any) diff --git a/src/pages/Maps/Content/Controls/index.tsx b/src/pages/Maps/Content/Controls/index.tsx index 8ad182be2a..65d6fab7bc 100644 --- a/src/pages/Maps/Content/Controls/index.tsx +++ b/src/pages/Maps/Content/Controls/index.tsx @@ -143,6 +143,7 @@ class Controls extends React.Component { )} icon diff --git a/src/pages/Maps/Content/View/Cluster.tsx b/src/pages/Maps/Content/View/Cluster.tsx index e13a18b677..ed80ac1c80 100644 --- a/src/pages/Maps/Content/View/Cluster.tsx +++ b/src/pages/Maps/Content/View/Cluster.tsx @@ -6,7 +6,7 @@ import 'react-leaflet-markercluster/dist/styles.min.css' import { createClusterIcon, createMarkerIcon } from './Sprites' -import { IPinGrouping, IMapPin } from 'src/models/maps.models' +import { IMapPin } from 'src/models/maps.models' interface IProps { pins: Array @@ -16,48 +16,31 @@ interface IProps { export const Clusters: React.FunctionComponent = ({ pins, onPinClick, - children, }) => { - const entities = pins.reduce( - (accumulator, pin) => { - const grouping = pin.type - if (!accumulator.hasOwnProperty(grouping)) { - accumulator[grouping] = [] - } - accumulator[grouping].push(pin) - return accumulator - }, - {} as Record>, - ) - + /** + * Documentation of Leaflet Clusters for better understanding + * https://github.com/Leaflet/Leaflet.markercluster#clusters-methods + * + */ return ( - - {Object.keys(entities).map(key => { - return ( - { - return 30 - 5 * zoomLevel - }} - > - {entities[key].map(pin => ( - { - onPinClick(pin) - }} - /> - ))} - - ) - })} - + + {pins.map(pin => ( + { + onPinClick(pin) + }} + /> + ))} + ) } diff --git a/src/pages/Maps/Content/View/Popup.tsx b/src/pages/Maps/Content/View/Popup.tsx index 52edfdae53..9f711632c2 100644 --- a/src/pages/Maps/Content/View/Popup.tsx +++ b/src/pages/Maps/Content/View/Popup.tsx @@ -7,11 +7,7 @@ import { Popup as LeafletPopup, Map } from 'react-leaflet' import styled from 'styled-components' import { distanceInWords } from 'date-fns' -import { - IMapPin, - IMapPinWithDetail, - IMapPinDetail, -} from 'src/models/maps.models' +import { IMapPin, IMapPinWithDetail } from 'src/models/maps.models' import './popup.css' import { Link } from 'src/components/Links' @@ -44,6 +40,7 @@ const LastOnline = styled.div` @inject('mapsStore') export class Popup extends React.Component { leafletRef: React.RefObject = React.createRef() + // eslint-disable-next-line constructor(props: IProps) { super(props) } diff --git a/src/pages/Maps/Content/View/index.tsx b/src/pages/Maps/Content/View/index.tsx index 8eff0f0aae..404b1b3af0 100644 --- a/src/pages/Maps/Content/View/index.tsx +++ b/src/pages/Maps/Content/View/index.tsx @@ -1,6 +1,6 @@ import * as React from 'react' import debounce from 'debounce' -import { Map, TileLayer, ZoomControl } from 'react-leaflet' +import { Map, TileLayer } from 'react-leaflet' import 'leaflet/dist/leaflet.css' import './index.css' diff --git a/src/pages/Maps/Maps.tsx b/src/pages/Maps/Maps.tsx index 21d45f4435..2842ada43e 100644 --- a/src/pages/Maps/Maps.tsx +++ b/src/pages/Maps/Maps.tsx @@ -9,7 +9,6 @@ import { Box } from 'rebass' import './styles.css' import { ILatLng } from 'src/models/maps.models' -import { IUser } from 'src/models/user.models' import { GetLocation } from 'src/utils/geolocation' import { Map } from 'react-leaflet' import { MAP_GROUPINGS } from 'src/stores/Maps/maps.groupings' @@ -141,4 +140,4 @@ class MapsPageClass extends React.Component { } } -export const MapsPage = withRouter(MapsPageClass as any) +export const MapsPage: any = withRouter(MapsPageClass as any) diff --git a/src/pages/Password/ForgotPassword.tsx b/src/pages/Password/ForgotPassword.tsx index 430187bf0d..e2d5b74a14 100644 --- a/src/pages/Password/ForgotPassword.tsx +++ b/src/pages/Password/ForgotPassword.tsx @@ -4,8 +4,6 @@ import Heading from 'src/components/Heading' import styled from 'styled-components' import theme from 'src/themes/styled.theme' import { Button } from 'src/components/Button' -import Text from 'src/components/Text' -import { Link } from 'src/components/Links' import { Form, Field } from 'react-final-form' import { InputField } from 'src/components/Form/Fields' diff --git a/src/pages/Password/ForgotPasswordMessage.tsx b/src/pages/Password/ForgotPasswordMessage.tsx index b9f3e9f511..ca52c5ea52 100644 --- a/src/pages/Password/ForgotPasswordMessage.tsx +++ b/src/pages/Password/ForgotPasswordMessage.tsx @@ -1,13 +1,9 @@ import * as React from 'react' import Flex from 'src/components/Flex' import Heading from 'src/components/Heading' -import styled from 'styled-components' -import theme from 'src/themes/styled.theme' import { Button } from 'src/components/Button' import Text from 'src/components/Text' import { Link } from 'src/components/Links' -import { Form, Field } from 'react-final-form' -import { InputField } from 'src/components/Form/Fields' export class ForgotPasswordMessagePage extends React.Component { public render() { diff --git a/src/pages/Settings/content/formSections/Collection.section.tsx b/src/pages/Settings/content/formSections/Collection.section.tsx index 1136b8889a..627bc881fa 100644 --- a/src/pages/Settings/content/formSections/Collection.section.tsx +++ b/src/pages/Settings/content/formSections/Collection.section.tsx @@ -102,6 +102,7 @@ export class CollectionSection extends React.Component { onChange={() => { if (fields.value && fields.value.length !== 0) { if (fields.value.includes(plastic.label)) { + // eslint-disable-next-line fields.value.map((value, selectedValIndex) => { if (value === plastic.label) { fields.remove(selectedValIndex) diff --git a/src/pages/Settings/content/formSections/Expertise.section.tsx b/src/pages/Settings/content/formSections/Expertise.section.tsx index df2f964636..5c6bc26cb9 100644 --- a/src/pages/Settings/content/formSections/Expertise.section.tsx +++ b/src/pages/Settings/content/formSections/Expertise.section.tsx @@ -55,6 +55,7 @@ export class ExpertiseSection extends React.Component { onChange={() => { if (fields.value && fields.value.length !== 0) { if (fields.value.includes(xp.label)) { + // eslint-disable-next-line fields.value.map((value, selectedValIndex) => { if (value === xp.label) { fields.remove(selectedValIndex) diff --git a/src/pages/Settings/content/formSections/Fields/OpeningHoursPicker.field.tsx b/src/pages/Settings/content/formSections/Fields/OpeningHoursPicker.field.tsx index 1cdd50d0e0..7d631909b8 100644 --- a/src/pages/Settings/content/formSections/Fields/OpeningHoursPicker.field.tsx +++ b/src/pages/Settings/content/formSections/Fields/OpeningHoursPicker.field.tsx @@ -1,7 +1,6 @@ -import React, { Component } from 'react' +import React from 'react' import { WEEK_DAYS, OPENING_HOURS } from 'src/mocks/Selectors' import { Field } from 'react-final-form' -import { InputField } from 'src/components/Form/Fields' import { Button } from 'src/components/Button' import { Modal } from 'src/components/Modal/Modal' import Text from 'src/components/Text' diff --git a/src/pages/Settings/content/formSections/Focus.section.tsx b/src/pages/Settings/content/formSections/Focus.section.tsx index ebee0ffd22..4254ab2922 100644 --- a/src/pages/Settings/content/formSections/Focus.section.tsx +++ b/src/pages/Settings/content/formSections/Focus.section.tsx @@ -7,7 +7,7 @@ import { Box } from 'rebass' import { FlexSectionContainer, ArrowIsSectionOpen } from './elements' import { Link } from 'rebass' import { Button } from 'src/components/Button' -import { ProfileTypeLabel, IUserPP } from 'src/models/user_pp.models' +import { ProfileTypeLabel } from 'src/models/user_pp.models' import { PROFILE_TYPES } from 'src/mocks/user_pp.mock' import { CustomRadioField } from './Fields/CustomRadio.field' import theme from 'src/themes/styled.theme' diff --git a/src/pages/Settings/content/formSections/elements.tsx b/src/pages/Settings/content/formSections/elements.tsx index 82604dbf3f..10f652f2a6 100644 --- a/src/pages/Settings/content/formSections/elements.tsx +++ b/src/pages/Settings/content/formSections/elements.tsx @@ -21,6 +21,7 @@ export const Label = props => ( }, '&.selected': { backgroundColor: `${theme.colors.background}`, + // eslint-disable-next-line border: '1px solid ' + `${theme.colors.green}`, }, }} diff --git a/src/pages/SignIn/SignIn.tsx b/src/pages/SignIn/SignIn.tsx index 28559b890e..e5b2ca72d9 100644 --- a/src/pages/SignIn/SignIn.tsx +++ b/src/pages/SignIn/SignIn.tsx @@ -108,6 +108,7 @@ class SignInPage extends React.Component {
this.onLoginSubmit(v as IFormValues)} render={({ submitting, values, invalid, handleSubmit }) => { + // eslint-disable-next-line const disabled = invalid || submitting return ( <> diff --git a/src/pages/SignUp/ResendSignUpMessage.tsx b/src/pages/SignUp/ResendSignUpMessage.tsx index 3c06c98cd1..001a609beb 100644 --- a/src/pages/SignUp/ResendSignUpMessage.tsx +++ b/src/pages/SignUp/ResendSignUpMessage.tsx @@ -4,8 +4,6 @@ import Heading from 'src/components/Heading' import styled from 'styled-components' import theme from 'src/themes/styled.theme' import { Button } from 'src/components/Button' -import Text from 'src/components/Text' -import { Link } from 'src/components/Links' import { Form, Field } from 'react-final-form' import { InputField } from 'src/components/Form/Fields' diff --git a/src/pages/SignUp/SignUp.tsx b/src/pages/SignUp/SignUp.tsx index 5356b1a6de..0c59294703 100644 --- a/src/pages/SignUp/SignUp.tsx +++ b/src/pages/SignUp/SignUp.tsx @@ -14,7 +14,6 @@ import { RouteComponentProps, withRouter } from 'react-router' import { string, object, ref, bool } from 'yup' import { required } from 'src/utils/validators' import { formatLowerNoSpecial } from 'src/utils/helpers' -import { IUser } from 'src/models/user.models' const Label = styled.label` font-size: ${theme.fontSizes[2] + 'px'}; diff --git a/src/pages/SignUp/SignUpMessage.tsx b/src/pages/SignUp/SignUpMessage.tsx index 9511ad4ba8..8c6765b5a3 100644 --- a/src/pages/SignUp/SignUpMessage.tsx +++ b/src/pages/SignUp/SignUpMessage.tsx @@ -1,19 +1,12 @@ import * as React from 'react' import Flex from 'src/components/Flex' import Heading from 'src/components/Heading' -import styled from 'styled-components' import theme from 'src/themes/styled.theme' import { Button } from 'src/components/Button' import Text from 'src/components/Text' import { Link } from 'src/components/Links' import { Link as ExternalLink } from 'rebass' -const Label = styled.label` - font-size: ${theme.fontSizes[2] + 'px'} - margin-bottom: ${theme.space[2] + 'px'} - display: block; -` - export class SignUpMessagePage extends React.Component { public render() { return ( diff --git a/src/pages/User/User.tsx b/src/pages/User/User.tsx index d93ebd0b6b..9efa479973 100644 --- a/src/pages/User/User.tsx +++ b/src/pages/User/User.tsx @@ -13,6 +13,7 @@ interface IProps { @inject('userStore') @observer export class User extends React.Component { + // eslint-disable-next-line constructor(props: IProps) { super(props) } diff --git a/src/pages/User/content/UserPage/UserPage.tsx b/src/pages/User/content/UserPage/UserPage.tsx index 3db4cbfe7a..e3a5d92877 100644 --- a/src/pages/User/content/UserPage/UserPage.tsx +++ b/src/pages/User/content/UserPage/UserPage.tsx @@ -35,9 +35,9 @@ import PSIcon from 'src/assets/images/plastic-types/ps.svg' import PVCIcon from 'src/assets/images/plastic-types/pvc.svg' import EventsIcon from 'src/assets/icons/icon-events.svg' -import ExpertIcon from 'src/assets/icons/icon-expert.svg' +// import ExpertIcon from 'src/assets/icons/icon-expert.svg' import HowToCountIcon from 'src/assets/icons/icon-how-to.svg' -import V4MemberIcon from 'src/assets/icons/icon-v4-member.svg' +// import V4MemberIcon from 'src/assets/icons/icon-v4-member.svg' import { IUploadedFileMeta } from 'src/stores/storage' import { IConvertedFileMeta } from 'src/components/ImageInput/ImageInput' diff --git a/src/pages/admin/Admin.tsx b/src/pages/admin/Admin.tsx index b0f46fb8e0..b02c9f4f8e 100644 --- a/src/pages/admin/Admin.tsx +++ b/src/pages/admin/Admin.tsx @@ -66,4 +66,4 @@ class AdminPageClass extends React.Component { ) } } -export const AdminPage = withRouter(AdminPageClass as any) +export const AdminPage: any = withRouter(AdminPageClass as any) diff --git a/src/pages/common/Header/Header.tsx b/src/pages/common/Header/Header.tsx index 6971dd9b3b..7916795004 100644 --- a/src/pages/common/Header/Header.tsx +++ b/src/pages/common/Header/Header.tsx @@ -56,6 +56,7 @@ const AnimationContainer = posed.div({ @inject('mobileMenuStore') @observer export class Header extends React.Component { + // eslint-disable-next-line constructor(props: any) { super(props) } diff --git a/src/pages/common/Header/Menu/Logo/Logo.tsx b/src/pages/common/Header/Menu/Logo/Logo.tsx index 7c42581544..28ef0c85d1 100644 --- a/src/pages/common/Header/Menu/Logo/Logo.tsx +++ b/src/pages/common/Header/Menu/Logo/Logo.tsx @@ -23,6 +23,7 @@ const LogoContainer = styled(Flex)` ` export class Logo extends React.Component { + // eslint-disable-next-line constructor(props: any) { super(props) } diff --git a/src/pages/common/Header/Menu/MenuMobile/MenuMobileExternalLink.tsx b/src/pages/common/Header/Menu/MenuMobile/MenuMobileExternalLink.tsx index 7dbdb390c4..2d78f61c81 100644 --- a/src/pages/common/Header/Menu/MenuMobile/MenuMobileExternalLink.tsx +++ b/src/pages/common/Header/Menu/MenuMobile/MenuMobileExternalLink.tsx @@ -21,6 +21,7 @@ const PanelItem = styled(Box)` @inject('mobileMenuStore') @observer export class MenuMobileExternalLink extends React.Component { + // eslint-disable-next-line constructor(props: IProps) { super(props) } diff --git a/src/pages/common/Header/Menu/MenuMobile/MenuMobileLink.tsx b/src/pages/common/Header/Menu/MenuMobile/MenuMobileLink.tsx index 0db31fad54..0dd7d2254b 100644 --- a/src/pages/common/Header/Menu/MenuMobile/MenuMobileLink.tsx +++ b/src/pages/common/Header/Menu/MenuMobile/MenuMobileLink.tsx @@ -56,6 +56,7 @@ const MenuLink = styled(NavLink).attrs(({ name }) => ({ @inject('mobileMenuStore') @observer export class MenuMobileLink extends React.Component { + // eslint-disable-next-line constructor(props: IProps) { super(props) } diff --git a/src/pages/common/Header/Menu/Profile/ProfileButtonItem.tsx b/src/pages/common/Header/Menu/Profile/ProfileButtonItem.tsx index 7de0d961eb..f919786933 100644 --- a/src/pages/common/Header/Menu/Profile/ProfileButtonItem.tsx +++ b/src/pages/common/Header/Menu/Profile/ProfileButtonItem.tsx @@ -27,6 +27,7 @@ interface IInjectedProps extends IProps { @inject('mobileMenuStore') @observer export class ProfileButtonItem extends React.Component { + // eslint-disable-next-line constructor(props: any) { super(props) } diff --git a/src/pages/index.tsx b/src/pages/index.tsx index ff0f7dd725..dc4b5fff2f 100644 --- a/src/pages/index.tsx +++ b/src/pages/index.tsx @@ -22,6 +22,7 @@ interface IState { } export class Routes extends React.Component { + // eslint-disable-next-line constructor(props: any) { super(props) } @@ -81,7 +82,10 @@ export class Routes extends React.Component { sx={{ position: 'fixed', bottom: '30px', right: '30px' }} variant="primary" > - #Feedback? Join our chat πŸ’¬ + #Feedback? Join our chat{' '} + + πŸ’¬ + diff --git a/src/stores/Admin/admin.store.ts b/src/stores/Admin/admin.store.ts index 92e04db573..e085751a6f 100644 --- a/src/stores/Admin/admin.store.ts +++ b/src/stores/Admin/admin.store.ts @@ -17,6 +17,7 @@ export class AdminStore extends ModuleStore { public superAdmins: IUser[] = [] @observable public tags: ITag[] = [] + // eslint-disable-next-line constructor(rootStore: RootStore) { super(rootStore) } diff --git a/src/stores/Maps/maps.store.ts b/src/stores/Maps/maps.store.ts index 70ab3de70a..266fded5df 100644 --- a/src/stores/Maps/maps.store.ts +++ b/src/stores/Maps/maps.store.ts @@ -1,4 +1,4 @@ -import { observable, action, toJS } from 'mobx' +import { observable, action } from 'mobx' import { IMapPin, IBoundingBox, @@ -27,6 +27,7 @@ const MOCK_PINS = generatePins(250) const COLLECTION_NAME: IDBEndpoint = 'mappins' export class MapsStore extends ModuleStore { mapPins$: Subscription + // eslint-disable-next-line constructor(rootStore: RootStore) { super(rootStore) } diff --git a/src/stores/MobileMenu/mobilemenu.store.tsx b/src/stores/MobileMenu/mobilemenu.store.tsx index 3e99fd3ac3..7fd8798cfe 100644 --- a/src/stores/MobileMenu/mobilemenu.store.tsx +++ b/src/stores/MobileMenu/mobilemenu.store.tsx @@ -5,7 +5,7 @@ import { ModuleStore } from '../common/module.store' export class MobileMenuStore extends ModuleStore { @observable public showMobilePanel: boolean - + // eslint-disable-next-line constructor(rootStore: RootStore) { super(rootStore) } diff --git a/src/stores/Platform/platform.store.tsx b/src/stores/Platform/platform.store.tsx index 92686b1129..8bc861cc2a 100644 --- a/src/stores/Platform/platform.store.tsx +++ b/src/stores/Platform/platform.store.tsx @@ -9,6 +9,7 @@ status of service workers type ISWStatus = 'updated' | null export class PlatformStore { + // eslint-disable-next-line constructor(rootStore: RootStore) { // } diff --git a/src/stores/User/user.store.ts b/src/stores/User/user.store.ts index 9aba1de0eb..20d2f74623 100644 --- a/src/stores/User/user.store.ts +++ b/src/stores/User/user.store.ts @@ -77,7 +77,7 @@ export class UserStore extends ModuleStore { this._unsubscribeFromAuthStateChanges() await loginWithDHCredentials(email, password, this) this._listenToAuthStateChanges() - + // eslint-disable-next-line default: return auth.signInWithEmailAndPassword(email, password) } diff --git a/src/stores/_Template/template.store.tsx b/src/stores/_Template/template.store.tsx index 045bf18af7..e015f1dd3d 100644 --- a/src/stores/_Template/template.store.tsx +++ b/src/stores/_Template/template.store.tsx @@ -1,4 +1,4 @@ -import { observable, action, computed } from 'mobx' +import { observable, action } from 'mobx' import { RootStore } from '..' import { ModuleStore } from '../common/module.store' import { DBDoc } from '../databaseV2/types' @@ -17,6 +17,7 @@ type IExampleDocDB = IExampleDoc & DBDoc * including the current `activeUser` and the global database, or `db` objects */ export class TemplateStore extends ModuleStore { + // eslint-disable-next-line constructor(rootStore: RootStore) { super(rootStore) // @@ -48,6 +49,7 @@ export class TemplateStore extends ModuleStore { // example of getting an entire collection of documents and listening to live updates on the collection @action public async dbCollectionRequest() { + // eslint-disable-next-line const docs$ = await this.db.collection('tags').stream(docs => { this.exampleCollection = docs }) diff --git a/src/stores/databaseV2/clients/rtdb.tsx b/src/stores/databaseV2/clients/rtdb.tsx index 65701c6aa9..b20ed2715f 100644 --- a/src/stores/databaseV2/clients/rtdb.tsx +++ b/src/stores/databaseV2/clients/rtdb.tsx @@ -37,6 +37,7 @@ export class RealtimeDBClient implements AbstractDBClient { async queryCollection() { throw new Error('queries not available on this database') + // eslint-disable-next-line return [] } diff --git a/src/stores/databaseV2/index.tsx b/src/stores/databaseV2/index.tsx index 590a8e9ef2..c0887331ad 100644 --- a/src/stores/databaseV2/index.tsx +++ b/src/stores/databaseV2/index.tsx @@ -222,6 +222,7 @@ class DocReference { async stream() { // TODO - if deemed useful by the platform throw new Error('stream method does not currently exist for docs') + // eslint-disable-next-line return } diff --git a/src/themes/styled.theme.tsx b/src/themes/styled.theme.tsx index 1f8e2a11ba..3d16bf86ab 100644 --- a/src/themes/styled.theme.tsx +++ b/src/themes/styled.theme.tsx @@ -1,5 +1,3 @@ -import { color } from '@storybook/addon-knobs' - // use enum to specify list of possible colors for typing export const colors = { white: 'white', diff --git a/src/utils/helpers.ts b/src/utils/helpers.ts index caaca74608..a55ab8bf1d 100644 --- a/src/utils/helpers.ts +++ b/src/utils/helpers.ts @@ -62,6 +62,7 @@ export const getDay = (d: Date) => { * Validators ***********************************************************************/ export const isEmail = (email: string) => { + // eslint-disable-next-line const re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/ return re.test(email) } diff --git a/src/utils/validators.ts b/src/utils/validators.ts index 1e3188e410..aef4be4178 100644 --- a/src/utils/validators.ts +++ b/src/utils/validators.ts @@ -21,6 +21,7 @@ const validateEmail = (value: string) => { const isEmail = (email: string) => { // From this stackoverflow thread https://stackoverflow.com/a/46181 + // eslint-disable-next-line const re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/ return re.test(String(email).toLowerCase()) } diff --git a/yarn.lock b/yarn.lock index 1e6fdacfa5..2fe9c96f35 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4960,9 +4960,9 @@ bluebird@3.7.2, bluebird@^3.3.5, bluebird@^3.5.5: integrity sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg== bn.js@^4.0.0, bn.js@^4.1.0, bn.js@^4.1.1, bn.js@^4.4.0: - version "4.11.8" - resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.11.8.tgz#2cde09eb5ee341f484746bb0309b3253b1b1442f" - integrity sha512-ItfYfPLkWHUjckQCk8xC+LwxgK8NYcXywGigJgSwOP8Y2iyWT4f2vsZnoOXTTbo+o5yXmIUJ4gn5538SO5S3gA== + version "4.11.9" + resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.11.9.tgz#26d556829458f9d1e81fc48952493d0ba3507828" + integrity sha512-E6QoYqCKZfgatHTdHzs1RRKP7ip4vvm+EyRUeE2RF0NblwVvb0p6jSVeNTOFxPn26QXN2o6SMfNxKp6kU8zQaw== body-parser@1.19.0: version "1.19.0" @@ -7004,9 +7004,9 @@ element-resize-detector@^1.2.1: batch-processor "1.0.0" elliptic@^6.0.0: - version "6.5.2" - resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.5.2.tgz#05c5678d7173c049d8ca433552224a495d0e3762" - integrity sha512-f4x70okzZbIQl/NSRLkI/+tteV/9WqL98zx+SQ69KbXxmVrmjwsNUPn/gYJJ0sHvEak24cZgHIPegRePAtA/xw== + version "6.5.3" + resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.5.3.tgz#cb59eb2efdaf73a0bd78ccd7015a62ad6e0f93d6" + integrity sha512-IMqzv5wNQf+E6aHeIqATs0tOLeOTwj1QKbRcS3jBbYkl5oLAserA8yJTT7/VyHUYG91PRmPyeQDObKLPpeS4dw== dependencies: bn.js "^4.4.0" brorand "^1.0.1"