Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run Prettier and fix ESLint complaints #28

Merged
merged 5 commits into from Dec 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions package.json
Expand Up @@ -34,8 +34,8 @@
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject",
"lint": "eslint src/**/*.{js,jsx,ts,tsx}",
"lint:fix": "eslint --fix src/**/*.{js,jsx,ts,tsx}"
"lint": "eslint --no-error-on-unmatched-pattern src/**/*.{js,jsx,ts,tsx}",
"lint:fix": "eslint --no-error-on-unmatched-pattern --fix src/**/*.{js,jsx,ts,tsx}"
Comment on lines +37 to +38
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok it turns out I could just add this option here, sorry for the noise in the PR

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no problem, nice to see that we have a fix for this.

},
"browserslist": {
"production": [
Expand Down
16 changes: 8 additions & 8 deletions src/App.test.tsx
@@ -1,10 +1,10 @@
import React from 'react';
import { render, screen } from '@testing-library/react';
import App from './App';
import React from "react"
import { render, screen } from "@testing-library/react"
import App from "./App"

// TODO this needs to be populated with real tests
test('renders learn react link', () => {
render(<App />);
const linkElement = screen.getByText(/learn react/i);
expect(linkElement).toBeInTheDocument();
});
test("renders learn react link", () => {
render(<App />)
const linkElement = screen.getByText(/learn react/i)
expect(linkElement).toBeInTheDocument()
})
9 changes: 4 additions & 5 deletions src/App.tsx
@@ -1,8 +1,7 @@
import React from 'react';
import React from "react"

import BaseTemplate from "./pages/BaseTemplate";
import BaseTemplate from "./pages/BaseTemplate"

const App = () => <BaseTemplate />

const App = () => <BaseTemplate />;

export default App;
export default App
70 changes: 38 additions & 32 deletions src/apiResponses.ts
@@ -1,51 +1,57 @@
import {Slices} from "./slices";
import { Slices } from "./slices"

// Different classes representing possible Api Response outcomes
class JsonParseError {
msg: string
constructor(msg : string) {
this.msg = msg
}
msg: string
constructor(msg: string) {
this.msg = msg
}
}

class ApiHttpError {
code: number
msg: string
headers: string
constructor(code: number, msg : string, headers: string) {
this.code = code
this.msg = msg
this.headers = headers
}
code: number
msg: string
headers: string
constructor(code: number, msg: string, headers: string) {
this.code = code
this.msg = msg
this.headers = headers
}
}

class CompilerError {
msg: string
errortype: string
constructor(msg: string, errortype: string){
this.msg = msg
this.errortype = errortype;
}
msg: string
errortype: string
constructor(msg: string, errortype: string) {
this.msg = msg
this.errortype = errortype
}
}

class CompilationResultSuccess {
slices: Slices
compilation_text: string
constructor(slices : Slices, compilation_text : string) {
this.slices = slices
this.compilation_text = compilation_text
}
slices: Slices
compilation_text: string
constructor(slices: Slices, compilation_text: string) {
this.slices = slices
this.compilation_text = compilation_text
}
}

class NoServerResponse {
response: string
constructor(response: string) {
this.response = response
}
response: string
constructor(response: string) {
this.response = response
}
}

type ApiResponse = null | JsonParseError | ApiHttpError | CompilationResultSuccess | CompilerError | NoServerResponse;
type ApiResponse =
| null
| JsonParseError
| ApiHttpError
| CompilationResultSuccess
| CompilerError
| NoServerResponse

export type {ApiResponse}
export type { ApiResponse }

export {JsonParseError,ApiHttpError,CompilationResultSuccess,NoServerResponse,CompilerError}
export { JsonParseError, ApiHttpError, CompilationResultSuccess, NoServerResponse, CompilerError }
11 changes: 5 additions & 6 deletions src/appState.ts
@@ -1,16 +1,15 @@
import React from "react";
import {ApiResponse} from "./apiResponses";
import React from "react"
import { ApiResponse } from "./apiResponses"

class AppState {
compilationIsLoading : boolean = false
compilationIsLoading: boolean = false
apiResponse: ApiResponse = null
}

interface AppStateProps {
appState : AppState;
setAppState : React.Dispatch<AppState>
appState: AppState
setAppState: React.Dispatch<AppState>
}

export { AppState }
export type { AppStateProps }