Skip to content

Commit

Permalink
fixed: change quotes rule from error to warn and applied linting acro…
Browse files Browse the repository at this point in the history
…ss codebase#600

fix: change quotes rule from error to warn and apply linting across codebase-#600
  • Loading branch information
mokshith-moksh committed Oct 23, 2024
1 parent 7269dd8 commit ad6d1cc
Show file tree
Hide file tree
Showing 21 changed files with 163 additions and 159 deletions.
12 changes: 12 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"eslint.workingDirectories": [
{ "directory": "./cli", "changeProcessCWD": true },
{ "directory": "./web-server", "changeProcessCWD": true }
],
"eslint.run": "onSave",
"eslint.lintTask.enable": true,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "always"
},
"editor.formatOnSave": false
}
5 changes: 5 additions & 0 deletions cli/.eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ module.exports = {
}
},
rules: {
quotes: [
'warn',
'single',
{ avoidEscape: true, allowTemplateLiterals: true }
],
'no-unsafe-optional-chaining': [
'error',
{ disallowArithmeticOperators: true }
Expand Down
5 changes: 1 addition & 4 deletions cli/.vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
{
"recommendations": [
"gruntfuggly.todo-tree",
"stringham.copy-with-imports"
]
"recommendations": ["gruntfuggly.todo-tree", "stringham.copy-with-imports"]
}
2 changes: 1 addition & 1 deletion cli/.vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
"type": "node-terminal",
"request": "launch",
"command": "yarn dev"
},
}
]
}
6 changes: 4 additions & 2 deletions cli/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
{
"workbench.editor.labelFormat": "short",
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit"
"source.fixAll.eslint": "always"
},
"editor.formatOnSave": false,
"eslint.workingDirectories": [{ "mode": "auto" }],
"tsEssentialPlugins.autoImport.changeSorting": {
"createContext": ["react"]
},
"tsEssentialPlugins.patchOutline": true,
"editor.linkedEditing": true,
"tsEssentialPlugins.enableMethodSnippets": false,
"tsEssentialPlugins.enableMethodSnippets": false
}
4 changes: 2 additions & 2 deletions cli/libdefs/ink.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'ink-testing-library';

import {ReactNode} from 'react';
import { ReactNode } from 'react';

declare module 'ink-testing-library' {
export function render(tree: ReactNode): RenderResponse;
export function render(tree: ReactNode): RenderResponse;
}
122 changes: 61 additions & 61 deletions cli/package.json
Original file line number Diff line number Diff line change
@@ -1,63 +1,63 @@
{
"name": "cli",
"version": "0.0.0",
"license": "MIT",
"bin": "dist/cli.js",
"engines": {
"node": "^22.x"
},
"type": "module",
"scripts": {
"build": "tsc",
"dev": "tsc --watch",
"test": "yarn link-fix && ava",
"lint": "eslint source/**/*.{js,ts,tsx}",
"lint-fix": "eslint --fix --ignore-pattern 'node_modules/*' 'source/**/*.{js,ts,tsx}'",
"start": "[ -e ../.env ] && set -a && . ../.env; node dist/cli.js"
},
"files": [
"dist"
],
"dependencies": {
"@reduxjs/toolkit": "^2.2.3",
"dockerode": "^4.0.2",
"dockerode-compose": "^1.4.0",
"find-free-ports": "^3.1.1",
"ink": "^4.4.1",
"ink-spinner": "^5.0.0",
"meow": "^11.0.0",
"ramda": "^0.29.1",
"react": "^18.2.0",
"react-redux": "^9.1.1"
},
"devDependencies": {
"@types/dockerode": "^3.3.28",
"@types/dockerode-compose": "^1.4.1",
"@types/ink-testing-library": "^1.0.4",
"@types/ramda": "^0.29.12",
"@types/react": "^18.0.32",
"@typescript-eslint/eslint-plugin": "^6.10.0",
"@typescript-eslint/parser": "^6.10.0",
"ava": "^5.2.0",
"chalk": "^5.2.0",
"eslint": "^8.40.0",
"eslint-plugin-import": "^2.29.0",
"eslint-plugin-prettier": "^5.0.1",
"eslint-plugin-react": "^7.32.2",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-unused-imports": "^3.1.0",
"ink-testing-library": "^3.0.0",
"prettier": "^3.0.3",
"ts-node": "^10.9.1",
"typescript": "5.3.3"
},
"ava": {
"extensions": {
"ts": "module",
"tsx": "module"
},
"nodeArguments": [
"--loader=ts-node/esm"
]
}
"name": "cli",
"version": "0.0.0",
"license": "MIT",
"bin": "dist/cli.js",
"engines": {
"node": "^22.x"
},
"type": "module",
"scripts": {
"build": "tsc",
"dev": "tsc --watch",
"test": "yarn link-fix && ava",
"lint": "eslint source/**/*.{js,ts,tsx}",
"lint-fix": "eslint --fix --ignore-pattern 'node_modules/*' 'source/**/*.{js,ts,tsx}'",
"start": "[ -e ../.env ] && set -a && . ../.env; node dist/cli.js"
},
"files": [
"dist"
],
"dependencies": {
"@reduxjs/toolkit": "^2.2.3",
"dockerode": "^4.0.2",
"dockerode-compose": "^1.4.0",
"find-free-ports": "^3.1.1",
"ink": "^4.4.1",
"ink-spinner": "^5.0.0",
"meow": "^11.0.0",
"ramda": "^0.29.1",
"react": "^18.2.0",
"react-redux": "^9.1.1"
},
"devDependencies": {
"@types/dockerode": "^3.3.28",
"@types/dockerode-compose": "^1.4.1",
"@types/ink-testing-library": "^1.0.4",
"@types/ramda": "^0.29.12",
"@types/react": "^18.0.32",
"@typescript-eslint/eslint-plugin": "^6.10.0",
"@typescript-eslint/parser": "^6.10.0",
"ava": "^5.2.0",
"chalk": "^5.2.0",
"eslint": "^8.40.0",
"eslint-plugin-import": "^2.29.0",
"eslint-plugin-prettier": "^5.0.1",
"eslint-plugin-react": "^7.32.2",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-unused-imports": "^3.1.0",
"ink-testing-library": "^3.0.0",
"prettier": "^3.0.3",
"ts-node": "^10.9.1",
"typescript": "5.3.3"
},
"ava": {
"extensions": {
"ts": "module",
"tsx": "module"
},
"nodeArguments": [
"--loader=ts-node/esm"
]
}
}
8 changes: 4 additions & 4 deletions cli/tsconfig.dev.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"jsx": "react-jsxdev"
}
"extends": "./tsconfig.json",
"compilerOptions": {
"jsx": "react-jsxdev"
}
}
52 changes: 24 additions & 28 deletions cli/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,34 +1,30 @@
{
"compilerOptions": {
"outDir": "dist",
"allowJs": true,
"compilerOptions": {
"outDir": "dist",
"allowJs": true,
"allowSyntheticDefaultImports": true,
"jsx": "react-jsx",
"module": "Node16",
"moduleResolution": "Node16",
"moduleDetection": "force",
"target": "ES2022",
"lib": [
"DOM",
"DOM.Iterable",
"ES2022"
],
"resolveJsonModule": false,
"declaration": true,
"pretty": true,
"newLine": "lf",
"stripInternal": true,
"strict": true,
"noImplicitReturns": true,
"noImplicitOverride": true,
"noFallthroughCasesInSwitch": true,
"noUncheckedIndexedAccess": true,
"noPropertyAccessFromIndexSignature": true,
"noEmitOnError": true,
"useDefineForClassFields": true,
"forceConsistentCasingInFileNames": true,
"skipLibCheck": true,
"strictNullChecks": true
},
"include": ["source"],
"moduleDetection": "force",
"target": "ES2022",
"lib": ["DOM", "DOM.Iterable", "ES2022"],
"resolveJsonModule": false,
"declaration": true,
"pretty": true,
"newLine": "lf",
"stripInternal": true,
"strict": true,
"noImplicitReturns": true,
"noImplicitOverride": true,
"noFallthroughCasesInSwitch": true,
"noUncheckedIndexedAccess": true,
"noPropertyAccessFromIndexSignature": true,
"noEmitOnError": true,
"useDefineForClassFields": true,
"forceConsistentCasingInFileNames": true,
"skipLibCheck": true,
"strictNullChecks": true
},
"include": ["source"]
}
5 changes: 5 additions & 0 deletions web-server/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ module.exports = {
}
},
rules: {
quotes: [
'warn',
'single',
{ avoidEscape: true, allowTemplateLiterals: true }
],
'no-unsafe-optional-chaining': [
'error',
{ disallowArithmeticOperators: true }
Expand Down
5 changes: 1 addition & 4 deletions web-server/.vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
{
"recommendations": [
"gruntfuggly.todo-tree",
"stringham.copy-with-imports"
]
"recommendations": ["gruntfuggly.todo-tree", "stringham.copy-with-imports"]
}
6 changes: 4 additions & 2 deletions web-server/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
{
"workbench.editor.labelFormat": "short",
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit"
"source.fixAll.eslint": "always"
},
"editor.formatOnSave": false,
"eslint.workingDirectories": [{ "mode": "auto" }],
"tsEssentialPlugins.autoImport.changeSorting": {
"track": ["@/constants/events"],
"useTheme": ["@mui/material"],
Expand All @@ -22,5 +24,5 @@
"pagerduty",
"Serie",
"zenduty"
],
]
}
2 changes: 1 addition & 1 deletion web-server/app/api/stream/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,4 +210,4 @@ export async function GET(): Promise<Response> {
// It forces the route to be dynamically rendered on each request, which is crucial for our
// real-time streaming functionality. Without this, Next.js might try to pre-render the route
// during build time, leading to timeouts or incorrect behavior.
export const dynamic = "force-dynamic";
export const dynamic = 'force-dynamic';
2 changes: 1 addition & 1 deletion web-server/libdefs/ambient.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,6 @@ declare namespace NodeJS {
DB_USER: string;
MERGE_COMMIT_SHA: string;
BUILD_DATE: string;
BEHIND_COMMITS_COUNT?: string
BEHIND_COMMITS_COUNT?: string;
}
}
3 changes: 2 additions & 1 deletion web-server/pages/404.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { Box, Typography, Container, Button, styled } from '@mui/material';
import Head from 'next/head';
import type { ReactElement } from 'react';

import { FlexBox } from '@/components/FlexBox';

import type { ReactElement } from 'react';

const MainContent = styled(Box)(
() => `
height: 100%;
Expand Down
1 change: 0 additions & 1 deletion web-server/pages/_app.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable @next/next/no-sync-scripts */
import { CacheProvider, EmotionCache } from '@emotion/react';
import CssBaseline from '@mui/material/CssBaseline';
import { LocalizationProvider } from '@mui/x-date-pickers';
Expand Down
1 change: 1 addition & 0 deletions web-server/pages/api/internal/[org_id]/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import * as yup from 'yup';
import { handleRequest } from '@/api-helpers/axios';
import { Endpoint } from '@/api-helpers/global';
import { OrgSettingsApiResponse } from '@/types/resources';

import { syncReposForOrg } from './sync_repos';

const pathSchema = yup.object().shape({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import * as yup from 'yup';

import { getSelectedIncidentServices } from '@/api/internal/[org_id]/incident_services';
import { handleRequest } from '@/api-helpers/axios';
import { Endpoint } from '@/api-helpers/global';
import { getSelectedIncidentServices } from '@/api/internal/[org_id]/incident_services';
import {
TeamIncidentServicesApiResponse,
TeamSelectedIncidentServicesBFFApiResponse,
Expand Down
15 changes: 8 additions & 7 deletions web-server/pages/api/internal/version.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Endpoint, nullSchema } from '@/api-helpers/global';
import axios from 'axios';

import { Endpoint, nullSchema } from '@/api-helpers/global';

const dockerRepoName = 'middlewareeng/middleware';
const githubOrgName = 'middlewarehq';
const githubRepoName = 'middleware';
Expand Down Expand Up @@ -111,8 +112,7 @@ function isUpdateAvailable({
localVersionInfo: ProjectVersionInfo;
dockerLatestRemoteTag: TagCompressed;
}): boolean {

const estimatesBuildTimeInMs: number = 30*60*1000;
const estimatesBuildTimeInMs: number = 30 * 60 * 1000;

const env = process.env.NEXT_PUBLIC_APP_ENVIRONMENT;

Expand All @@ -125,15 +125,16 @@ function isUpdateAvailable({

const localBuildDate = new Date(localVersionInfo.current_build_date);
const latestRemoteDate = new Date(dockerLatestRemoteTag.last_updated);
return latestRemoteDate.getTime() - localBuildDate.getTime() > estimatesBuildTimeInMs;
return (
latestRemoteDate.getTime() - localBuildDate.getTime() >
estimatesBuildTimeInMs
);
}

async function checkNewImageRelease(): Promise<CheckNewVersionResponse> {
const versionInfo = getProjectVersionInfo();

const [dockerRemoteTags] = await Promise.all([
fetchDockerHubTags(),
]);
const [dockerRemoteTags] = await Promise.all([fetchDockerHubTags()]);

dockerRemoteTags.sort(
(a, b) =>
Expand Down
Loading

0 comments on commit ad6d1cc

Please sign in to comment.