1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-24 10:27:10 +02:00
This commit is contained in:
Laurent Cozic 2019-09-29 22:11:36 +00:00
parent 637a4dc1f9
commit e93d96193c
15 changed files with 35 additions and 30 deletions

View File

@ -44,7 +44,7 @@ module.exports = {
// This error is always a false positive so far since it detects
// possible race conditions in contexts where we know it cannot happen.
"require-atomic-updates": 0,
"no-lonely-if": "error",
// "no-lonely-if": "error",
// -------------------------------
// Formatting
@ -65,11 +65,14 @@ module.exports = {
"mode": "strict"
}],
"block-spacing": ["error"],
"brace-style": ["error", "1tbs"],
"brace-style": ["error", "1tbs", { "allowSingleLine": true }],
"no-spaced-func": ["error"],
"func-call-spacing": ["error"],
"space-before-function-paren": ["error", "never"],
"object-property-newline": ["error"]
"space-before-function-paren": ["error", {
"anonymous": "never",
"named": "never",
"asyncArrow": "always"
}]
},
"plugins": [
"react",

View File

@ -92,11 +92,11 @@ describe('models_Note', function() {
it('should serialize and unserialize without modifying data', asyncTest(async () => {
let folder1 = await Folder.save({ title: 'folder1'});
const testCases = [
[ {title: '', body:'Body and no title\nSecond line\nThird Line', parent_id: folder1.id},
[ {title: '', body: 'Body and no title\nSecond line\nThird Line', parent_id: folder1.id},
'', 'Body and no title\nSecond line\nThird Line'],
[ {title: 'Note title', body:'Body and title', parent_id: folder1.id},
[ {title: 'Note title', body: 'Body and title', parent_id: folder1.id},
'Note title', 'Body and title'],
[ {title: 'Title and no body', body:'', parent_id: folder1.id},
[ {title: 'Title and no body', body: '', parent_id: folder1.id},
'Title and no body', ''],
];

View File

@ -279,7 +279,7 @@ describe('services_rest_Api', function() {
const response = await api.route('GET', 'notes', { token: 'mytoken' });
expect(response.length).toBe(0);
hasThrown = await checkThrowAsync(async () => await api.route('POST', 'notes', null, JSON.stringify({title:'testing'})));
hasThrown = await checkThrowAsync(async () => await api.route('POST', 'notes', null, JSON.stringify({title: 'testing'})));
expect(hasThrown).toBe(true);
}));

View File

@ -892,10 +892,12 @@ describe('Synchronizer', function() {
await synchronizer().start();
const fetcher = new ResourceFetcher(() => { return {
const fetcher = new ResourceFetcher(() => {
return {
// Simulate a failed download
get: () => { return new Promise((resolve, reject) => { reject(new Error('did not work')); }); },
}; });
get: () => { return new Promise((resolve, reject) => { reject(new Error('did not work')); }); },
};
});
fetcher.queueDownload_(resource1.id);
await fetcher.waitForAllFinished();

View File

@ -898,13 +898,13 @@ class Application extends BaseApplication {
submenu: [{
label: _('Website and documentation'),
accelerator: 'F1',
click () { bridge().openExternal('https://joplinapp.org'); },
click() { bridge().openExternal('https://joplinapp.org'); },
}, {
label: _('Joplin Forum'),
click () { bridge().openExternal('https://discourse.joplinapp.org'); },
click() { bridge().openExternal('https://discourse.joplinapp.org'); },
}, {
label: _('Make a donation'),
click () { bridge().openExternal('https://joplinapp.org/donate/'); },
click() { bridge().openExternal('https://joplinapp.org/donate/'); },
}, {
label: _('Check for updates...'),
visible: shim.isMac() ? false : true,

View File

@ -22,8 +22,7 @@ let hash;
try {
branch = execSync('git rev-parse --abbrev-ref HEAD').toString().trim();
hash = execSync('git log --pretty="%h" -1').toString().trim();
}
catch(err) {
} catch(err) {
console.warn('Could not get git info', err);
}
if (typeof branch !== 'undefined' && typeof hash !== 'undefined') {

View File

@ -28,7 +28,7 @@ function ConfigMenuBar(props) {
key={section.name}
iconName={Setting.sectionNameToIcon(section.name)}
label={Setting.sectionNameToLabel(section.name)}
onClick={() => { props.onSelectionChange({ section: section });}}
onClick={() => { props.onSelectionChange({ section: section }); }}
/>);
}

View File

@ -478,7 +478,7 @@ class ConfigScreenComponent extends React.Component {
borderTopColor: theme.dividerColor,
};
const screenComp = this.state.screenName ? <div style={{overflow: 'scroll', flex:1}}>{this.screenFromName(this.state.screenName)}</div> : null;
const screenComp = this.state.screenName ? <div style={{overflow: 'scroll', flex: 1}}>{this.screenFromName(this.state.screenName)}</div> : null;
if (screenComp) containerStyle.display = 'none';

View File

@ -60,7 +60,7 @@ class Dialog extends React.PureComponent {
this.styles_[this.props.theme] = {
dialogBox: Object.assign({}, theme.dialogBox, { minWidth: '50%', maxWidth: '50%' }),
input: Object.assign({}, theme.inputStyle, { flex: 1 }),
row: {overflow: 'hidden', height:itemHeight, display: 'flex', justifyContent: 'center', flexDirection: 'column', paddingLeft: 10, paddingRight: 10},
row: {overflow: 'hidden', height: itemHeight, display: 'flex', justifyContent: 'center', flexDirection: 'column', paddingLeft: 10, paddingRight: 10},
help: Object.assign({}, theme.textStyle, { marginBottom: 10 }),
inputHelpWrapper: {display: 'flex', flexDirection: 'row', alignItems: 'center'},
};

View File

@ -96,7 +96,7 @@ const lightStyle = {
warningBackgroundColor: '#FFD08D',
htmlColor:'#222222',
htmlColor: '#222222',
htmlBackgroundColor: 'white',
htmlDividerColor: 'rgb(230,230,230)',
htmlLinkColor: 'rgb(80,130,190)',

View File

@ -78,7 +78,7 @@ class SelectDateTimeDialog extends React.PureComponent {
width={0.9}
height={350}
>
<View style={{flex:1, margin: 20, alignItems:'center'}}>
<View style={{flex: 1, margin: 20, alignItems: 'center'}}>
<DatePicker
date={this.state.date}
mode="datetime"
@ -87,7 +87,7 @@ class SelectDateTimeDialog extends React.PureComponent {
confirmBtnText={_('Confirm')}
cancelBtnText={_('Cancel')}
onDateChange={(date) => { this.setState({ date: this.stringToDate(date) }); }}
style={{width:300}}
style={{width: 300}}
customStyles={{
btnConfirm: {
paddingVertical: 0,

View File

@ -119,7 +119,7 @@ function installRule(markdownIt, mdOptions, ruleOptions, context) {
return self.renderToken(tokens, idx, options);
};
markdownIt.renderer.rules.fence = function (tokens, idx, options, env, self) {
markdownIt.renderer.rules.fence = function(tokens, idx, options, env, self) {
const token = tokens[idx];
if (token.info !== 'fountain') return defaultRender(tokens, idx, options, env, self);
addContextAssets(context);

View File

@ -13,7 +13,8 @@ const { toTitleCase } = require('lib/string-utils');
class InteropService {
constructor() {
this.modules_ = null; }
this.modules_ = null;
}
modules() {
if (this.modules_) return this.modules_;

View File

@ -707,10 +707,10 @@ class AppComponent extends React.Component {
let menuPosition = 'left';
if (this.props.routeName === 'Note') {
sideMenuContent = <SafeAreaView style={{flex:1, backgroundColor: theme.backgroundColor}}><SideMenuContentNote options={this.props.noteSideMenuOptions}/></SafeAreaView>;
sideMenuContent = <SafeAreaView style={{flex: 1, backgroundColor: theme.backgroundColor}}><SideMenuContentNote options={this.props.noteSideMenuOptions}/></SafeAreaView>;
menuPosition = 'right';
} else {
sideMenuContent = <SafeAreaView style={{flex:1, backgroundColor: theme.backgroundColor}}><SideMenuContent/></SafeAreaView>;
sideMenuContent = <SafeAreaView style={{flex: 1, backgroundColor: theme.backgroundColor}}><SideMenuContent/></SafeAreaView>;
}
const appNavInit = {
@ -740,12 +740,12 @@ class AppComponent extends React.Component {
}}
>
<MenuContext style={{ flex: 1 }}>
<SafeAreaView style={{flex:0, backgroundColor: theme.raisedBackgroundColor}} />
<SafeAreaView style={{flex:1, backgroundColor: theme.backgroundColor}}>
<SafeAreaView style={{flex: 0, backgroundColor: theme.raisedBackgroundColor}} />
<SafeAreaView style={{flex: 1, backgroundColor: theme.backgroundColor}}>
<AppNav screens={appNavInit} />
</SafeAreaView>
<DropdownAlert ref={ref => this.dropdownAlert_ = ref} tapToCloseEnabled={true} />
<Animated.View pointerEvents='none' style={{position:'absolute', backgroundColor:'black', opacity: this.state.sideMenuContentOpacity, width: '100%', height: '100%'}}/>
<Animated.View pointerEvents='none' style={{position: 'absolute', backgroundColor: 'black', opacity: this.state.sideMenuContentOpacity, width: '100%', height: '100%'}}/>
</MenuContext>
</SideMenu>
);

View File

@ -151,7 +151,7 @@ toolUtils.isMac = () => {
return process && process.platform === 'darwin';
};
toolUtils.insertContentIntoFile = async function (filePath, markerOpen, markerClose, contentToInsert) {
toolUtils.insertContentIntoFile = async function(filePath, markerOpen, markerClose, contentToInsert) {
const fs = require('fs-extra');
let content = await fs.readFile(filePath, 'utf-8');
// [^]* matches any character including new lines