1
0
mirror of https://github.com/uetchy/namae.git synced 2025-08-20 18:08:11 +09:00

chore: add eslint rules

This commit is contained in:
2019-12-24 01:57:07 +09:00
parent 934486d64f
commit 1fd9332bdc
35 changed files with 381 additions and 404 deletions

View File

@@ -3,14 +3,14 @@ import * as Sentry from '@sentry/browser';
const isProduction = process.env.NODE_ENV !== 'development';
export function initGA() {
export function initGA(): void {
if (isProduction) {
ReactGA.initialize('UA-28919359-15');
ReactGA.pageview(window.location.pathname + window.location.search);
}
}
export function sendQueryStatistics(queryLength: number) {
export function sendQueryStatistics(queryLength: number): void {
if (isProduction) {
ReactGA.event({
category: 'Search',
@@ -20,7 +20,7 @@ export function sendQueryStatistics(queryLength: number) {
}
}
export function initSentry() {
export function initSentry(): void {
if (isProduction) {
Sentry.init({
dsn: 'https://7ab2df74aead499b950ebef190cc40b7@sentry.io/1759299',
@@ -28,7 +28,13 @@ export function initSentry() {
}
}
export function sendError(error: Error, errorInfo: any): Promise<string> {
export function sendError(
error: Error,
errorInfo: {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
[key: string]: any;
},
): Promise<string> {
return new Promise((resolve) => {
if (isProduction) {
Sentry.withScope((scope) => {

View File

@@ -1,10 +1,10 @@
interface CrispWindow extends Window {
$crisp: any[];
$crisp: unknown[];
CRISP_WEBSITE_ID: string;
}
declare var window: CrispWindow;
declare let window: CrispWindow;
export function initCrisp() {
export function initCrisp(): void {
window.$crisp = [];
window.CRISP_WEBSITE_ID = '92b2e096-6892-47dc-bf4a-057bad52d82e';
const s = document.createElement('script');

View File

@@ -12,7 +12,7 @@ export function useDeferredState<T>(
setResponse(innerValue);
}, duration);
return () => {
return (): void => {
clearTimeout(fn);
};
}, [duration, innerValue]);

View File

@@ -2,7 +2,7 @@ interface CustomNavigator extends Navigator {
standalone?: boolean;
}
export function isStandalone() {
export function isStandalone(): boolean {
const navigator: CustomNavigator = window.navigator;
return 'standalone' in navigator && navigator.standalone;
return 'standalone' in navigator && navigator.standalone === true;
}

View File

@@ -15,7 +15,7 @@ const Container = styled.div`
align-items: center;
`;
const Fallback = () => (
const Fallback: React.FC = () => (
<Container>
<BarLoader />
</Container>

View File

@@ -1,4 +1,4 @@
export function capitalize(text: string) {
export function capitalize(text: string): string {
if (text.length === 0) return '';
return text[0].toUpperCase() + text.slice(1).toLowerCase();
}