Skip to content

Commit

Permalink
Merge pull request #695 from crowi/upgrade/jest
Browse files Browse the repository at this point in the history
Upgrade dev env packages.
  • Loading branch information
sotarok committed Jun 30, 2020
2 parents c0ac4fd + bb8f854 commit 9facea9
Show file tree
Hide file tree
Showing 144 changed files with 23,052 additions and 12,241 deletions.
5 changes: 4 additions & 1 deletion .eslintrc
Expand Up @@ -23,15 +23,18 @@
"rules": {
"@typescript-eslint/camelcase": "off",
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/explicit-member-accessibility": "off",
"@typescript-eslint/no-angle-bracket-type-assertion": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-unused-vars": "off",
"@typescript-eslint/no-use-before-define": "off",
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/ban-ts-ignore": "off",
"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/ban-types": "off",
"eqeqeq": "off",
"camelcase": "off",
"handle-callback-err": "off",
"no-console": "off",
"no-global-assign": "off",
Expand Down
2 changes: 1 addition & 1 deletion client/app.tsx
Expand Up @@ -95,6 +95,6 @@ Object.entries(componentMappings).forEach(([key, component]) => {
})

// うわーもうー
$('a[data-toggle="tab"][href="#revision-history"]').on('show.bs.tab', function() {
$('a[data-toggle="tab"][href="#revision-history"]').on('show.bs.tab', function () {
ReactDOM.render(<PageHistory pageId={pageId} crowi={crowi} />, document.getElementById('revision-history'))
})
10 changes: 5 additions & 5 deletions client/components/Admin/App/AWSSettings.tsx
Expand Up @@ -22,7 +22,7 @@ const AWSSettings: FC<Props> = ({ settingForm, update, alert }) => {
const [accessKeyId, setAccessKeyId] = useState(settingForm['upload:aws:accessKeyId'] || '')
const [secretAccessKey, setSecretAccessKey] = useState(settingForm['upload:aws:secretAccessKey'] || '')

const handleSubmit = e => {
const handleSubmit = (e) => {
e.preventDefault()
update({
'upload:aws:region': region,
Expand Down Expand Up @@ -51,22 +51,22 @@ const AWSSettings: FC<Props> = ({ settingForm, update, alert }) => {

<FormRow>
<Label for="awsRegion">{t('admin.aws.region')}</Label>
<Input id="awsRegion" placeholder="例: ap-northeast-1" value={region} onChange={e => setRegion(e.target.value)} />
<Input id="awsRegion" placeholder="例: ap-northeast-1" value={region} onChange={(e) => setRegion(e.target.value)} />
</FormRow>

<FormRow>
<Label for="awsBucket">{t('admin.aws.bucket')}</Label>
<Input id="awsBucket" placeholder="例: crowi" value={bucket} onChange={e => setBucket(e.target.value)} />
<Input id="awsBucket" placeholder="例: crowi" value={bucket} onChange={(e) => setBucket(e.target.value)} />
</FormRow>

<FormRow>
<Label for="accessKeyId">{t('admin.aws.access_key_id')}</Label>
<Input id="accessKeyId" value={accessKeyId} onChange={e => setAccessKeyId(e.target.value)} />
<Input id="accessKeyId" value={accessKeyId} onChange={(e) => setAccessKeyId(e.target.value)} />
</FormRow>

<FormRow>
<Label for="secretAccessKey">{t('admin.aws.secret_access_key')}</Label>
<Input id="secretAccessKey" value={secretAccessKey} onChange={e => setSecretAccessKey(e.target.value)} />
<Input id="secretAccessKey" value={secretAccessKey} onChange={(e) => setSecretAccessKey(e.target.value)} />
</FormRow>

<FormRow>
Expand Down
8 changes: 4 additions & 4 deletions client/components/Admin/App/AppPage.tsx
Expand Up @@ -12,7 +12,7 @@ function useRequest() {
const [requesting, setRequesting] = useState(false)
const startRequest = () => setRequesting(true)
const finishRequest = () => setRequesting(false)
const executeRequest = async request => {
const executeRequest = async (request) => {
try {
startRequest()
await request()
Expand All @@ -27,7 +27,7 @@ function useAlert() {
const [alert, setAlert] = useState({})

const showAlert = (action, status, message) => setAlert({ ...alert, [action]: { message, status, show: true } })
const hideAlert = action => {
const hideAlert = (action) => {
const { message, status } = alert[action] || { message: '', status: '' }
setAlert({ ...alert, [action]: { message, status, show: false } })
}
Expand All @@ -41,7 +41,7 @@ export default function AppPage() {
const [{ alert }, { showAlert, hideAlert }] = useAlert()
const defaultAlert = { status: '', show: false, message: '' }

const updateSettings = action => params =>
const updateSettings = (action) => (params) =>
executeRequest(async () => {
try {
await crowi.apiPost(`/admin/settings/${action}`, { settingForm: params })
Expand All @@ -55,7 +55,7 @@ export default function AppPage() {
}
})

const getProps = action => ({ update: updateSettings(action), alert: alert[action] || defaultAlert, settingForm, requesting })
const getProps = (action) => ({ update: updateSettings(action), alert: alert[action] || defaultAlert, settingForm, requesting })

useEffect(() => {
fetchSettings()
Expand Down
6 changes: 3 additions & 3 deletions client/components/Admin/App/AppSettings.tsx
Expand Up @@ -20,7 +20,7 @@ const AppSettings: FC<Props> = ({ isUploadable, settingForm, update, alert }) =>
const [confidential, setConfidential] = useState(settingForm['app:confidential'])
const [fileUpload, setFileUpload] = useState(settingForm['app:fileUpload'])

const handleSubmit = e => {
const handleSubmit = (e) => {
e.preventDefault()
update({
'app:title': title,
Expand All @@ -40,7 +40,7 @@ const AppSettings: FC<Props> = ({ isUploadable, settingForm, update, alert }) =>

<FormRow>
<Label for="appTitle">{t('admin.app.title')}</Label>
<Input id="appTitle" value={title} onChange={e => setTitle(e.target.value)} />
<Input id="appTitle" value={title} onChange={(e) => setTitle(e.target.value)} />
<FormText color="muted">{t('admin.app.title_description')}</FormText>
</FormRow>

Expand All @@ -49,7 +49,7 @@ const AppSettings: FC<Props> = ({ isUploadable, settingForm, update, alert }) =>
<Input
id="appConfidential"
value={confidential}
onChange={e => setConfidential(e.target.value)}
onChange={(e) => setConfidential(e.target.value)}
placeholder={t('admin.app.confidential_placeholder')}
/>
<FormText color="muted">{t('admin.app.confidential_description')}</FormText>
Expand Down
8 changes: 4 additions & 4 deletions client/components/Admin/App/GitHubSettings.tsx
Expand Up @@ -20,7 +20,7 @@ const GitHubSettings: FC<Props> = ({ settingForm, update, alert }) => {
const [clientSecret, setClientSecret] = useState(settingForm['github:clientSecret'])
const [organization, setOrganization] = useState(settingForm['github:organization'])

const handleSubmit = e => {
const handleSubmit = (e) => {
e.preventDefault()
update({
'github:clientId': clientId,
Expand All @@ -46,17 +46,17 @@ const GitHubSettings: FC<Props> = ({ settingForm, update, alert }) => {

<FormRow>
<Label for="githubClientId">{t('admin.github.client_id')}</Label>
<Input id="githubClientId" value={clientId} onChange={e => setClientId(e.target.value)} />
<Input id="githubClientId" value={clientId} onChange={(e) => setClientId(e.target.value)} />
</FormRow>

<FormRow>
<Label for="githubClientSecret">{t('admin.github.client_secret')}</Label>
<Input id="githubClientSecret" value={clientSecret} onChange={e => setClientSecret(e.target.value)} />
<Input id="githubClientSecret" value={clientSecret} onChange={(e) => setClientSecret(e.target.value)} />
</FormRow>

<FormRow>
<Label for="githubOrganization">{t('admin.github.organization')}</Label>
<Input id="githubOrganization" value={organization} onChange={e => setOrganization(e.target.value)} />
<Input id="githubOrganization" value={organization} onChange={(e) => setOrganization(e.target.value)} />
</FormRow>

<FormRow>
Expand Down
6 changes: 3 additions & 3 deletions client/components/Admin/App/GoogleSettings.tsx
Expand Up @@ -19,7 +19,7 @@ const GoogleSettings: FC<Props> = ({ settingForm, update, alert }) => {
const [clientId, setClientId] = useState(settingForm['google:clientId'])
const [clientSecret, setClientSecret] = useState(settingForm['google:clientSecret'])

const handleSubmit = e => {
const handleSubmit = (e) => {
e.preventDefault()
update({
'google:clientId': clientId,
Expand All @@ -40,12 +40,12 @@ const GoogleSettings: FC<Props> = ({ settingForm, update, alert }) => {

<FormRow>
<Label for="googleClientId">{t('admin.google.client_id')}</Label>
<Input id="googleClientId" value={clientId} onChange={e => setClientId(e.target.value)} />
<Input id="googleClientId" value={clientId} onChange={(e) => setClientId(e.target.value)} />
</FormRow>

<FormRow>
<Label for="googleClientSecret">{t('admin.google.client_secret')}</Label>
<Input id="googleClientSecret" value={clientSecret} onChange={e => setClientSecret(e.target.value)} />
<Input id="googleClientSecret" value={clientSecret} onChange={(e) => setClientSecret(e.target.value)} />
</FormRow>

<FormRow>
Expand Down
18 changes: 9 additions & 9 deletions client/components/Admin/App/MailSettings.tsx
Expand Up @@ -26,7 +26,7 @@ const MailSettings: FC<Props> = ({ settingForm, update, alert }) => {
const [accessKeyId, setAccessKeyId] = useState(settingForm['mail:aws:accessKeyId'] || '')
const [secretAccessKey, setSecretAccessKey] = useState(settingForm['mail:aws:secretAccessKey'] || '')

const handleSubmit = e => {
const handleSubmit = (e) => {
e.preventDefault()
update({
'mail:from': mail,
Expand Down Expand Up @@ -60,7 +60,7 @@ const MailSettings: FC<Props> = ({ settingForm, update, alert }) => {

<FormRow>
<Label for="mailFrom">{t('admin.mail.from')}</Label>
<Input id="mailFrom" placeholder={t('admin.mail.from_placeholder')} value={mail} onChange={e => setMail(e.target.value)} />
<Input id="mailFrom" placeholder={t('admin.mail.from_placeholder')} value={mail} onChange={(e) => setMail(e.target.value)} />
</FormRow>

<FormGroup>
Expand All @@ -70,11 +70,11 @@ const MailSettings: FC<Props> = ({ settingForm, update, alert }) => {
</Col>
<Col xs="4">
<Label for="mailSmtpHost">{t('admin.mail.smtp.host')}</Label>
<Input id="mailSmtpHost" value={host} onChange={e => setHost(e.target.value)} />
<Input id="mailSmtpHost" value={host} onChange={(e) => setHost(e.target.value)} />
</Col>
<Col xs="2">
<Label for="mailSmtpPort">{t('admin.mail.smtp.port')}</Label>
<Input id="mailSmtpPort" value={port} onChange={e => setPort(e.target.value)} />
<Input id="mailSmtpPort" value={port} onChange={(e) => setPort(e.target.value)} />
</Col>
</Row>
</FormGroup>
Expand All @@ -83,11 +83,11 @@ const MailSettings: FC<Props> = ({ settingForm, update, alert }) => {
<Row>
<Col xs={{ size: 3, offset: 4 }}>
<Label for="mailSmtpUser">{t('admin.mail.smtp.user')}</Label>
<Input id="mailSmtpUser" value={user} onChange={e => setUser(e.target.value)} />
<Input id="mailSmtpUser" value={user} onChange={(e) => setUser(e.target.value)} />
</Col>
<Col xs="3">
<Label for="mailSmtpPassword">{t('admin.mail.smtp.password')}</Label>
<Input type="password" id="mailSmtpPassword" value={password} onChange={e => setPassword(e.target.value)} />
<Input type="password" id="mailSmtpPassword" value={password} onChange={(e) => setPassword(e.target.value)} />
</Col>
</Row>
</FormGroup>
Expand All @@ -98,17 +98,17 @@ const MailSettings: FC<Props> = ({ settingForm, update, alert }) => {

<FormRow>
<Label for="mailAwsRegion">{t('admin.mail.aws.region')}</Label>
<Input id="mailAwsRegion" value={region} onChange={e => setRegion(e.target.value)} />
<Input id="mailAwsRegion" value={region} onChange={(e) => setRegion(e.target.value)} />
</FormRow>

<FormRow>
<Label for="mailAwsAccessKeyId">{t('admin.mail.aws.access_key_id')}</Label>
<Input id="mailAwsAccessKeyId" value={accessKeyId} onChange={e => setAccessKeyId(e.target.value)} />
<Input id="mailAwsAccessKeyId" value={accessKeyId} onChange={(e) => setAccessKeyId(e.target.value)} />
</FormRow>

<FormRow>
<Label for="mailAwsSecretAccessKey">{t('admin.mail.aws.secret_access_key')}</Label>
<Input id="mailAwsSecretAccessKey" value={secretAccessKey} onChange={e => setSecretAccessKey(e.target.value)} />
<Input id="mailAwsSecretAccessKey" value={secretAccessKey} onChange={(e) => setSecretAccessKey(e.target.value)} />
</FormRow>
</fieldset>

Expand Down
10 changes: 5 additions & 5 deletions client/components/Admin/App/SecuritySettings.tsx
Expand Up @@ -21,7 +21,7 @@ const SecuritySettings: FC<Props> = ({ registrationMode: registrationModeOptions
const [registrationMode, setRegistrationMode] = useState(settingForm['security:registrationMode'] || '')
const [registrationWhiteList, setRegistrationWhiteList] = useState(settingForm['security:registrationWhiteList'])

const handleSubmit = e => {
const handleSubmit = (e) => {
e.preventDefault()
update({
'security:basicName': basicName,
Expand All @@ -47,11 +47,11 @@ const SecuritySettings: FC<Props> = ({ registrationMode: registrationModeOptions
</Col>
<Col xs="3">
<Label for="securityBasicName">{t('admin.security.id')}</Label>
<Input id="securityBasicName" value={basicName} onChange={e => setBasicName(e.target.value)} />
<Input id="securityBasicName" value={basicName} onChange={(e) => setBasicName(e.target.value)} />
</Col>
<Col xs="3">
<Label for="securityBasicSecret">{t('admin.security.password')}</Label>
<Input id="securityBasicSecret" value={basicSecret} onChange={e => setBasicSecret(e.target.value)} />
<Input id="securityBasicSecret" value={basicSecret} onChange={(e) => setBasicSecret(e.target.value)} />
</Col>
<Col xs={{ size: 8, offset: 4 }}>
<FormText color="muted">
Expand All @@ -65,7 +65,7 @@ const SecuritySettings: FC<Props> = ({ registrationMode: registrationModeOptions

<FormRow>
<Label for="securityRegistrationMode">{t('admin.security.restriction')}</Label>
<Input type="select" id="securityRegistrationMode" value={registrationMode} onChange={e => setRegistrationMode(e.target.value)}>
<Input type="select" id="securityRegistrationMode" value={registrationMode} onChange={(e) => setRegistrationMode(e.target.value)}>
{Object.entries(registrationModeOptions).map(([mode, label]) => (
<option key={mode} value={mode}>
{label}
Expand All @@ -82,7 +82,7 @@ const SecuritySettings: FC<Props> = ({ registrationMode: registrationModeOptions
id="securityRegistrationWhiteList"
placeholder={t('admin.security.whitelist_placeholder')}
value={registrationWhiteList}
onChange={e => setRegistrationWhiteList(e.target.value)}
onChange={(e) => setRegistrationWhiteList(e.target.value)}
/>
<FormText color="muted">
<Trans i18nKey="admin.security.whitelist_description1">
Expand Down
2 changes: 1 addition & 1 deletion client/components/Admin/Backlink/BacklinkPage.tsx
Expand Up @@ -9,7 +9,7 @@ const BacklinkPage: FC<{}> = () => {
const { crowi } = useContext(AdminContext)
const [alert, setAlert] = useState({ status: '', show: false, message: '' })

const handleSubmit = async e => {
const handleSubmit = async (e) => {
e.preventDefault()

try {
Expand Down
4 changes: 2 additions & 2 deletions client/components/Admin/Notification/NotificationPatterns.tsx
Expand Up @@ -39,15 +39,15 @@ const NotificationPatterns: FC<Props> = ({ settings, addPattern, removePattern }
<tbody>
<tr>
<td>
<Input value={pathPattern} placeholder="e.g. /projects/xxx/MTG/*" onChange={e => setPathPattern(e.target.value)} />
<Input value={pathPattern} placeholder="e.g. /projects/xxx/MTG/*" onChange={(e) => setPathPattern(e.target.value)} />
<FormText color="muted">
<Trans i18nKey="admin.notification.patterns.path_pattern_description">
Path name of wiki. Pattern expression with <code>*</code> can be used.
</Trans>
</FormText>
</td>
<td>
<Input value={channel} placeholder="e.g. project-xxx" onChange={e => setChannel(e.target.value)} />
<Input value={channel} placeholder="e.g. project-xxx" onChange={(e) => setChannel(e.target.value)} />
<FormText color="muted">
<Trans i18nKey="admin.notification.patterns.channel_description">
Slack channel name. Without <code>#</code>.
Expand Down
6 changes: 3 additions & 3 deletions client/components/Admin/Notification/NotificationSettings.tsx
Expand Up @@ -18,7 +18,7 @@ const NotificationSettings: FC<Props> = ({ crowi, slackSetting, fetchSettings })
const [clientSecret, setClientSecret] = useStateWithEffect(slackSetting['slack:clientSecret'] || '')
const [alert, setAlert] = useState({ status: '', show: false, message: '' })

const handleSubmit = async e => {
const handleSubmit = async (e) => {
e.preventDefault()

try {
Expand Down Expand Up @@ -47,12 +47,12 @@ const NotificationSettings: FC<Props> = ({ crowi, slackSetting, fetchSettings })

<FormRow>
<Label for="slackClientId">{t('admin.notification.settings.client_id')}</Label>
<Input id="slackClientId" type="text" value={clientId} onChange={e => setClientId(e.target.value)} />
<Input id="slackClientId" type="text" value={clientId} onChange={(e) => setClientId(e.target.value)} />
</FormRow>

<FormRow>
<Label for="slackClientSecret">{t('admin.notification.settings.client_secret')}</Label>
<Input id="slackClientSecret" type="text" value={clientSecret} onChange={e => setClientSecret(e.target.value)} />
<Input id="slackClientSecret" type="text" value={clientSecret} onChange={(e) => setClientSecret(e.target.value)} />
</FormRow>

<FormRow>
Expand Down
4 changes: 2 additions & 2 deletions client/components/Admin/Search/AdminRebuildSearch.tsx
Expand Up @@ -27,14 +27,14 @@ export default class AdminRebuildSearch extends React.Component<Props, State> {
componentDidMount() {
const socket = this.props.crowi.getWebSocket()

socket.on('admin:addPageProgress', data => {
socket.on('admin:addPageProgress', (data) => {
this.setState({
...data,
isCompleted: false,
})
})

socket.on('admin:finishAddPage', data => {
socket.on('admin:finishAddPage', (data) => {
this.setState({
...data,
isCompleted: true,
Expand Down
2 changes: 1 addition & 1 deletion client/components/Admin/Search/SearchPage.tsx
Expand Up @@ -10,7 +10,7 @@ const SearchPage: FC<{}> = () => {
const { crowi } = useContext(AdminContext)
const [alert, setAlert] = useState({ status: '', show: false, message: '' })

const handleSubmit = async e => {
const handleSubmit = async (e) => {
e.preventDefault()

try {
Expand Down
4 changes: 2 additions & 2 deletions client/components/Admin/Share/SharePage.tsx
Expand Up @@ -11,7 +11,7 @@ const SharePage: FC<{}> = () => {
const [alert, setAlert] = useState({ status: '', show: false, message: '' })
const [externalShare, setExternalShare] = useState(Boolean(Number(settingForm['app:externalShare'])))

const handleSubmit = async e => {
const handleSubmit = async (e) => {
e.preventDefault()

try {
Expand Down Expand Up @@ -52,7 +52,7 @@ const SharePage: FC<{}> = () => {
id="appExternalShare"
label={t('admin.share.enable_external_share')}
checked={externalShare}
onChange={e => setExternalShare(!externalShare)}
onChange={(e) => setExternalShare(!externalShare)}
/>
</Col>
</Row>
Expand Down

0 comments on commit 9facea9

Please sign in to comment.