Skip to content

Commit

Permalink
fix: fixed linting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
ajaykumar97 committed Sep 19, 2021
1 parent 7eb246e commit 68da5cd
Show file tree
Hide file tree
Showing 18 changed files with 37 additions and 32 deletions.
18 changes: 10 additions & 8 deletions template/_eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
module.exports = {
root: true,
extends: '@react-native-community',
plugins: ["import"],
plugins: ['import'],
rules: {
// eslint-plugin-import
"import/first": 1,
"import/newline-after-import": 1,
"import/no-cycle": 2,
"import/no-duplicates": 1,
"import/no-unresolved": 2,
}
'import/first': 1,
'import/newline-after-import': 1,
'import/no-cycle': 2,
'import/no-duplicates': 1,
'import/no-unresolved': 2,
},
env: {
'jest/globals': true,
},
};
4 changes: 2 additions & 2 deletions template/react-native.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module.exports = {
project: {
ios: {},
android: {}
android: {},
},
assets: ['./src/assets/fonts']
assets: ['./src/assets/fonts'],
};
4 changes: 3 additions & 1 deletion template/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ const App = () => (
<Provider store={store}>
<StatusBar
translucent={!layout.isOldDevice}
backgroundColor={!layout.isOldDevice ? colors.transparent : colors.black1}
backgroundColor={
!layout.isOldDevice ? colors.transparent : colors.black1
}
barStyle={'dark-content'}
/>

Expand Down
2 changes: 1 addition & 1 deletion template/src/commonComponents/Container.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {View, StyleSheet} from 'react-native';

import {colors} from '../utilities/constants';

const Container = (props) => (
const Container = props => (
<View {...props} style={{...styles.container, ...props.style}}>
{props.children}
</View>
Expand Down
3 changes: 1 addition & 2 deletions template/src/commonComponents/Header.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,7 @@ const Header = ({
<View
style={{
flex: 1,
marginHorizontal:
titlePosition === 'center' ? scale(10) : 0,
marginHorizontal: titlePosition === 'center' ? scale(10) : 0,
}}>
<Text
style={[
Expand Down
2 changes: 1 addition & 1 deletion template/src/commonComponents/WhiteContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {View, StyleSheet} from 'react-native';

import {colors} from '../utilities/constants';

const WhiteContainer = (props) => (
const WhiteContainer = props => (
<View {...props} style={[styles.container, props.style]}>
{props.children}
</View>
Expand Down
8 changes: 5 additions & 3 deletions template/src/localization/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@ const en = {
enterAnEmail: 'Please enter an email',
enterValidEmail: 'Please enter a valid email',
enterAPassword: 'Please enter a passsword',
passwordCanContainOnly: 'Password can only contain alphabets, numbers and any of the special characters from _@./#&+-',
checkEmailForPasswordRest: 'Please check your email. A verification link is sent to your email to change your password.',
passwordCanContainOnly:
'Password can only contain alphabets, numbers and any of the special characters from _@./#&+-',
checkEmailForPasswordRest:
'Please check your email. A verification link is sent to your email to change your password.',
enterYourName: 'Please enter your name',
forgotPassword: 'Forgot Password',
forgotPasswordWithQuestion: 'Forgot Password?',
dontHaveAnAccount: 'Don\'t have an account?',
dontHaveAnAccount: "Don't have an account?",
email: 'Email',
password: 'Password',
submit: 'Submit',
Expand Down
2 changes: 1 addition & 1 deletion template/src/screens/AuthScreens/Login/actions.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {LOGIN_REQUESTED} from './types';

export const login = (params) => ({
export const login = params => ({
type: LOGIN_REQUESTED,
params,
});
2 changes: 1 addition & 1 deletion template/src/screens/AuthScreens/Signup/actions.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {SIGNUP_REQUESTED} from './types';

export const signup = (params) => ({
export const signup = params => ({
type: SIGNUP_REQUESTED,
params,
});
2 changes: 1 addition & 1 deletion template/src/screens/MainAppScreens/Users/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export const getAllUsers = () => ({
type: GET_USER_REQUESTED,
});

export const logout = (params) => ({
export const logout = params => ({
type: SESSION_EXPIRE_REQUESTED,
params,
});
2 changes: 1 addition & 1 deletion template/src/screens/MainAppScreens/Users/sagas.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export function* getAllUsersSaga() {

logger.data('getUsers response is: ', data, true);

data = data.map((user) => {
data = data.map(user => {
user.key = String(user.id);
return user;
});
Expand Down
6 changes: 3 additions & 3 deletions template/src/utilities/helperFunctions/miscellaneous.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const showInfoMessage = (alertMessage, options = {}) => {
});
};

const intoTitleCase = (string) => {
const intoTitleCase = string => {
let sentence = string.toLowerCase().split(' ');
for (let i = 0; i < sentence.length; i++) {
sentence[i] = sentence[i][0].toUpperCase() + sentence[i].slice(1);
Expand All @@ -47,7 +47,7 @@ const intoTitleCase = (string) => {
return sentence;
};

const keyExtractor = (item) => String(item.id);
const keyExtractor = item => String(item.id);

const truncateString = (str, num = 50) => {
if (str.length > num) {
Expand All @@ -56,7 +56,7 @@ const truncateString = (str, num = 50) => {
return str;
};

const getAPIError = (error) => {
const getAPIError = error => {
if (error?.response?.data?.error?.message) {
return error.response.data.error.message;
}
Expand Down
2 changes: 1 addition & 1 deletion template/src/utilities/helperFunctions/userData.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import AsyncStorage from '@react-native-async-storage/async-storage';
import {USER_DATA} from '../constants/otherConstants';

const getLocalUserData = (key = USER_DATA) =>
AsyncStorage.getItem(key).then((data) => JSON.parse(data));
AsyncStorage.getItem(key).then(data => JSON.parse(data));

const setLocalUserData = (data, key = USER_DATA) =>
AsyncStorage.setItem(key, JSON.stringify(data));
Expand Down
4 changes: 2 additions & 2 deletions template/src/utilities/request.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import strings from '../localization';

export const axios = Axios.create({
baseURL: urls.baseUrl,
validateStatus: (status) => {
validateStatus: status => {
if (status === 200 || status === 401) {
return true;
}
Expand All @@ -15,7 +15,7 @@ export const axios = Axios.create({
});

export const request = (config: AxiosRequestConfig) =>
axios(config).then((response) => {
axios(config).then(response => {
if (response.status === 401) {
UserMethodsObj.instance.props.logout({showAlert: true});

Expand Down
2 changes: 1 addition & 1 deletion template/tests/__mocks__/fileMock.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
module.exports.ReactComponent = () => null;
module.exports.ReactComponent = () => null;
2 changes: 1 addition & 1 deletion template/tests/__mocks__/react-native-localization.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class RNLocalization {
setLanguage(interfaceLanguage) { }
setLanguage(interfaceLanguage) {}

formatString(string, formatObj = {}) {}
}
Expand Down
2 changes: 1 addition & 1 deletion template/tests/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ jest.mock('react-native/Libraries/Utilities/Platform', () => {
return Platform;
});

global.fetch = require('jest-fetch-mock');
global.fetch = require('jest-fetch-mock');
2 changes: 1 addition & 1 deletion template/tests/snapshot/Login.snap.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ describe('Login screen', () => {
.toJSON();
expect(tree).toMatchSnapshot();
});
});
});

0 comments on commit 68da5cd

Please sign in to comment.