diff --git a/frontend/.browserslistrc b/frontend/.browserslistrc new file mode 100644 index 000000000..f4f95cac0 --- /dev/null +++ b/frontend/.browserslistrc @@ -0,0 +1 @@ +> 0.25% and not dead \ No newline at end of file diff --git a/frontend/app/mstore/integrationsStore.ts b/frontend/app/mstore/integrationsStore.ts index 52e42ceb8..e10e23158 100644 --- a/frontend/app/mstore/integrationsStore.ts +++ b/frontend/app/mstore/integrationsStore.ts @@ -52,30 +52,30 @@ class NamedIntegrationStore { makeAutoObservable(this); } - setInstance(instance: T) { + setInstance(instance: T): void { this.instance = instance; } - setList(list: T[]) { + setList(list: T[]): void { this.list = list; } - setFetched(fetched: boolean) { + setFetched(fetched: boolean): void { this.fetched = fetched; } - setIssuesFetched(issuesFetched: boolean) { + setIssuesFetched(issuesFetched: boolean): void { this.issuesFetched = issuesFetched; } - fetchIntegrations = async () => { + fetchIntegrations = async (): Promise => { const { data } = await integrationsService.fetchList(this.name); this.setList( data.map((config: Record) => new this.NamedType(config)) ); }; - fetchIntegration = async (siteId: string) => { + fetchIntegration = async (siteId: string): void => { const { data } = await integrationsService.fetchIntegration( this.name, siteId @@ -83,7 +83,7 @@ class NamedIntegrationStore { this.setInstance(new this.NamedType(data)); }; - saveIntegration(name: string, siteId: string) { + saveIntegration(name: string, siteId: string): void { if (!this.instance) return; const response = integrationsService.saveIntegration( name, @@ -93,16 +93,16 @@ class NamedIntegrationStore { return; } - edit(data: T) { + edit(data: T): void { this.setInstance(data); } deleteIntegration(siteId: string) { if (!this.instance) return; - integrationsService.removeIntegration(this.name, siteId); + return integrationsService.removeIntegration(this.name, siteId); } - init(config: Record) { + init(config: Record): void { this.instance = new this.NamedType(config); } } diff --git a/frontend/app/services/IntegrationsService.ts b/frontend/app/services/IntegrationsService.ts index be23ee449..d54f90aad 100644 --- a/frontend/app/services/IntegrationsService.ts +++ b/frontend/app/services/IntegrationsService.ts @@ -1,7 +1,7 @@ import BaseService from "./BaseService"; export default class IntegrationsService extends BaseService { - fetchList = async (name) => { + fetchList = async (name: string) => { const r = await this.client.get(`/integrations/${name}`) const data = await r.json() @@ -30,4 +30,5 @@ export default class IntegrationsService extends BaseService { const res = await r.json() return res + } } diff --git a/frontend/babel.config.js b/frontend/babel.config.js index 4fdf68799..16518fa23 100644 --- a/frontend/babel.config.js +++ b/frontend/babel.config.js @@ -1,20 +1,27 @@ module.exports = { - "presets": [ - "@babel/preset-env", - "@babel/preset-react", - "@babel/preset-typescript" + presets: [ + '@babel/preset-env', + '@babel/preset-react', + '@babel/preset-typescript', + ], + plugins: [ + 'babel-plugin-react-require', + ['@babel/plugin-proposal-decorators', { legacy: true }], + [ + 'prismjs', + { + languages: [ + 'javascript', + 'css', + 'bash', + 'typescript', + 'jsx', + 'kotlin', + 'swift', + ], + theme: 'default', + css: true, + }, ], - "plugins": [ - "babel-plugin-react-require", - ["@babel/plugin-transform-private-property-in-object", { "loose":true } ], - [ "@babel/plugin-transform-runtime", { "regenerator": true } ], - [ "@babel/plugin-proposal-decorators", { "legacy":true } ], - [ "@babel/plugin-transform-class-properties", { "loose":true } ], - [ "@babel/plugin-transform-private-methods", { "loose": true }], - ["prismjs", { - "languages": ["javascript", "css", "bash", "typescript", "jsx", "kotlin", "swift"], - "theme": "default", - "css": true - }] - ] -} \ No newline at end of file + ], +}; diff --git a/frontend/tsconfig.json b/frontend/tsconfig.json index 4347780a5..d0336ee7a 100644 --- a/frontend/tsconfig.json +++ b/frontend/tsconfig.json @@ -9,7 +9,8 @@ "forceConsistentCasingInFileNames": true, "resolveJsonModule": true, "esModuleInterop": true, - "target": "es6", + "target": "ES2017", + "lib": ["dom", "es2023"], "allowJs": true, "isolatedModules": true, "moduleResolution": "node", diff --git a/frontend/webpack.config.ts b/frontend/webpack.config.ts index 367b20546..fa946c48d 100644 --- a/frontend/webpack.config.ts +++ b/frontend/webpack.config.ts @@ -15,9 +15,9 @@ import pathAlias from './path-alias'; interface Configuration extends WebpackConfiguration { devServer?: WebpackDevServerConfiguration } - +console.log('running in', isDevelopment ? 'development' : 'production'); const config: Configuration = { - // mode: isDevelopment ? "development" : "production", + mode: isDevelopment ? "development" : "production", output: { publicPath: "/", filename: 'app-[contenthash:7].js', @@ -34,7 +34,7 @@ const config: Configuration = { rules: [ { test: /\.(ts|js)x?$/i, - exclude: /node_modules/, + exclude: isDevelopment ? /node_modules/ : undefined, use: ['thread-loader', { loader: "babel-loader", options: {