Skip to content

Commit

Permalink
Merge branch '2543-poi-panel-scrollable-horizontally' of github.com:d…
Browse files Browse the repository at this point in the history
…igitalfabrik/integreat-app into 2543-poi-panel-scrollable-horizontally
  • Loading branch information
lunars97 committed Nov 8, 2023
2 parents eddc7bc + a233b6b commit 4fac0a6
Show file tree
Hide file tree
Showing 38 changed files with 79 additions and 103 deletions.
4 changes: 3 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -485,8 +485,10 @@ jobs:
command: yarn prettier:check
name: Prettier
- run:
command: yarn lint
command: yarn lint:ci
name: Lint
- store_test_results:
path: reports/lint
- run:
command: yarn workspace web stylelint
name: Stylelint
Expand Down
4 changes: 3 additions & 1 deletion .circleci/src/jobs/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ steps:
command: yarn prettier:check
- run:
name: Lint
command: yarn lint
command: yarn lint:ci
- store_test_results:
path: reports/lint
- run:
name: Stylelint
command: yarn workspace web stylelint
Expand Down
38 changes: 21 additions & 17 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,15 @@ module.exports = {
'jest/globals': true,
},
ignorePatterns: [
'**/reports/',
'**/node_modules/',
'**/ios/',
'**/stylelint.config.js',
'**/stylelint.config_css.js',
'**/dist/',
'**/lib-dist/',
'.eslintrc.js',
'**/babel.config.js',
'**/react-native.config.js',
'**/www/iframe.js',
'**/www/rasa-widget/chatbot.js',
'**/www/plugins/mapbox-gl-rtl-text-0.2.3.min.js',
'**/integreat-e2e/assets/**', //symlink
'**/integreat-test-cms/assets/**', //symlink
'reports/',
'node_modules/',
'ios/',
'android/',
'dist/',
'/.eslintrc.js',
'/web/www/',
'/build-configs/integreat-e2e/assets/', //symlink
'/build-configs/integreat-test-cms/assets/', //symlink
],
rules: {
// Overly strict rules (for now)
Expand All @@ -56,7 +50,9 @@ module.exports = {
// Unwanted
'lines-between-class-members': 'off',
'import/extensions': 'off',
'import/named': 'off',
'import/prefer-default-export': 'off',
'import/no-named-as-default-member': 'off',
'react/require-default-props': 'off',
'react/sort-comp': 'off',
'jest/expect-expect': 'off',
Expand Down Expand Up @@ -157,14 +153,20 @@ module.exports = {
},
},
{
files: ['**/native/**'],
files: ['e2e-tests/**/*.conf.ts'],
rules: {
'no-magic-numbers': 'off',
},
},
{
files: ['native/**'],
rules: {
// This rule does not make sense in react native as we don't have normal anchor tags
'jsx-a11y/anchor-is-valid': 'off',
},
},
{
files: ['**/tools/**', '**/translations/**', '**/e2e-tests/**'],
files: ['**/tools/**', 'translations/**', 'e2e-tests/**', 'metro.config.js'],
rules: {
'no-console': 'off',
'import/no-extraneous-dependencies': 'off',
Expand All @@ -174,11 +176,13 @@ module.exports = {
files: ['tools/**', 'e2e-tests/**'],
plugins: ['unicorn'],
rules: {
// esm specific rules
'import/no-commonjs': 'error',
'unicorn/prefer-node-protocol': 'error',
},
},
],
reportUnusedDisableDirectives: true,
settings: {
react: {
version: 'detect',
Expand Down
3 changes: 0 additions & 3 deletions .eslintrc_changed.js

This file was deleted.

5 changes: 1 addition & 4 deletions api-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@
"test": "jest",
"test:changed": "yarn run test -o",
"test:watch": "yarn run test --watchAll",
"lint": "yarn run eslint .",
"lint:changed": "eslint . -c ../.eslintrc_changed.js",
"lint:fix": "yarn run eslint --fix",
"lint:ci": "yarn run eslint --quiet --format junit -o reports/lint/junit-lint.xml",
"lint": "eslint --cache --cache-location ../.eslintcache .",
"ts:check": "tsc --build"
},
"peerDependencies": {
Expand Down
1 change: 1 addition & 0 deletions api-client/src/models/EventModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ class EventModel extends ExtendedPageModel {
body.push(
`DESCRIPTION:${getExcerpt(excerpt, {
query: undefined,
maxChars: 150,
replaceLineBreaks: false,
})}\\n\\n${url}`,
Expand Down
1 change: 0 additions & 1 deletion api-client/src/models/PoiModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ class PoiModel extends ExtendedPageModel {
return (
this._category ??
new PoiCategoryModel({
// eslint-disable-next-line no-magic-numbers
id: 12,
name: 'Others',
color: '#2E98FB',
Expand Down
1 change: 0 additions & 1 deletion api-client/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable camelcase */
export type JsonAvailableLanguagesType = Record<
string,
{
Expand Down
5 changes: 3 additions & 2 deletions api-client/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"composite": true,
"lib": ["ES5", "ES6", "dom"],
"outDir": "dist",
"types": ["jest"]
"types": ["jest", "node"],
"typeRoots": ["src/@types", "node_modules/@types", "../node_modules/@types"]
},
"include": ["src/**/*", "jest.config.ts", "jest.setup.ts"]
"include": ["jest.config.ts", "jest.setup.ts", "src/**/*"]
}
5 changes: 1 addition & 4 deletions build-configs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@
"scripts": {
"manage": "ts-node tools/manage.ts",
"ts:check": "tsc --build",
"lint": "yarn run eslint .",
"lint:changed": "eslint . -c ../.eslintrc_changed.js",
"lint:fix": "yarn run eslint --fix",
"lint:ci": "yarn run eslint --quiet --format junit -o reports/lint/junit-lint.xml"
"lint": "eslint --cache --cache-location ../.eslintcache ."
}
}
2 changes: 2 additions & 0 deletions e2e-tests/native/capabilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const browserstackCaps = (
debug: true,
realMobile: isCi,
appiumVersion: '2.0.0',

idleTimeout: 10000,
},
...config,
Expand All @@ -39,6 +40,7 @@ export default {
{
'appium:platformVersion': '16',
'appium:deviceName': 'iPhone 14',

'appium:waitForIdleTimeout': 10000,
},
'ios',
Expand Down
2 changes: 1 addition & 1 deletion e2e-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"prepare:native:android": "yarn workspace native android:integreat-e2e",
"prepare:native:start": "yarn workspace native start:integreat-e2e",
"prepare:web:start": "yarn workspace web start:integreat-e2e",
"lint": "yarn eslint ./",
"lint": "eslint --cache --cache-location ../.eslintcache .",
"ts:check": "tsc --build"
},
"devDependencies": {
Expand Down
2 changes: 0 additions & 2 deletions native/jest.setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ jest.mock('react-native-permissions', () => require('react-native-permissions/mo
require('react-native-gesture-handler/jestSetup')

jest.mock('react-native-reanimated', () => {
// eslint-disable-next-line @typescript-eslint/no-var-requires
const Reanimated = require('react-native-reanimated/mock')

Reanimated.default.call = () => undefined
Expand Down Expand Up @@ -59,7 +58,6 @@ jest.doMock('path', () => path.posix)

// See https://github.com/callstack/react-native-testing-library/issues/329#issuecomment-737307473
jest.mock('react-native/Libraries/Components/Switch/Switch', () => {
// eslint-disable-next-line @typescript-eslint/no-var-requires
const mockComponent = require('react-native/jest/mockComponent')

return mockComponent('react-native/Libraries/Components/Switch/Switch')
Expand Down
1 change: 0 additions & 1 deletion native/metro.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable import/no-extraneous-dependencies */
/* eslint-disable @typescript-eslint/no-var-requires */
const { getDefaultConfig, mergeConfig } = require('@react-native/metro-config')
const path = require('path')
Expand Down
5 changes: 1 addition & 4 deletions native/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,7 @@
"test": "jest",
"test:changed": "yarn run test -o",
"test:e2e": "yarn workspace e2e test:native:browserstack",
"lint": "yarn run eslint",
"lint:changed": "eslint . -c ../.eslintrc_changed.js",
"lint:ci": "yarn run eslint --quiet --format junit -o reports/lint/junit-lint.xml",
"eslint": "eslint .",
"lint": "eslint --cache --cache-location ../.eslintcache .",
"license-crawler": "npm-license-crawler -onlyDirectDependencies -json ./src/assets/licenses.json",
"postinstall": "patch-package && yarn license-crawler",
"ts:check": "tsc --build",
Expand Down
2 changes: 1 addition & 1 deletion native/src/@types/styled.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ import 'styled-components'
import { ThemeType } from 'build-configs/ThemeType'

declare module 'styled-components' {
// eslint-disable-next-line @typescript-eslint/no-empty-interface,@typescript-eslint/consistent-type-definitions
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
export interface DefaultTheme extends ThemeType {}
}
1 change: 1 addition & 0 deletions native/src/components/List.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ const List = <T,>({
showsVerticalScrollIndicator={false}
contentContainerStyle={{
flexGrow: 1,

paddingHorizontal: 10,
}}
onEndReachedThreshold={1}
Expand Down
1 change: 1 addition & 0 deletions native/src/components/RemoteContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ const RemoteContent = (props: RemoteContentProps): ReactElement | null => {
setSupportMultipleWindows={false}
style={{
height: webViewHeight,

opacity: 0.99, // fixes crashing in Android https://github.com/react-native-webview/react-native-webview/issues/811
}}
/>
Expand Down
7 changes: 4 additions & 3 deletions native/src/components/__tests__/FeedbackContainer.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ import render from '../../testing/render'
import sendTrackingSignal from '../../utils/sendTrackingSignal'
import FeedbackContainer from '../FeedbackContainer'

const mockRequest = jest.fn(() => Promise.resolve())
const mockRequest = jest.fn(() => {
/* ignore */
})
jest.mock('styled-components')
jest.mock('react-i18next')
jest.mock('../../utils/sendTrackingSignal')
Expand All @@ -41,7 +43,7 @@ describe('FeedbackContainer', () => {
)
const positiveRatingButton = getByText('useful')
fireEvent.press(positiveRatingButton)
expect(await findByText('send')).not.toBeDisabled()
expect(getByText('send')).not.toBeDisabled()
const submitButton = getByText('send')
fireEvent.press(submitButton)
expect(await findByText('thanksMessage')).toBeDefined()
Expand Down Expand Up @@ -72,7 +74,6 @@ describe('FeedbackContainer', () => {
const contactMail = 'test@example.com'
const { getByText, findByText, getAllByDisplayValue } = render(
<NavigationContainer>
{' '}
<FeedbackContainer routeType={CATEGORIES_ROUTE} isSearchFeedback={false} language={language} cityCode={city} />
</NavigationContainer>,
)
Expand Down
2 changes: 2 additions & 0 deletions native/src/hooks/useUserLocation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ const useUserLocation = (useSettingsListener = false): LocationInformationType =
},
{
enableHighAccuracy: true,

timeout: 50000,

maximumAge: 3600000,
},
)
Expand Down
1 change: 1 addition & 0 deletions native/src/routes/Intro.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ const Intro = ({ route, navigation }: IntroProps): ReactElement => {
pagingEnabled
viewabilityConfig={{
itemVisiblePercentThreshold: 51,

minimumViewTime: 0.1,
}}
onViewableItemsChanged={onViewableItemsChanged}
Expand Down
13 changes: 7 additions & 6 deletions native/src/routes/JpalTracking.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { NavigationAction } from '@react-navigation/native'
import React, { ReactElement, useCallback, useEffect, useState } from 'react'
import { useTranslation } from 'react-i18next'
import { Alert, Text, View } from 'react-native'
import { Alert, Text } from 'react-native'
import styled from 'styled-components/native'

import { JpalTrackingRouteType } from 'api-client'
Expand Down Expand Up @@ -34,6 +34,10 @@ const DescriptionContainer = styled(Pressable)`
padding: 15px 0 5px;
`

const PaddedContainer = styled.View`
padding: 40px;
`

export type JpalTrackingProps = {
navigation: NavigationProps<JpalTrackingRouteType>
}
Expand Down Expand Up @@ -107,10 +111,7 @@ const JpalTracking = ({ navigation }: JpalTrackingProps): ReactElement => {

return (
<Layout>
<View
style={{
padding: 40,
}}>
<PaddedContainer>
<Caption title={t('tracking')} />
<Text>{t('trackingDescription', { appName: buildConfig().appName })}</Text>

Expand All @@ -120,7 +121,7 @@ const JpalTracking = ({ navigation }: JpalTrackingProps): ReactElement => {
</DescriptionContainer>

<Link url={moreInformationUrl} text={t('trackingMoreInformation')} />
</View>
</PaddedContainer>
</Layout>
)
}
Expand Down
1 change: 0 additions & 1 deletion native/src/utils/DatabaseConnector.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable camelcase */
import { BBox } from 'geojson'
import { map, mapValues } from 'lodash'
import { DateTime } from 'luxon'
Expand Down
8 changes: 3 additions & 5 deletions native/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,13 @@
"include": [
"src/**/*",
"jest.setup.ts",
"src/assets/licenses.json",
"index.ts",
"jest.config.ts",
"babel.config.js",
"metro.config.ci.js",
"metro.config.js",
".yarn/plugins/root-command.js",
"react-native.config.js",
"run.js",
"src/assets/licenses.json"
"metro.config.ci.js",
"metro.config.js"
],
"references": [
{
Expand Down
11 changes: 5 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@
},
"scripts": {
"prepare": "husky install",
"lint": "yarn run eslint",
"lint:changed": "eslint . -c .eslintrc_changed.js",
"test": "yarn jest",
"test:changed": "yarn jest -o",
"test:ci": "yarn test --coverage --ci",
"lint": "eslint --cache --cache-location .eslintcache .",
"lint:ci": "yarn node --max-old-space-size=1535 $(yarn bin eslint) --format junit -o reports/lint/junit-lint.xml .",
"test": "jest",
"test:changed": "jest -o",
"test:ci": "jest --coverage --ci",
"circleci:update-config": "{ cat .circleci/autogenerated_header.yml; circleci config pack .circleci/src; } > .circleci/config.yml && circleci config validate",
"prettier:check": "prettier --check .",
"prettier:write": "prettier --write .",
Expand All @@ -49,7 +49,6 @@
"eslint": "8.48.0",
"eslint-config-airbnb": "^19.0.4",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-diff": "^2.0.1",
"eslint-plugin-import": "^2.28.1",
"eslint-plugin-jest": "^27.2.3",
"eslint-plugin-jsx-a11y": "^6.7.1",
Expand Down
4 changes: 1 addition & 3 deletions translations/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@
"import:ods:override-malte": "./tools/ods-to-csv malte-ods malte-csv && yarn manage convert malte-csv override-translations/malte.json json&& rm -rf malte-csv ",
"import:ods:override-aschaffenburg": "./tools/ods-to-csv aschaffenburg-ods aschaffenburg-csv && yarn manage convert aschaffenburg-csv override-translations/aschaffenburg.json json && rm -rf aschaffenburg-csv",
"test": "jest --config jest.config.ts",
"lint": "yarn run eslint .",
"lint:fix": "yarn run eslint --fix",
"lint:ci": "yarn run eslint --quiet --format junit -o reports/lint/junit-lint.xml",
"lint": "eslint --cache --cache-location ../.eslintcache .",
"ts:check": "tsc --build"
},
"dependencies": {},
Expand Down
2 changes: 1 addition & 1 deletion translations/src/__mocks__/loadTranslations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export const testTranslations: TranslationsType = {
},
},
}
// eslint-disable-next-line no-unused-vars

export const testOverrideTranslations: TranslationsType = {
dashboard: {
de: {
Expand Down
Loading

0 comments on commit 4fac0a6

Please sign in to comment.