Skip to content

Commit

Permalink
Merge pull request #27925 from software-mansion-labs/ts-migration/cur…
Browse files Browse the repository at this point in the history
…ly-rule

[No QA] Add curly option to ESLint config for Typescript
  • Loading branch information
Hayata Suenaga authored Sep 21, 2023
2 parents 00f77a7 + c465f0b commit d7205e5
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 7 deletions.
5 changes: 3 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const restrictedImportPatterns = [
];

module.exports = {
extends: ['expensify', 'plugin:storybook/recommended', 'plugin:react-hooks/recommended', 'prettier', 'plugin:react-native-a11y/basic'],
extends: ['expensify', 'plugin:storybook/recommended', 'plugin:react-hooks/recommended', 'plugin:react-native-a11y/basic', 'prettier'],
plugins: ['react-hooks', 'react-native-a11y'],
parser: 'babel-eslint',
ignorePatterns: ['!.*', 'src/vendor', '.github/actions/**/index.js', 'desktop/dist/*.js', 'dist/*.js', 'node_modules/.bin/**', 'node_modules/.cache/**', '.git/**'],
Expand All @@ -46,7 +46,6 @@ module.exports = {
touchables: ['PressableWithoutFeedback', 'PressableWithFeedback'],
},
],
curly: 'error',
},
},
{
Expand Down Expand Up @@ -76,6 +75,7 @@ module.exports = {
patterns: restrictedImportPatterns,
},
],
curly: 'error',
},
},
{
Expand Down Expand Up @@ -162,6 +162,7 @@ module.exports = {
patterns: restrictedImportPatterns,
},
],
curly: 'error',
},
},
{
Expand Down
4 changes: 3 additions & 1 deletion src/components/MapView/MapView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ const MapView = forwardRef<MapViewHandle, MapViewProps>(({accessToken, style, ma
}, [accessToken]);

const setMapIdle = (e: MapState) => {
if (e.gestures.isGestureActive) return;
if (e.gestures.isGestureActive) {
return;
}
setIsIdle(true);
if (onMapReady) {
onMapReady();
Expand Down
8 changes: 6 additions & 2 deletions src/libs/Growl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ const isReadyPromise = new Promise((resolve) => {
});

function setIsReady() {
if (!resolveIsReadyPromise) return;
if (!resolveIsReadyPromise) {
return;
}
resolveIsReadyPromise();
}

Expand All @@ -21,7 +23,9 @@ function setIsReady() {
*/
function show(bodyText: string, type: string, duration: number = CONST.GROWL.DURATION) {
isReadyPromise.then(() => {
if (!growlRef?.current?.show) return;
if (!growlRef?.current?.show) {
return;
}
growlRef.current.show(bodyText, type, duration);
});
}
Expand Down
4 changes: 3 additions & 1 deletion src/libs/isInputAutoFilled.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ import isSelectorSupported from './isSelectorSupported';
* Check the input is auto filled or not
*/
export default function isInputAutoFilled(input: Element): boolean {
if (!input?.matches) return false;
if (!input?.matches) {
return false;
}
if (isSelectorSupported(':autofill')) {
return input.matches(':-webkit-autofill') || input.matches(':autofill');
}
Expand Down
4 changes: 3 additions & 1 deletion src/libs/requireParameters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ export default function requireParameters(parameterNames: string[], parameters:
const propertiesToRedact = ['authToken', 'password', 'partnerUserSecret', 'twoFactorAuthCode'];
const parametersCopy = {...parameters};
Object.keys(parametersCopy).forEach((key) => {
if (!propertiesToRedact.includes(key.toString())) return;
if (!propertiesToRedact.includes(key.toString())) {
return;
}

parametersCopy[key] = '<redacted>';
});
Expand Down

0 comments on commit d7205e5

Please sign in to comment.