Skip to content
This repository has been archived by the owner on Jun 15, 2022. It is now read-only.

Commit

Permalink
Merge pull request #231 from standardnotes/linting
Browse files Browse the repository at this point in the history
Linting Entire codebase
  • Loading branch information
Mo Bitar authored Feb 10, 2020
2 parents 2dd22b8 + ac0e381 commit 9e81124
Show file tree
Hide file tree
Showing 68 changed files with 3,447 additions and 2,650 deletions.
2 changes: 1 addition & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"parser": "babel-eslint",
"rules": {
"no-throw-literal": 0,
"no-console": "error",
// "no-console": "error",
"comma-dangle": [
"error",
"never"
Expand Down
46 changes: 23 additions & 23 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import React, { Component } from 'react';
import { Animated } from 'react-native';
import {
initialMode,
eventEmitter as darkModeEventEmitter,
eventEmitter as darkModeEventEmitter
} from 'react-native-dark-mode';
import { createAppContainer, NavigationActions } from 'react-navigation';
import { createDrawerNavigator, DrawerActions } from 'react-navigation-drawer';
Expand All @@ -26,7 +26,7 @@ import {
SCREEN_INPUT_MODAL,
SCREEN_SETTINGS,
SCREEN_MANAGE_PRIVILEGES,
SCREEN_KEY_RECOVERY,
SCREEN_KEY_RECOVERY
} from '@Screens/screens';
import InputModal from '@Screens/InputModal';
import KeyRecovery from '@Screens/KeyRecovery';
Expand All @@ -48,21 +48,21 @@ if (__DEV__ === false) {
const AppStack = createStackNavigator(
{
[SCREEN_NOTES]: { screen: Root },
[SCREEN_COMPOSE]: { screen: Compose },
[SCREEN_COMPOSE]: { screen: Compose }
},
{
initialRouteName: SCREEN_NOTES,
navigationOptions: ({ navigation }) => ({
drawerLockMode: SideMenuManager.get().isRightSideMenuLocked()
? 'locked-closed'
: null,
}),
: null
})
}
);

const AppDrawerStack = createDrawerNavigator(
{
Main: AppStack,
Main: AppStack
},
{
contentComponent: ({ navigation }) => (
Expand All @@ -85,32 +85,32 @@ const AppDrawerStack = createDrawerNavigator(
/** We have to return something. */
return NavigationActions.setParams({
params: { dummy: true },
key: route.key,
key: route.key
});
},
}
};
},
}
}
);

const SettingsStack = createStackNavigator({
screen: Settings,
screen: Settings
});

const InputModalStack = createStackNavigator({
screen: InputModal,
screen: InputModal
});

const AuthenticateModalStack = createStackNavigator({
screen: Authenticate,
screen: Authenticate
});

const ManagePrivilegesStack = createStackNavigator({
screen: ManagePrivileges,
screen: ManagePrivileges
});

const KeyRecoveryStack = createStackNavigator({
screen: KeyRecovery,
screen: KeyRecovery
});

const AppDrawer = createStackNavigator(
Expand All @@ -120,28 +120,28 @@ const AppDrawer = createStackNavigator(
[SCREEN_INPUT_MODAL]: InputModalStack,
[SCREEN_AUTHENTICATE]: AuthenticateModalStack,
[SCREEN_MANAGE_PRIVILEGES]: ManagePrivilegesStack,
[SCREEN_KEY_RECOVERY]: KeyRecoveryStack,
[SCREEN_KEY_RECOVERY]: KeyRecoveryStack
},
{
mode: 'modal',
headerMode: 'none',
transitionConfig: () => ({
transitionSpec: {
duration: 300,
timing: Animated.timing,
},
timing: Animated.timing
}
}),
navigationOptions: ({ navigation }) => ({
drawerLockMode: SideMenuManager.get().isLeftSideMenuLocked()
? 'locked-closed'
: null,
}),
: null
})
}
);

const DrawerStack = createDrawerNavigator(
{
Main: AppDrawer,
Main: AppDrawer
},
{
contentComponent: ({ navigation }) => (
Expand All @@ -164,11 +164,11 @@ const DrawerStack = createDrawerNavigator(
/** We have to return something. */
return NavigationActions.setParams({
params: { dummy: true },
key: route.key,
key: route.key
});
},
}
};
},
}
}
);

Expand Down
48 changes: 30 additions & 18 deletions src/components/ButtonCell.js
Original file line number Diff line number Diff line change
@@ -1,39 +1,51 @@
import React, { Component } from 'react';
import React from 'react';
import { TouchableHighlight, Text, View } from 'react-native';
import SectionedTableCell from './SectionedTableCell'
import StyleKit from '@Style/StyleKit'
import SectionedTableCell from '@Components/SectionedTableCell';
import StyleKit from '@Style/StyleKit';

export default class ButtonCell extends SectionedTableCell {

rules() {
let rules = super.rules();
if(this.props.maxHeight) { rules.push({maxHeight: this.props.maxHeight}) }
const rules = super.rules();
if (this.props.maxHeight) {
rules.push({ maxHeight: this.props.maxHeight });
}
return rules;
}

buttonRules() {
let rules = [StyleKit.stylesForKey('buttonCellButton')];
if(this.props.leftAligned) { rules.push(StyleKit.styles.buttonCellButtonLeft) }
if(this.props.bold) { rules.push(StyleKit.styles.bold) }
if(this.props.disabled) { rules.push({color: 'gray', opacity: 0.6}) }
if(this.props.important) { rules.push({color: StyleKit.variables.stylekitDangerColor}) }
const rules = [StyleKit.stylesForKey('buttonCellButton')];
if (this.props.leftAligned) {
rules.push(StyleKit.styles.buttonCellButtonLeft);
}
if (this.props.bold) {
rules.push(StyleKit.styles.bold);
}
if (this.props.disabled) {
rules.push({ color: 'gray', opacity: 0.6 });
}
if (this.props.important) {
rules.push({ color: StyleKit.variables.stylekitDangerColor });
}
return rules;
}

render() {
return (
<TouchableHighlight
underlayColor={StyleKit.variable('stylekitBorderColor')}
style={[StyleKit.styles.flexContainer, StyleKit.styles.buttonCell, ...this.rules()]}
underlayColor={StyleKit.variables.stylekitBorderColor}
style={[
StyleKit.styles.flexContainer,
StyleKit.styles.buttonCell,
...this.rules()
]}
disabled={this.props.disabled}
onPress={this.props.onPress}>
onPress={this.props.onPress}
>
<View>
<Text style={this.buttonRules()}>{this.props.title}</Text>
{this.props.children &&
this.props.children
}
{this.props.children && this.props.children}
</View>
</TouchableHighlight>
)
);
}
}
16 changes: 6 additions & 10 deletions src/components/Circle.js
Original file line number Diff line number Diff line change
@@ -1,32 +1,28 @@
import React, { Component } from 'react';
import {TouchableHighlight, Text, View} from 'react-native';
import SectionedTableCell from './SectionedTableCell'
import StyleKit from "@Style/StyleKit"
import React from 'react';
import { View } from 'react-native';
import SectionedTableCell from '@Components/SectionedTableCell';

export default class Circle extends SectionedTableCell {

constructor(props) {
super(props);
this.size = props.size || 12;
this.loadStyles();
}

render() {
return (
<View style={this.styles.circle} />
)
return <View style={this.styles.circle} />;
}

loadStyles() {
this.styles = {
circle: {
width: this.size,
height: this.size,
borderRadius: this.size/2.0,
borderRadius: this.size / 2.0,
backgroundColor: this.props.backgroundColor,
borderColor: this.props.borderColor,
borderWidth: 1
}
}
};
}
}
42 changes: 22 additions & 20 deletions src/components/HeaderTitleView.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import React, { Component } from 'react';
import {DeviceEventEmitter, Modal, View, Text} from 'react-native';
import StyleKit from "@Style/StyleKit";
import PlatformStyles from "../models/PlatformStyles";
import { View, Text } from 'react-native';
import PlatformStyles from '@Root/models/PlatformStyles';
import StyleKit from '@Style/StyleKit';

export default class HeaderTitleView extends Component {

constructor(props) {
super(props);
}
Expand All @@ -13,57 +12,60 @@ export default class HeaderTitleView extends Component {
let styles = this.getStyles();

let subtitleStyles = styles.get('headerSubtitle');
if(this.props.subtitleColor) {
if (this.props.subtitleColor) {
subtitleStyles[0].color = this.props.subtitleColor;
subtitleStyles[0].opacity = 1.0;
}

return (
<View style={styles.get('headerContainer')}>

<Text style={styles.get('headerTitle')}>{this.props.title}</Text>

{this.props.subtitle &&
<Text numberOfLines={1} style={subtitleStyles} adjustsFontSizeToFit={true}>
{this.props.subtitle && (
<Text
numberOfLines={1}
style={subtitleStyles}
adjustsFontSizeToFit={true}
>
{this.props.subtitle}
</Text>
}
)}
</View>
)
);
}

getStyles() {
return new PlatformStyles({
headerContainer: {
backgroundColor: StyleKit.variable("stylekitContrastBackgroundColor"),
backgroundColor: StyleKit.variables.stylekitContrastBackgroundColor,
flex: 1,
justifyContent: 'flex-start',
flexDirection: "column"
flexDirection: 'column'
},

headerContainerAndroid: {
alignItems: 'flex-start',
alignItems: 'flex-start'
},

headerTitle: {
color: StyleKit.variable("stylekitForegroundColor"),
fontWeight: "bold",
color: StyleKit.variables.stylekitForegroundColor,
fontWeight: 'bold',
fontSize: 18,
textAlign: "center",
textAlign: 'center'
},

headerSubtitle: {
color: StyleKit.variable("stylekitForegroundColor"),
color: StyleKit.variables.stylekitForegroundColor,
opacity: 0.6,
fontSize: 12,
fontSize: 12
},

headerSubtitleIOS: {
textAlign: "center",
textAlign: 'center'
},

headerSubtitleAndroid: {
fontSize: 13,
fontSize: 13
}
});
}
Expand Down
Loading

0 comments on commit 9e81124

Please sign in to comment.