diff --git a/CliClient/package.json b/CliClient/package.json
index bec4b55944..b2d1b06908 100644
--- a/CliClient/package.json
+++ b/CliClient/package.json
@@ -6,7 +6,7 @@
"scripts": {
"test": "gulp buildTests -L && node node_modules/jasmine/bin/jasmine.js --fail-fast=true --config=tests/support/jasmine.json",
"test-ci": "gulp buildTests -L && node node_modules/jasmine/bin/jasmine.js --config=tests/support/jasmine.json",
- "postinstall": "npm run build && patch-package --patch-dir ../patches",
+ "postinstall": "npm run build && patch-package --patch-dir ../patches/shared && patch-package --patch-dir ../patches/node",
"build": "gulp build",
"start": "gulp build -L && node 'build/main.js' --stack-trace-enabled --log-level debug --env dev"
},
diff --git a/CliClient/tests/InMemoryCache.ts b/CliClient/tests/InMemoryCache.ts
index c9acb797ae..3498dd0f09 100644
--- a/CliClient/tests/InMemoryCache.ts
+++ b/CliClient/tests/InMemoryCache.ts
@@ -8,7 +8,7 @@ describe('InMemoryCache', function() {
expect(cache.value('test')).toBe(undefined);
expect(cache.value('test', 'default')).toBe('default');
-
+
cache.setValue('test', 'something');
expect(cache.value('test')).toBe('something');
@@ -42,7 +42,7 @@ describe('InMemoryCache', function() {
it('should delete old records', async () => {
const cache = new InMemoryCache(5);
-
+
cache.setValue('1', '1');
cache.setValue('2', '2');
cache.setValue('3', '3');
@@ -55,5 +55,5 @@ describe('InMemoryCache', function() {
expect(cache.value('1')).toBe(undefined);
});
-
+
});
diff --git a/CliClient/tests/services_rest_Api.ts b/CliClient/tests/services_rest_Api.ts
index 210cd463b6..6306bed43d 100644
--- a/CliClient/tests/services_rest_Api.ts
+++ b/CliClient/tests/services_rest_Api.ts
@@ -146,7 +146,7 @@ describe('services_rest_Api', function() {
}));
const noteId = response.id;
-
+
{
const note = await Note.load(noteId);
expect(note.latitude).toBe('48.73207100');
@@ -154,7 +154,7 @@ describe('services_rest_Api', function() {
expect(note.altitude).toBe('21.0000');
}
- await api.route('PUT', 'notes/' + noteId, null, JSON.stringify({
+ await api.route('PUT', `notes/${noteId}`, null, JSON.stringify({
latitude: '49',
longitude: '-3',
altitude: '22',
diff --git a/ElectronClient/package.json b/ElectronClient/package.json
index 976f3a3990..73c287cf26 100644
--- a/ElectronClient/package.json
+++ b/ElectronClient/package.json
@@ -5,7 +5,7 @@
"main": "main.js",
"scripts": {
"dist": "node_modules/.bin/electron-builder",
- "build": "patch-package --patch-dir ../patches && gulp build",
+ "build": "patch-package --patch-dir ../patches/shared && patch-package --patch-dir ../patches/node && gulp build",
"postinstall": "npm run build && gulp electronRebuild",
"start": "gulp build && electron . --env dev --log-level debug --no-welcome --open-dev-tools"
},
diff --git a/ReactNativeClient/App.js b/ReactNativeClient/App.js
deleted file mode 100644
index 23cd158d89..0000000000
--- a/ReactNativeClient/App.js
+++ /dev/null
@@ -1,114 +0,0 @@
-/**
- * Sample React Native App
- * https://github.com/facebook/react-native
- *
- * @format
- * @flow strict-local
- */
-
-import React from 'react';
-import {
- SafeAreaView,
- StyleSheet,
- ScrollView,
- View,
- Text,
- StatusBar,
-} from 'react-native';
-
-import {
- Header,
- LearnMoreLinks,
- Colors,
- DebugInstructions,
- ReloadInstructions,
-} from 'react-native/Libraries/NewAppScreen';
-
-const App: () => React$Node = () => {
- return (
- <>
-
-
-
-
- {global.HermesInternal == null ? null : (
-
- Engine: Hermes
-
- )}
-
-
- Step One
-
- Edit App.js to change this
- screen and then come back to see your edits.
-
-
-
- See Your Changes
-
-
-
-
-
- Debug
-
-
-
-
-
- Learn More
-
- Read the docs to discover what to do next:
-
-
-
-
-
-
- >
- );
-};
-
-const styles = StyleSheet.create({
- scrollView: {
- backgroundColor: Colors.lighter,
- },
- engine: {
- position: 'absolute',
- right: 0,
- },
- body: {
- backgroundColor: Colors.white,
- },
- sectionContainer: {
- marginTop: 32,
- paddingHorizontal: 24,
- },
- sectionTitle: {
- fontSize: 24,
- fontWeight: '600',
- color: Colors.black,
- },
- sectionDescription: {
- marginTop: 8,
- fontSize: 18,
- fontWeight: '400',
- color: Colors.dark,
- },
- highlight: {
- fontWeight: '700',
- },
- footer: {
- color: Colors.dark,
- fontSize: 12,
- fontWeight: '600',
- padding: 4,
- paddingRight: 12,
- textAlign: 'right',
- },
-});
-
-export default App;
diff --git a/ReactNativeClient/__tests__/App-test.js b/ReactNativeClient/__tests__/App-test.js
deleted file mode 100644
index 178476699b..0000000000
--- a/ReactNativeClient/__tests__/App-test.js
+++ /dev/null
@@ -1,14 +0,0 @@
-/**
- * @format
- */
-
-import 'react-native';
-import React from 'react';
-import App from '../App';
-
-// Note: test renderer must be required after react-native.
-import renderer from 'react-test-renderer';
-
-it('renders correctly', () => {
- renderer.create();
-});
diff --git a/ReactNativeClient/babel.config.js b/ReactNativeClient/babel.config.js
index f842b77fcf..e953058a74 100644
--- a/ReactNativeClient/babel.config.js
+++ b/ReactNativeClient/babel.config.js
@@ -1,3 +1,3 @@
module.exports = {
- presets: ['module:metro-react-native-babel-preset'],
+ presets: ['module:metro-react-native-babel-preset'],
};
diff --git a/ReactNativeClient/index.js b/ReactNativeClient/index.js
index 645afe90e7..792be0d4f1 100644
--- a/ReactNativeClient/index.js
+++ b/ReactNativeClient/index.js
@@ -6,8 +6,8 @@
// So there's basically still a one way flux: React => SQLite => Redux => React
-import {LogBox, AppRegistry} from 'react-native';
-const {Root} = require('./root.js');
+import { LogBox, AppRegistry } from 'react-native';
+const { Root } = require('./root.js');
// Seems JavaScript developers love adding warnings everywhere, even when these warnings can't be fixed
// or don't really matter. Because we want important warnings to actually be fixed, we disable
@@ -17,7 +17,7 @@ LogBox.ignoreLogs([
// Happens for example in react-native-side-menu, but the package is discontinued
// and we should just switch to a different one (or do it without a package).
'Animated: `useNativeDriver` was not specified. This is a required option and must be explicitly set to `true` or `false`',
-
+
// What's the point of printing warnings for non-user code. Of all the things that
// are broken and unreliable in React Native, require cycles are just a minor annoyance
// which shouldn't forever print warnings.
@@ -29,7 +29,7 @@ LogBox.ignoreLogs([
'Require cycle: node_modules\\rn-fetch-blob',
'Require cycle: node_modules/aws-sdk',
'Require cycle: node_modules\\aws-sdk',
-
+
// It's being updated over time and we don't need to see these warnings all the time
'Warning: componentWillReceiveProps has been renamed',
'Warning: componentWillUpdate has been renamed',
diff --git a/ReactNativeClient/lib/InMemoryCache.ts b/ReactNativeClient/lib/InMemoryCache.ts
index 3fe84d6fd7..aa1c6fbbef 100644
--- a/ReactNativeClient/lib/InMemoryCache.ts
+++ b/ReactNativeClient/lib/InMemoryCache.ts
@@ -36,7 +36,7 @@ export default class Cache {
private checkExpiredRecords() {
const now = Date.now();
- for (let key in this.expirableKeys_) {
+ for (const key in this.expirableKeys_) {
if (!this.records_[key]) {
delete this.expirableKeys_[key];
} else {
@@ -68,7 +68,7 @@ export default class Cache {
this.records_[key] = {
value: value,
expiredTime: ttl ? Date.now() + ttl : 0,
- }
+ };
const idx = this.recordKeyHistory_.indexOf(key);
if (idx >= 0) this.recordKeyHistory_.splice(idx, 1);
diff --git a/ReactNativeClient/lib/WebDavApi.js b/ReactNativeClient/lib/WebDavApi.js
index 6be99b9172..6319746ad4 100644
--- a/ReactNativeClient/lib/WebDavApi.js
+++ b/ReactNativeClient/lib/WebDavApi.js
@@ -337,16 +337,16 @@ class WebDavApi {
async exec(method, path = '', body = null, headers = null, options = null) {
headers = Object.assign({}, headers);
options = Object.assign({}, options);
-
+
if (!options.responseFormat) options.responseFormat = 'json';
if (!options.target) options.target = 'string';
const authToken = this.authToken();
if (authToken) headers['Authorization'] = `Basic ${authToken}`;
-
+
// That should not be needed, but it is required for React Native 0.63+
- // https://github.com/facebook/react-native/issues/30176
+ // https://github.com/facebook/react-native/issues/30176
if (!headers['Content-Type']) {
if (method === 'PROPFIND') headers['Content-Type'] = 'text/xml';
if (method === 'PUT') headers['Content-Type'] = 'text/plain';
diff --git a/ReactNativeClient/lib/components/NoteBodyViewer/NoteBodyViewer.tsx b/ReactNativeClient/lib/components/NoteBodyViewer/NoteBodyViewer.tsx
index e45432f382..a4633b5dbc 100644
--- a/ReactNativeClient/lib/components/NoteBodyViewer/NoteBodyViewer.tsx
+++ b/ReactNativeClient/lib/components/NoteBodyViewer/NoteBodyViewer.tsx
@@ -29,7 +29,7 @@ interface Props {
export default function NoteBodyViewer(props:Props) {
const theme = themeStyle(props.themeId);
-
+
const webViewStyle:any = useMemo(() => {
return { backgroundColor: theme.backgroundColor };
}, [theme.backgroundColor]);
@@ -43,7 +43,7 @@ export default function NoteBodyViewer(props:Props) {
props.highlightedKeywords,
props.noteResources,
props.paddingBottom,
- props.noteHash
+ props.noteHash
);
const onResourceLongPress = useOnResourceLongPress(
@@ -64,7 +64,7 @@ export default function NoteBodyViewer(props:Props) {
}, [props.onLoadEnd]);
function onError() {
- reg.logger().error('WebView error')
+ reg.logger().error('WebView error');
}
// On iOS scalesPageToFit work like this:
@@ -108,4 +108,4 @@ export default function NoteBodyViewer(props:Props) {
);
-}
\ No newline at end of file
+}
diff --git a/ReactNativeClient/lib/components/NoteBodyViewer/hooks/useOnMessage.ts b/ReactNativeClient/lib/components/NoteBodyViewer/hooks/useOnMessage.ts
index 410f3525b9..4e1243861c 100644
--- a/ReactNativeClient/lib/components/NoteBodyViewer/hooks/useOnMessage.ts
+++ b/ReactNativeClient/lib/components/NoteBodyViewer/hooks/useOnMessage.ts
@@ -4,7 +4,7 @@ const shared = require('lib/components/shared/note-screen-shared');
export default function useOnMessage(onCheckboxChange:Function, noteBody:string, onMarkForDownload:Function, onJoplinLinkClick:Function, onResourceLongPress:Function) {
return useCallback((event:any) => {
// Since RN 58 (or 59) messages are now escaped twice???
- let msg = unescape(unescape(event.nativeEvent.data));
+ const msg = unescape(unescape(event.nativeEvent.data));
console.info('Got IPC message: ', msg);
@@ -20,7 +20,7 @@ export default function useOnMessage(onCheckboxChange:Function, noteBody:string,
} else if (msg.startsWith('joplin:')) {
onJoplinLinkClick(msg);
} else if (msg.startsWith('error:')) {
- console.error('Webview injected script error: ' + msg);
+ console.error(`Webview injected script error: ${msg}`);
}
}, [onCheckboxChange, noteBody, onMarkForDownload, onJoplinLinkClick, onResourceLongPress]);
-}
\ No newline at end of file
+}
diff --git a/ReactNativeClient/lib/components/NoteBodyViewer/hooks/useOnResourceLongPress.ts b/ReactNativeClient/lib/components/NoteBodyViewer/hooks/useOnResourceLongPress.ts
index e92dc71989..066c9e22d1 100644
--- a/ReactNativeClient/lib/components/NoteBodyViewer/hooks/useOnResourceLongPress.ts
+++ b/ReactNativeClient/lib/components/NoteBodyViewer/hooks/useOnResourceLongPress.ts
@@ -9,7 +9,7 @@ const { dialogs } = require('lib/dialogs.js');
const Resource = require('lib/models/Resource.js');
const Share = require('react-native-share').default;
-export default function onResourceLongPress(onJoplinLinkClick:Function, dialogBoxRef:any) {
+export default function useOnResourceLongPress(onJoplinLinkClick:Function, dialogBoxRef:any) {
return useCallback(async (msg:string) => {
try {
const resourceId = msg.split(':')[1];
diff --git a/ReactNativeClient/lib/components/NoteBodyViewer/hooks/useSource.ts b/ReactNativeClient/lib/components/NoteBodyViewer/hooks/useSource.ts
index 660a278da9..454f0ad57c 100644
--- a/ReactNativeClient/lib/components/NoteBodyViewer/hooks/useSource.ts
+++ b/ReactNativeClient/lib/components/NoteBodyViewer/hooks/useSource.ts
@@ -61,7 +61,7 @@ export default function useSource(noteBody:string, noteMarkupLanguage:number, th
// props changes, thus triggering a render. The **content** of this noteResources array however is not changed because
// it doesn't contain info about the resource download state. Because of that, if we were to use the markupToHtml() cache
// it wouldn't re-render at all. We don't need this cache in any way because this hook is only triggered when we know
- // something has changed.
+ // something has changed.
markupToHtml().clearCache(noteMarkupLanguage);
const result = await markupToHtml().render(
@@ -125,7 +125,7 @@ export default function useSource(noteBody:string, noteMarkupLanguage:number, th