Skip to content

Commit 72274d2

Browse files
committed
fix: lint
1 parent e009c7b commit 72274d2

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

src/shared/components/Contentful/Article/Article.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ import IconFacebook from 'assets/images/icon-facebook.svg';
3434
import IconTwitter from 'assets/images/icon-twitter.svg';
3535
import IconLinkedIn from 'assets/images/icon-linkedIn.svg';
3636
import DiscordIconWhite from 'assets/images/tc-edu/discord-icon-white.svg';
37-
import { getSecureRandomIndex } from 'utils/secureRandom';
37+
import getSecureRandomIndex from 'utils/secureRandom';
3838

3939
const htmlToText = require('html-to-text');
4040

src/shared/components/Contentful/MemberTalkCloud/MemberTalkCloud.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ import PT from 'prop-types';
99
import React from 'react';
1010
import { themr } from 'react-css-super-themr';
1111
import { fixStyle } from 'utils/contentful';
12+
import getSecureRandomIndex from 'utils/secureRandom';
1213
import defaultTheme from './themes/default.scss';
13-
import { getSecureRandomIndex } from 'utils/secureRandom';
1414

1515
const MAX_MARGIN_TOP = 0;
1616
const MIN_MARGIN_LEFT = -20;

src/shared/utils/secureRandom.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
const getCryptoLibrary = () => {
22
if (typeof window !== 'undefined' && window.crypto) {
33
return window.crypto;
4-
} else if (typeof process !== 'undefined' && process.versions && process.versions.node) {
5-
const nodeCrypto = require('crypto');
6-
return nodeCrypto;
74
}
5+
/* eslint-disable global-require */
6+
const nodeCrypto = require('crypto');
7+
return nodeCrypto;
88
}
99

10-
export const getSecureRandomIndex = (min, max) => {
10+
export default getSecureRandomIndex = (min, max) => {
1111
const crypto = getCryptoLibrary();
1212
const random = new Uint32Array(1);
1313
if (typeof crypto.getRandomValues === 'function') {
@@ -18,8 +18,8 @@ export const getSecureRandomIndex = (min, max) => {
1818

1919
if (!max) {
2020
return random[0] % min;
21-
} else {
22-
const range = max - min + 1;
23-
return min + (random[0] % range);
2421
}
22+
23+
const range = max - min + 1;
24+
return min + (random[0] % range);
2525
};

0 commit comments

Comments
 (0)