Compare commits

...

3 Commits

Author SHA1 Message Date
Diego Mello f11bbb814f
Merge branch 'develop' into chore/unused-imports 2021-10-06 18:11:32 -03:00
AlexAlexandre d72f393de5 chore: resolving react/jsx-key error 2021-09-30 18:28:49 -03:00
AlexAlexandre d1287af814 chore: configuring lint to report errors on unused variables. 2021-09-30 18:27:53 -03:00
8 changed files with 24 additions and 15 deletions

View File

@ -7,7 +7,7 @@ module.exports = {
} }
}, },
parser: '@babel/eslint-parser', parser: '@babel/eslint-parser',
extends: ['@rocket.chat/eslint-config', 'prettier'], extends: ['@rocket.chat/eslint-config', 'prettier', 'plugin:react/recommended'],
parserOptions: { parserOptions: {
sourceType: 'module', sourceType: 'module',
ecmaVersion: 2017, ecmaVersion: 2017,
@ -100,7 +100,7 @@ module.exports = {
'no-undef': 2, 'no-undef': 2,
'no-unreachable': 2, 'no-unreachable': 2,
'no-unused-expressions': 0, 'no-unused-expressions': 0,
'no-unused-vars': 'off', 'no-unused-vars': 2,
'max-len': 0, 'max-len': 0,
'react/jsx-uses-vars': 2, 'react/jsx-uses-vars': 2,
'no-void': 2, 'no-void': 2,
@ -147,7 +147,10 @@ module.exports = {
'no-async-promise-executor': [0], 'no-async-promise-executor': [0],
'max-classes-per-file': [0], 'max-classes-per-file': [0],
'no-multiple-empty-lines': [0], 'no-multiple-empty-lines': [0],
'no-sequences': 'off' 'no-sequences': 'off',
'react/no-direct-mutation-state': 'off',
'react/prop-types': 'off',
'react/display-name': 'off'
}, },
globals: { globals: {
__DEV__: true __DEV__: true

View File

@ -16,7 +16,7 @@ interface IPasscodeDots {
const Dots = React.memo(({ passcode, theme, length }: IPasscodeDots) => ( const Dots = React.memo(({ passcode, theme, length }: IPasscodeDots) => (
<View style={styles.dotsContainer}> <View style={styles.dotsContainer}>
{range(length).map(val => { {range(length).map((val, index) => {
const lengthSup = passcode.length >= val + 1; const lengthSup = passcode.length >= val + 1;
const height = lengthSup ? SIZE_FULL : SIZE_EMPTY; const height = lengthSup ? SIZE_FULL : SIZE_EMPTY;
const width = lengthSup ? SIZE_FULL : SIZE_EMPTY; const width = lengthSup ? SIZE_FULL : SIZE_EMPTY;
@ -30,7 +30,7 @@ const Dots = React.memo(({ passcode, theme, length }: IPasscodeDots) => (
const marginRight = lengthSup ? 10 - (SIZE_FULL - SIZE_EMPTY) / 2 : 10; const marginRight = lengthSup ? 10 - (SIZE_FULL - SIZE_EMPTY) / 2 : 10;
const marginLeft = lengthSup ? 10 - (SIZE_FULL - SIZE_EMPTY) / 2 : 10; const marginLeft = lengthSup ? 10 - (SIZE_FULL - SIZE_EMPTY) / 2 : 10;
return ( return (
<View style={styles.dotsView}> <View style={styles.dotsView} key={index}>
<View <View
style={{ style={{
height, height,

View File

@ -50,8 +50,10 @@ const Accessory = ({ blockId, appId, element, parser }: IAccessory) =>
parser.renderAccessories({ blockId, appId, ...element }, BLOCK_CONTEXT.SECTION, parser); parser.renderAccessories({ blockId, appId, ...element }, BLOCK_CONTEXT.SECTION, parser);
const Fields = ({ fields, parser, theme }: IFields) => const Fields = ({ fields, parser, theme }: IFields) =>
fields.map((field: any) => ( fields.map((field: any, index: number) => (
<Text style={[styles.text, styles.field, { color: themes[theme].bodyText }]}>{parser.text(field)}</Text> <Text style={[styles.text, styles.field, { color: themes[theme].bodyText }]} key={index}>
{parser.text(field)}
</Text>
)); ));
const accessoriesRight = ['image', 'overflow']; const accessoriesRight = ['image', 'overflow'];

View File

@ -140,8 +140,8 @@ const CannedResponseDetail = ({ navigation, route }) => {
<Text style={[styles.itemLabel, { color: themes[theme].titleText }]}>{I18n.t('Tags')}</Text> <Text style={[styles.itemLabel, { color: themes[theme].titleText }]}>{I18n.t('Tags')}</Text>
<View style={styles.cannedTagContainer}> <View style={styles.cannedTagContainer}>
{cannedResponse?.tags?.length > 0 ? ( {cannedResponse?.tags?.length > 0 ? (
cannedResponse.tags.map(t => ( cannedResponse.tags.map((t, index) => (
<View style={[styles.cannedTagWrap, { backgroundColor: themes[theme].searchboxBackground }]}> <View style={[styles.cannedTagWrap, { backgroundColor: themes[theme].searchboxBackground }]} key={index}>
<Text style={[styles.cannedTag, { color: themes[theme].auxiliaryTintColor }]}>{t}</Text> <Text style={[styles.cannedTag, { color: themes[theme].auxiliaryTintColor }]}>{t}</Text>
</View> </View>
)) ))

View File

@ -32,8 +32,8 @@ const CannedResponseItem = ({ theme, onPressDetail, shortcut, scope, onPressUse,
</Text> </Text>
<View style={styles.cannedTagContainer}> <View style={styles.cannedTagContainer}>
{tags?.length > 0 {tags?.length > 0
? tags.map(t => ( ? tags.map((t, index) => (
<View style={[styles.cannedTagWrap, { backgroundColor: themes[theme].searchboxBackground }]}> <View style={[styles.cannedTagWrap, { backgroundColor: themes[theme].searchboxBackground }]} key={index}>
<Text style={[styles.cannedTag, { color: themes[theme].auxiliaryTintColor }]}>{t}</Text> <Text style={[styles.cannedTag, { color: themes[theme].auxiliaryTintColor }]}>{t}</Text>
</View> </View>
)) ))

View File

@ -230,6 +230,7 @@ const LivechatEditView = ({ user, navigation, route, theme, editOmnichannelConta
}} }}
theme={theme} theme={theme}
editable={!!permissions[0]} editable={!!permissions[0]}
key={index}
/> />
))} ))}
<Title title={I18n.t('Conversation')} theme={theme} /> <Title title={I18n.t('Conversation')} theme={theme} />
@ -276,6 +277,7 @@ const LivechatEditView = ({ user, navigation, route, theme, editOmnichannelConta
}} }}
theme={theme} theme={theme}
editable={!!permissions[1]} editable={!!permissions[1]}
key={index}
/> />
))} ))}

View File

@ -666,8 +666,10 @@ class RoomInfoEditView extends React.Component {
) : null} ) : null}
{room.broadcast {room.broadcast
? [ ? [
<Text style={styles.broadcast}>{I18n.t('Broadcast_Channel')}</Text>, <Text style={styles.broadcast} key={0}>
<View style={[styles.divider, { borderColor: themes[theme].separatorColor }]} /> {I18n.t('Broadcast_Channel')}
</Text>,
<View style={[styles.divider, { borderColor: themes[theme].separatorColor }]} key={1} />
] ]
: null} : null}
{!compareServerVersion(serverVersion, '3.0.0', methods.lowerThan) ? ( {!compareServerVersion(serverVersion, '3.0.0', methods.lowerThan) ? (

View File

@ -5,11 +5,11 @@ import Item from './Item';
const CustomFields = ({ customFields, theme }) => { const CustomFields = ({ customFields, theme }) => {
if (customFields) { if (customFields) {
return Object.keys(customFields).map(title => { return Object.keys(customFields).map((title, index) => {
if (!customFields[title]) { if (!customFields[title]) {
return; return;
} }
return <Item label={title} content={customFields[title]} theme={theme} />; return <Item label={title} content={customFields[title]} theme={theme} key={index} />;
}); });
} }