You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-07-16 00:14:34 +02:00
This commit is contained in:
@ -108,6 +108,9 @@ module.exports = {
|
|||||||
'semi': ['error', 'always'],
|
'semi': ['error', 'always'],
|
||||||
'eol-last': ['error', 'always'],
|
'eol-last': ['error', 'always'],
|
||||||
'quotes': ['error', 'single'],
|
'quotes': ['error', 'single'],
|
||||||
|
|
||||||
|
// Note that "indent" only applies to JavaScript files. See
|
||||||
|
// https://github.com/laurent22/joplin/issues/8360
|
||||||
'indent': ['error', 'tab'],
|
'indent': ['error', 'tab'],
|
||||||
'comma-dangle': ['error', {
|
'comma-dangle': ['error', {
|
||||||
'arrays': 'always-multiline',
|
'arrays': 'always-multiline',
|
||||||
@ -184,6 +187,12 @@ module.exports = {
|
|||||||
'project': './tsconfig.eslint.json',
|
'project': './tsconfig.eslint.json',
|
||||||
},
|
},
|
||||||
'rules': {
|
'rules': {
|
||||||
|
'@typescript-eslint/indent': ['error', 'tab', {
|
||||||
|
'ignoredNodes': [
|
||||||
|
// See https://github.com/typescript-eslint/typescript-eslint/issues/1824
|
||||||
|
'TSUnionType',
|
||||||
|
],
|
||||||
|
}],
|
||||||
'@typescript-eslint/ban-ts-comment': ['error'],
|
'@typescript-eslint/ban-ts-comment': ['error'],
|
||||||
'@typescript-eslint/ban-types': 'error',
|
'@typescript-eslint/ban-types': 'error',
|
||||||
'@typescript-eslint/explicit-member-accessibility': ['error'],
|
'@typescript-eslint/explicit-member-accessibility': ['error'],
|
||||||
|
@ -25,9 +25,9 @@ export const defaultSearchState: SearchState = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export interface SearchPanelProps {
|
export interface SearchPanelProps {
|
||||||
searchControl: SearchControl;
|
searchControl: SearchControl;
|
||||||
searchState: SearchState;
|
searchState: SearchState;
|
||||||
editorSettings: EditorSettings;
|
editorSettings: EditorSettings;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface ActionButtonProps {
|
interface ActionButtonProps {
|
||||||
|
@ -15,9 +15,9 @@ export interface EditorSettings {
|
|||||||
// [themeStyle(themeId: number)] doesn't work. As such, we need both
|
// [themeStyle(themeId: number)] doesn't work. As such, we need both
|
||||||
// the [themeId] and [themeData].
|
// the [themeId] and [themeData].
|
||||||
themeId: number;
|
themeId: number;
|
||||||
themeData: Theme;
|
themeData: Theme;
|
||||||
|
|
||||||
katexEnabled: boolean;
|
katexEnabled: boolean;
|
||||||
spellcheckEnabled: boolean;
|
spellcheckEnabled: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -41,14 +41,14 @@ export interface SelectionChangeEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface SearchControl {
|
export interface SearchControl {
|
||||||
findNext(): void;
|
findNext(): void;
|
||||||
findPrevious(): void;
|
findPrevious(): void;
|
||||||
replaceCurrent(): void;
|
replaceCurrent(): void;
|
||||||
replaceAll(): void;
|
replaceAll(): void;
|
||||||
setSearchState(state: SearchState): void;
|
setSearchState(state: SearchState): void;
|
||||||
|
|
||||||
showSearch(): void;
|
showSearch(): void;
|
||||||
hideSearch(): void;
|
hideSearch(): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface SearchState {
|
export interface SearchState {
|
||||||
@ -57,7 +57,7 @@ export interface SearchState {
|
|||||||
|
|
||||||
searchText: string;
|
searchText: string;
|
||||||
replaceText: string;
|
replaceText: string;
|
||||||
dialogVisible: boolean;
|
dialogVisible: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Possible types of lists in the editor
|
// Possible types of lists in the editor
|
||||||
|
@ -17,15 +17,15 @@ import { Dimensions } from 'react-native';
|
|||||||
|
|
||||||
export interface ValueMap {
|
export interface ValueMap {
|
||||||
// Value to use on small-width displays
|
// Value to use on small-width displays
|
||||||
sm?: number;
|
sm?: number;
|
||||||
// Value to use on medium-width displays
|
// Value to use on medium-width displays
|
||||||
md?: number;
|
md?: number;
|
||||||
// Value to use on large-width displays
|
// Value to use on large-width displays
|
||||||
lg?: number;
|
lg?: number;
|
||||||
// Value to use on extra-large width displays
|
// Value to use on extra-large width displays
|
||||||
xl?: number;
|
xl?: number;
|
||||||
// Value to use on extra-extra-large width displays
|
// Value to use on extra-extra-large width displays
|
||||||
xxl?: number;
|
xxl?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function getResponsiveValue(valueMap: ValueMap): number {
|
export default function getResponsiveValue(valueMap: ValueMap): number {
|
||||||
|
@ -3,8 +3,8 @@ import { Dispatch } from 'redux';
|
|||||||
const { NativeEventEmitter, NativeModules, Platform } = require('react-native');
|
const { NativeEventEmitter, NativeModules, Platform } = require('react-native');
|
||||||
|
|
||||||
interface NotificationData {
|
interface NotificationData {
|
||||||
joplinNotificationId: string;
|
joplinNotificationId: string;
|
||||||
noteId: string;
|
noteId: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default async (dispatch: Dispatch) => {
|
export default async (dispatch: Dispatch) => {
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
import EventDispatcher from './EventDispatcher';
|
import EventDispatcher from './EventDispatcher';
|
||||||
|
|
||||||
enum TestKey {
|
enum TestKey {
|
||||||
FooEvent,
|
FooEvent,
|
||||||
BarEvent,
|
BarEvent,
|
||||||
BazEvent,
|
BazEvent,
|
||||||
}
|
}
|
||||||
|
|
||||||
describe('EventDispatcher', () => {
|
describe('EventDispatcher', () => {
|
||||||
|
@ -19,14 +19,14 @@ export function getTagCallbackUrl(tagId: string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const enum CallbackUrlCommand {
|
export const enum CallbackUrlCommand {
|
||||||
OpenNote = 'openNote',
|
OpenNote = 'openNote',
|
||||||
OpenFolder = 'openFolder',
|
OpenFolder = 'openFolder',
|
||||||
OpenTag = 'openTag',
|
OpenTag = 'openTag',
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface CallbackUrlInfo {
|
export interface CallbackUrlInfo {
|
||||||
command: CallbackUrlCommand;
|
command: CallbackUrlCommand;
|
||||||
params: Record<string, string>;
|
params: Record<string, string>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function parseCallbackUrl(s: string): CallbackUrlInfo {
|
export function parseCallbackUrl(s: string): CallbackUrlInfo {
|
||||||
|
@ -3,8 +3,8 @@ const { useCallback, useEffect, useState } = shim.react();
|
|||||||
import useEventListener from './useEventListener';
|
import useEventListener from './useEventListener';
|
||||||
|
|
||||||
interface Size {
|
interface Size {
|
||||||
width: number;
|
width: number;
|
||||||
height: number;
|
height: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
function useElementSize(elementRef: any): Size {
|
function useElementSize(elementRef: any): Size {
|
||||||
|
@ -2,7 +2,7 @@ import Setting from '../models/Setting';
|
|||||||
import checkProviderIsSupported from '../utils/webDAVUtils';
|
import checkProviderIsSupported from '../utils/webDAVUtils';
|
||||||
|
|
||||||
interface Script {
|
interface Script {
|
||||||
exec: ()=> Promise<void>;
|
exec: ()=> Promise<void>;
|
||||||
}
|
}
|
||||||
|
|
||||||
const script: Script = <Script>{};
|
const script: Script = <Script>{};
|
||||||
|
@ -38,7 +38,7 @@ export interface DefaultPluginSettings {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface DefaultPluginsInfo {
|
export interface DefaultPluginsInfo {
|
||||||
[pluginId: string]: DefaultPluginSettings;
|
[pluginId: string]: DefaultPluginSettings;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface PluginSetting {
|
export interface PluginSetting {
|
||||||
|
@ -9,8 +9,8 @@ interface Term {
|
|||||||
}
|
}
|
||||||
|
|
||||||
enum Relation {
|
enum Relation {
|
||||||
OR = 'OR',
|
OR = 'OR',
|
||||||
AND = 'AND',
|
AND = 'AND',
|
||||||
}
|
}
|
||||||
|
|
||||||
enum Operation {
|
enum Operation {
|
||||||
|
@ -4,8 +4,8 @@ import { reg } from './registry';
|
|||||||
import { Plugins } from './services/plugins/PluginService';
|
import { Plugins } from './services/plugins/PluginService';
|
||||||
|
|
||||||
interface PluginList {
|
interface PluginList {
|
||||||
completeList: string;
|
completeList: string;
|
||||||
summary: string;
|
summary: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getPluginLists(plugins: Plugins): PluginList {
|
function getPluginLists(plugins: Plugins): PluginList {
|
||||||
|
@ -2,9 +2,9 @@ import { useRef, useEffect, MutableRefObject } from 'react';
|
|||||||
|
|
||||||
export interface VisibleOnSelect {
|
export interface VisibleOnSelect {
|
||||||
container: MutableRefObject<HTMLElement>;
|
container: MutableRefObject<HTMLElement>;
|
||||||
wrapperRef: MutableRefObject<HTMLElement>;
|
wrapperRef: MutableRefObject<HTMLElement>;
|
||||||
isVisible: boolean;
|
isVisible: boolean;
|
||||||
isSelected: boolean;
|
isSelected: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Used in thumbnail view, to scroll to the newly selected page.
|
// Used in thumbnail view, to scroll to the newly selected page.
|
||||||
|
@ -5,9 +5,9 @@ export interface ScaledSize {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface IconButtonProps {
|
export interface IconButtonProps {
|
||||||
onClick: ()=> void;
|
onClick: ()=> void;
|
||||||
size?: number;
|
size?: number;
|
||||||
color?: string;
|
color?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface RenderRequest {
|
export interface RenderRequest {
|
||||||
|
@ -24,12 +24,12 @@ const ButtonElement = styled.button<{ hoverColor?: string; size?: number; color?
|
|||||||
`;
|
`;
|
||||||
|
|
||||||
interface BaseButtonProps {
|
interface BaseButtonProps {
|
||||||
icon: IconDefinition;
|
icon: IconDefinition;
|
||||||
onClick: ()=> void;
|
onClick: ()=> void;
|
||||||
name: string;
|
name: string;
|
||||||
size: number;
|
size: number;
|
||||||
color: string;
|
color: string;
|
||||||
hoverColor?: string;
|
hoverColor?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
function BaseButton({ onClick, icon, name, size, color, hoverColor }: BaseButtonProps) {
|
function BaseButton({ onClick, icon, name, size, color, hoverColor }: BaseButtonProps) {
|
||||||
|
@ -29,66 +29,66 @@ export type Encoding = 'utf8' | 'base64' | 'ascii';
|
|||||||
|
|
||||||
/** Native interface of the module */
|
/** Native interface of the module */
|
||||||
interface SafxInterface {
|
interface SafxInterface {
|
||||||
openDocumentTree(persist: boolean): Promise<DocumentFileDetail | null>;
|
openDocumentTree(persist: boolean): Promise<DocumentFileDetail | null>;
|
||||||
openDocument(
|
openDocument(
|
||||||
persist: boolean,
|
persist: boolean,
|
||||||
multiple: boolean,
|
multiple: boolean,
|
||||||
): Promise<DocumentFileDetail[] | null>;
|
): Promise<DocumentFileDetail[] | null>;
|
||||||
createDocument(
|
createDocument(
|
||||||
data: string,
|
data: string,
|
||||||
encoding?: string,
|
encoding?: string,
|
||||||
initialName?: string,
|
initialName?: string,
|
||||||
mimeType?: string,
|
mimeType?: string,
|
||||||
): Promise<DocumentFileDetail | null>;
|
): Promise<DocumentFileDetail | null>;
|
||||||
hasPermission(uriString: string): Promise<boolean>;
|
hasPermission(uriString: string): Promise<boolean>;
|
||||||
exists(uriString: string): Promise<boolean>;
|
exists(uriString: string): Promise<boolean>;
|
||||||
readFile(uriString: string, encoding?: Encoding): Promise<string>;
|
readFile(uriString: string, encoding?: Encoding): Promise<string>;
|
||||||
writeFile(
|
writeFile(
|
||||||
uriString: string,
|
uriString: string,
|
||||||
data: string,
|
data: string,
|
||||||
encoding?: Encoding,
|
encoding?: Encoding,
|
||||||
mimeType?: string,
|
mimeType?: string,
|
||||||
append?: boolean,
|
append?: boolean,
|
||||||
): Promise<void>;
|
): Promise<void>;
|
||||||
createFile(uriString: string, mimeType?: string): Promise<DocumentFileDetail>;
|
createFile(uriString: string, mimeType?: string): Promise<DocumentFileDetail>;
|
||||||
unlink(uriString: string): Promise<boolean>;
|
unlink(uriString: string): Promise<boolean>;
|
||||||
mkdir(uriString: string): Promise<DocumentFileDetail>;
|
mkdir(uriString: string): Promise<DocumentFileDetail>;
|
||||||
rename(uriString: string, newName: string): Promise<DocumentFileDetail>;
|
rename(uriString: string, newName: string): Promise<DocumentFileDetail>;
|
||||||
getPersistedUriPermissions(): Promise<string[]>;
|
getPersistedUriPermissions(): Promise<string[]>;
|
||||||
releasePersistableUriPermission(uriString: string): Promise<void>;
|
releasePersistableUriPermission(uriString: string): Promise<void>;
|
||||||
listFiles(uriString: string): Promise<DocumentFileDetail[]>;
|
listFiles(uriString: string): Promise<DocumentFileDetail[]>;
|
||||||
stat(uriString: string): Promise<DocumentFileDetail>;
|
stat(uriString: string): Promise<DocumentFileDetail>;
|
||||||
transferFile(
|
transferFile(
|
||||||
srcUri: string,
|
srcUri: string,
|
||||||
destUri: string,
|
destUri: string,
|
||||||
replaceIfDestExist: boolean,
|
replaceIfDestExist: boolean,
|
||||||
copy: boolean,
|
copy: boolean,
|
||||||
): Promise<DocumentFileDetail | null>;
|
): Promise<DocumentFileDetail | null>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type DocumentFileDetail = {
|
export type DocumentFileDetail = {
|
||||||
uri: string;
|
uri: string;
|
||||||
name: string;
|
name: string;
|
||||||
type: 'directory' | 'file';
|
type: 'directory' | 'file';
|
||||||
lastModified: number;
|
lastModified: number;
|
||||||
mime: string;
|
mime: string;
|
||||||
size: number;
|
size: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type FileOperationOptions = {
|
export type FileOperationOptions = {
|
||||||
/** Defaults to `'utf8'` */
|
/** Defaults to `'utf8'` */
|
||||||
encoding?: Encoding;
|
encoding?: Encoding;
|
||||||
|
|
||||||
/** Append data to the file. If not set file content will be overwritten. */
|
/** Append data to the file. If not set file content will be overwritten. */
|
||||||
append?: boolean;
|
append?: boolean;
|
||||||
|
|
||||||
/** mime type of the file being saved. Defaults to '\*\/\*' */
|
/** mime type of the file being saved. Defaults to '\*\/\*' */
|
||||||
mimeType?: string;
|
mimeType?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type CreateDocumentOptions = FileOperationOptions & {
|
export type CreateDocumentOptions = FileOperationOptions & {
|
||||||
/** initial display name when opening file picker */
|
/** initial display name when opening file picker */
|
||||||
initialName?: string;
|
initialName?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Open the Document Picker to select a folder. Read/Write Permission will be granted to the selected folder.
|
// Open the Document Picker to select a folder. Read/Write Permission will be granted to the selected folder.
|
||||||
@ -98,10 +98,10 @@ export function openDocumentTree(persist: boolean) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export type OpenDocumentOptions = {
|
export type OpenDocumentOptions = {
|
||||||
/** should the permission of returned document(s) be persisted ? */
|
/** should the permission of returned document(s) be persisted ? */
|
||||||
persist?: boolean;
|
persist?: boolean;
|
||||||
/** should the file picker allow multiple documents ? */
|
/** should the file picker allow multiple documents ? */
|
||||||
multiple?: boolean;
|
multiple?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Open the Document Picker to select a file.
|
// Open the Document Picker to select a file.
|
||||||
@ -206,7 +206,7 @@ export function stat(uriString: string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type FileTransferOptions = {
|
type FileTransferOptions = {
|
||||||
replaceIfDestinationExists?: boolean;
|
replaceIfDestinationExists?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Copy file from source uri to destination uri.
|
// Copy file from source uri to destination uri.
|
||||||
|
@ -18,9 +18,9 @@ require('pg').types.setTypeParser(20, (val: any) => {
|
|||||||
// Also need this to get integers for count() queries.
|
// Also need this to get integers for count() queries.
|
||||||
// https://knexjs.org/#Builder-count
|
// https://knexjs.org/#Builder-count
|
||||||
declare module 'knex/types/result' {
|
declare module 'knex/types/result' {
|
||||||
interface Registry {
|
interface Registry {
|
||||||
Count: number;
|
Count: number;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const logger = Logger.create('db');
|
const logger = Logger.create('db');
|
||||||
|
@ -12,7 +12,7 @@ export enum NotificationLevel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export enum ItemType {
|
export enum ItemType {
|
||||||
Item = 1,
|
Item = 1,
|
||||||
UserItem = 2,
|
UserItem = 2,
|
||||||
User,
|
User,
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@ import { execCommand } from '@joplin/utils';
|
|||||||
const fetch = require('node-fetch');
|
const fetch = require('node-fetch');
|
||||||
|
|
||||||
interface PluginAndVersion {
|
interface PluginAndVersion {
|
||||||
[pluginId: string]: string;
|
[pluginId: string]: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface PluginIdAndName {
|
interface PluginIdAndName {
|
||||||
|
Reference in New Issue
Block a user