diff --git a/docs/coding_style/index.html b/docs/coding_style/index.html new file mode 100644 index 00000000000..1878386b478 --- /dev/null +++ b/docs/coding_style/index.html @@ -0,0 +1,562 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Coding style | Joplin + + + + + + + +
+ + +
+
+
+ + +
+ + +

Coding style🔗

+

Coding style is mostly enforced by a pre-commit hook that runs eslint. This hook is installed whenever running yarn install on any of the application directory. If for some reason the pre-commit hook didn't get installed, you can manually install it by running yarn install at the root of the repository.

+

Use TypeScript for new files🔗

+

Creating a new .ts file🔗

+

Because the TypeScript compiler generates .js files, be sure to add these new .js files to .eslintignore and .gitignore.

+

To do this,

+
    +
  1. If the TypeScript compiler has already generated a .js file for the new .ts file, delete it.
  2. +
  3. Run yarn run updateIgnored in the root directory of the project (or yarn run postinstall)
  4. +
+

Convert existing .js files to TypeScript before modifying🔗

+

Even if you are modifying a file that was originally in JavaScript you should ideally convert it first to TypeScript before modifying it.

+

If this is a large file however please ask first if it needs to be converted. Some very old and large JS files are tricky to convert properly due to poorly defined types, so in some cases it's better to leave that for another day (or another PR).

+

Filenames🔗

+ +

Use the same case for imported and exported members🔗

+

If you create a file that exports a single function called processData(), the file should be named processData.ts. When importing, it should be imported as processData, too. Basically, be consistent with naming, even though JS allows things to be named differently.

+

BAD:

+
// ProcessDATA.ts
+export default const processData = () => {
+	// ...
+};
+
+// foo.ts
+import doDataProcessing from './ProcessDATA';
+
+doDataProcessing();
+...
+
+

Good:

+
// processData.ts
+export default const processData = () => {
+	// ...
+};
+
+// foo.ts
+import processData from './processData';
+
+processData();
+...
+
+

Use camelCase for constants in new code🔗

+

BAD:

+
// Bad! Don't use in new code!
+const GRAVITY_ACCEL = 9.8;
+
+

Good:

+
const gravityAccel = 9.8;
+
+

Indent using tabs🔗

+

VSCode: In vscode, be sure to check whether new files are created with tab or space indentation! Spaces can be converted to tabs using the command palette.

+

Use strict equality🔗

+

Use === instead of ==.

+

Although the TypeScript compiler will give error messages if two different types are compared with == (e.g. number == boolean), its compiler error messages in this case can be misleading.

+

See also🔗

+ +

Declare variables just before their usage🔗

+

BAD:

+
// Bad!
+let foo, bar;
+
+const doThings = () => {
+	// do things unrelated to foo, bar
+};
+
+// Do things involving foo and bar
+foo = Math.random();
+bar = foo + Math.random() / 100;
+foo += Math.sin(bar + Math.tan(foo));
+...
+
+

Good:

+
...
+const doThings = () => {
+	// do things unrelated to foo, bar
+};
+
+// Do things involving foo and bar
+let foo = Math.random();
+let bar = foo + Math.random() / 100;
+foo += Math.sin(bar + Math.tan(foo));
+...
+
+

Don't allow this to lead to duplicate code, however. If constants are used multiple times, it's okay to declare them at the top of a file or in a separate, imported file.

+

Prefer const to let (where possible)🔗

+

Prefer () => {} to function() { ... }🔗

+

Doing this avoids having to deal with the this keyword. Not having it makes it easier to refactor class components into React Hooks, because any use of this (used in classes) will be correctly detected as invalid by TypeScript.

+

BAD:

+
// Bad!
+function foo() {
+	...
+}
+
+

Good:

+
const foo = () => {
+	...
+};
+
+

See also🔗

+ +

Avoid default and optional parameters🔗

+

As much as possible, avoid default parameters in function definitions and optional fields in interface definitions. When all parameters are required, it is much easier to refactor the code because the compiler will automatically catch any missing parameters.

+

React🔗

+

Use function components for new code🔗

+

New code should use React Hooks and function components, rather than objects that extend Component.

+

Bad:

+
// Don't do this in new code!
+class Example extends React.Component {
+	constructor(props: { text: string }) {
+		super(props);
+	}
+
+	render() {
+		return (
+			<div>${text}</div>
+		);
+	}
+}
+
+

Good:

+
const Example = (props: { text: string }) => {
+	return (
+		<div>${text}</div>
+	);
+};
+
+

Use react custom hooks to simplify long code🔗

+

If eslint gives an error about useFoo being called outside of a component, be sure the custom hook is titled appropriately.

+

See also🔗

+

Other projects' style guides🔗

+

We aren't using these guides, but they may still be helpful!

+ +

Posts/resources related to Joplin's style🔗

+ + + +
+
+
+
+ + +
+ + + + + diff --git a/docs/external_links/index.html b/docs/external_links/index.html index bb3d6eca428..22d40fcf4df 100644 --- a/docs/external_links/index.html +++ b/docs/external_links/index.html @@ -349,7 +349,7 @@ height="0" width="0" style="display:none;visibility:hidden">
  • joplin://x-callback-url/openTag?id=<tag id> for tag
  • Known problems🔗

    -

    On macOS if Joplin isn't running it will start but it won't open the note.

    +

    On macOS if Joplin isn't running it will start but it won't open the note. If Joplin is running but on a different space as the external link, then Joplin will come to the foreground but without displaying the note.

    +
    diff --git a/docs/news/20220808-first-meetup/index.html b/docs/news/20220808-first-meetup/index.html new file mode 100644 index 00000000000..c8533ffa985 --- /dev/null +++ b/docs/news/20220808-first-meetup/index.html @@ -0,0 +1,223 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Joplin first meetup on 30 August! | Joplin + + + + + + + +
    + + +
    +
    +
    + + +
    + + +

    Joplin first meetup on 30 August!🔗

    +

    Published on 8 Aug 2022

    +

    We are glad to announce the first Joplin Meetup that will take place on 30 August 2022 in London!

    +

    This is an opportunity to meet other Joplin users as well as some of the main contributors, to discuss the apps, or to ask questions and exchange tips and tricks on how to use the app, develop plugins or contribute to the application. Everybody, technical or not, is welcome!

    +

    We will meet at the Old Thameside Inn next to London Bridge. If the weather allows we will be on the terrace outside, if not inside.

    +

    More information on the official Meetup page:

    +

    https://www.meetup.com/joplin/events/287611873/

    +
    +

    Discuss on the forum

    + +
    +
    +
    +
    + + +
    + + + + + diff --git a/docs/news/index.html b/docs/news/index.html index 2b66bdbbac5..cfb1f859b0d 100644 --- a/docs/news/index.html +++ b/docs/news/index.html @@ -164,6 +164,16 @@ height="0" width="0" style="display:none;visibility:hidden"> +

    Joplin first meetup on 30 August!🔗

    +

    Published on 8 Aug 2022

    +

    We are glad to announce the first Joplin Meetup that will take place on 30 August 2022 in London!

    +

    This is an opportunity to meet other Joplin users as well as some of the main contributors, to discuss the apps, or to ask questions and exchange tips and tricks on how to use the app, develop plugins or contribute to the application. Everybody, technical or not, is welcome!

    +

    We will meet at the Old Thameside Inn next to London Bridge. If the weather allows we will be on the terrace outside, if not inside.

    +

    More information on the official Meetup page:

    +

    https://www.meetup.com/joplin/events/287611873/

    +
    +

    Discuss on the forum

    +

    Joplin 2.8 is available!🔗

    Published on 6 Jun 2022

    As always a lot of changes and new features in this new version available on both desktop and mobile.

    @@ -515,13 +525,6 @@ height="0" width="0" style="display:none;visibility:hidden">

    From what I can see on Google Keep or Evernote for example it should be something like "Use our app to get X or Y benefit", it should be a sentence that directly speaks to the user essentially.

    So far I have "Your notes, anywhere you are" but I'm not certain that's particularly inspiring. Any other idea about what tagline could be used?


    -

    Discuss on the forum

    -
    -

    Poll: What's the size of your note collection?🔗

    -

    Published on 24 Jun 2021

    -

    Poll is on the forum:

    -

    https://discourse.joplinapp.org/t/poll-whats-the-size-of-your-note-collection/18191

    -

    Discuss on the forum

    diff --git a/docs/rss.xml b/docs/rss.xml index 60f47cf30f0..f48702f89a1 100644 --- a/docs/rss.xml +++ b/docs/rss.xml @@ -1,4 +1,9 @@ -<![CDATA[Joplin]]>https://joplinapp.orgRSS for NodeMon, 06 Jun 2022 00:00:00 GMTMon, 06 Jun 2022 00:00:00 GMT<![CDATA[Joplin 2.8 is available!]]>As always a lot of changes and new features in this new version available on both desktop and mobile.

    +<![CDATA[Joplin]]>https://joplinapp.orgRSS for NodeMon, 08 Aug 2022 00:00:00 GMTMon, 08 Aug 2022 00:00:00 GMT<![CDATA[Joplin first meetup on 30 August!]]>We are glad to announce the first Joplin Meetup that will take place on 30 August 2022 in London!

    +

    This is an opportunity to meet other Joplin users as well as some of the main contributors, to discuss the apps, or to ask questions and exchange tips and tricks on how to use the app, develop plugins or contribute to the application. Everybody, technical or not, is welcome!

    +

    We will meet at the Old Thameside Inn next to London Bridge. If the weather allows we will be on the terrace outside, if not inside.

    +

    More information on the official Meetup page:

    +

    https://www.meetup.com/joplin/events/287611873/

    +]]>
    https://joplinapp.org/news/20220808-first-meetup/20220808-first-meetupMon, 08 Aug 2022 00:00:00 GMTJoplin will have its first Meetup on 30 August! Come and join us at the Old Thameside Inn next to London Bridge! https://www.meetup.com/joplin/events/287611873/
    <![CDATA[Joplin 2.8 is available!]]>As always a lot of changes and new features in this new version available on both desktop and mobile.

    Multiple profile support🔗

    Perhaps the most visible change in this version is the support for multiple profiles. You can now create as many application profile as you wish, each with their own settings, and easily switch from one to another. The main use case is to support for example a "work" profile and a "personal" profile, to allow you to keep things independent, and each profile can sync with a different sync target.

    To create a new profile, open File > Switch profile and select Create new profile, enter the profile name and press OK. The app will automatically switch to this new profile, which you can now configure.

    @@ -256,6 +261,4 @@ ]]>
    https://joplinapp.org/news/20210706-140228/20210706-140228Tue, 06 Jul 2021 14:02:28 GMT
    <![CDATA[Any ideas for a Joplin tagline?]]>I'm going to update the website front page to better showcase the application. I have most of the sections right, but the part I'm still not sure about is the top tagline, so I'm wondering if anyone had any suggestion about it?

    From what I can see on Google Keep or Evernote for example it should be something like "Use our app to get X or Y benefit", it should be a sentence that directly speaks to the user essentially.

    So far I have "Your notes, anywhere you are" but I'm not certain that's particularly inspiring. Any other idea about what tagline could be used?

    -]]>
    https://joplinapp.org/news/20210705-094247/20210705-094247Mon, 05 Jul 2021 09:42:47 GMT
    <![CDATA[Poll: What's the size of your note collection?]]>Poll is on the forum:

    -

    https://discourse.joplinapp.org/t/poll-whats-the-size-of-your-note-collection/18191

    -]]>
    https://joplinapp.org/news/20210624-171844/20210624-171844Thu, 24 Jun 2021 17:18:44 GMT
    \ No newline at end of file +]]>
    https://joplinapp.org/news/20210705-094247/20210705-094247Mon, 05 Jul 2021 09:42:47 GMT
    \ No newline at end of file