Skip to content

Commit

Permalink
Merge pull request #324 from labzero/feature/convert
Browse files Browse the repository at this point in the history
Feature/convert
  • Loading branch information
JeffreyATW authored Jun 6, 2023
2 parents 847404f + 10f2d6b commit 5d64e5d
Show file tree
Hide file tree
Showing 299 changed files with 3,416 additions and 3,494 deletions.
2 changes: 1 addition & 1 deletion .env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ GOOGLE_CLIENT_APIKEY=
GOOGLE_SERVER_APIKEY=

# Google Analytics ID
GOOGLE_TRACKING_ID=
GOOGLE_MEASUREMENT_ID=

# JSON Web Token secret to encrypt ID token cookie
JWT_SECRET=
Expand Down
2 changes: 2 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ module.exports = {
"react/static-property-placement": "off",
"import/no-relative-packages": "off",
"import/no-import-module-exports": "off",
"no-use-before-define": "off",
"@typescript-eslint/no-use-before-define": ["error"],
},

settings: {
Expand Down
11 changes: 0 additions & 11 deletions .flowconfig

This file was deleted.

7 changes: 0 additions & 7 deletions .mocharc.js

This file was deleted.

13 changes: 13 additions & 0 deletions .mocharc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"extension": [
"ts"
],
"recursive": true,
"require": [
"ts-node/register",
"source-map-support/register",
"./test/setup.ts"
],
"exit": true,
"file": "./test/mocha-setup.ts"
}
16 changes: 10 additions & 6 deletions .nycrc
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
{
"require": ["@babel/register"],
"include": ["src"],
"reporter": ["lcov", "text"],
"sourceMap": false,
"instrument": false
}
"extends": "@istanbuljs/nyc-config-typescript",
"all": true,
"include": [
"src"
],
"reporter": [
"lcov",
"text"
]
}
18 changes: 0 additions & 18 deletions .travis.yml

This file was deleted.

37 changes: 0 additions & 37 deletions babel.config.js

This file was deleted.

9 changes: 9 additions & 0 deletions global.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ declare const __DEV__: boolean;
/// <reference types="webpack-env" />
/// <reference types="chai-jsdom" />

declare interface Window {
swUpdate?: boolean;
}

type Dispose = () => void;
type InsertCssItem = () => Dispose;
type GetCSSItem = () => string;
Expand All @@ -30,3 +34,8 @@ declare module "*.png" {
const value: string;
export default value;
}

declare module "*.svg" {
const value: string;
export default value;
}
8 changes: 0 additions & 8 deletions jest/fileTransformer.js

This file was deleted.

68 changes: 26 additions & 42 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
"@honeybadger-io/js": "^5.0.0",
"@popperjs/core": "^2.11.7",
"@reduxjs/toolkit": "^1.9.2",
"@sendgrid/helpers": "^7.7.0",
"@sendgrid/mail": "^7.7.0",
"bcrypt": "^5.1.0",
"body-parser": "^1.18.3",
"bootstrap": "^5.2.3",
Expand All @@ -23,7 +25,6 @@
"connect-flash": "^0.1.1",
"connect-session-sequelize": "^7.1.5",
"cookie-parser": "^1.4.6",
"core-js": "^3.30.2",
"cors": "^2.8.3",
"dayjs": "^1.11.7",
"dotenv": "^2.0.0",
Expand All @@ -37,24 +38,24 @@
"fastclick": "^1.0.6",
"fbjs": "^3.0.4",
"fetch-mock": "^9.11.0",
"flip-toolkit": "^7.1.0",
"google-map-react": "^2.2.0",
"history": "^5.3.0",
"immutability-helper": "^3.1.1",
"isomorphic-fetch": "^3.0.0",
"isomorphic-style-loader": "^5.3.2",
"jsonwebtoken": "^9.0.0",
"lodash.get": "^4.4.2",
"method-override": "^3.0.0",
"mocha-junit-reporter": "^2.2.0",
"morgan": "^1.10.0",
"node-fetch": "^2.6.9",
"normalizr": "^3.2.2",
"passport": "^0.6.0",
"passport-google-oauth20": "^2.0.0",
"passport-local": "^1.0.0",
"pg": "^8.9.0",
"pretty-error": "^3.0.4",
"prop-types": "^15.8.1",
"query-string": "^7.1.3",
"qs": "^6.11.2",
"react": "^18.2.0",
"react-autosuggest": "^10.0.2",
"react-bootstrap": "^2.7.0",
Expand All @@ -72,31 +73,16 @@
"reserved-usernames": "^1.0.3",
"robust-websocket": "^0.2.1",
"rotating-file-stream": "^3.1.0",
"sendgrid": "^5.2.3",
"sequelize": "^6.29.0",
"sequelize-cli": "^6.6.0",
"sequelize-typescript": "^2.1.5",
"serialize-javascript": "^6.0.1",
"source-map-support": "^0.5.9",
"sqlite3": "^5.1.5",
"universal-router": "^8.1.0",
"uuid": "^9.0.0",
"whatwg-fetch": "^3.0.0"
"uuid": "^9.0.0"
},
"devDependencies": {
"@babel/core": "^7.20.12",
"@babel/eslint-parser": "^7.19.1",
"@babel/node": "^7.20.7",
"@babel/plugin-proposal-class-properties": "^7.18.6",
"@babel/plugin-proposal-decorators": "^7.21.0",
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
"@babel/plugin-transform-modules-commonjs": "^7.20.11",
"@babel/plugin-transform-react-constant-elements": "^7.20.2",
"@babel/plugin-transform-react-inline-elements": "^7.18.6",
"@babel/preset-env": "^7.20.2",
"@babel/preset-react": "^7.18.6",
"@babel/preset-typescript": "^7.21.0",
"@babel/register": "^7.18.9",
"@istanbuljs/nyc-config-typescript": "^1.0.2",
"@jedmao/redux-mock-store": "^3.0.5",
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.10",
"@redux-devtools/extension": "^3.2.5",
Expand All @@ -116,15 +102,20 @@
"@types/google-map-react": "^2.1.7",
"@types/google.analytics": "^0.0.42",
"@types/google.maps": "^3.52.1",
"@types/lodash.get": "^4.4.7",
"@types/method-override": "^0.0.32",
"@types/mocha": "^10.0.1",
"@types/morgan": "^1.9.4",
"@types/node-fetch": "^2.6.2",
"@types/node": "^20.2.5",
"@types/passport": "^1.0.11",
"@types/passport-google-oauth20": "^2.0.11",
"@types/passport-local": "^1.0.35",
"@types/proxyquire": "^1.3.28",
"@types/react-autosuggest": "^10.1.6",
"@types/react-dom": "^18.2.4",
"@types/react-geosuggest": "^2.7.13",
"@types/react-scroll": "^1.8.7",
"@types/serialize-javascript": "^5.0.2",
"@types/sinon": "^10.0.15",
"@types/supertest": "^2.0.12",
"@types/uuid": "^9.0.0",
Expand All @@ -134,10 +125,6 @@
"@typescript-eslint/parser": "^5.59.1",
"assets-webpack-plugin": "^7.1.1",
"autoprefixer": "^9.1.5",
"babel-loader": "^9.1.0",
"babel-plugin-istanbul": "^6.1.1",
"babel-plugin-transform-react-remove-prop-types": "^0.4.18",
"babel-plugin-transform-typescript-metadata": "^0.3.2",
"browser-sync": "2.29.1",
"chai": "4.3.7",
"chai-jsdom": "^0.2.3",
Expand Down Expand Up @@ -188,6 +175,7 @@
"sass-loader": "^13.2.0",
"sequelize-mock": "^0.7.0",
"sinon": "^15.1.0",
"source-map-support": "^0.5.21",
"style-loader": "^0.13.2",
"stylelint": "^15.6.2",
"stylelint-config-standard-scss": "^9.0.0",
Expand All @@ -196,7 +184,7 @@
"svg-url-loader": "^8.0.0",
"ts-loader": "^9.4.2",
"ts-node": "^10.9.1",
"typescript": "^5.0.4",
"typescript": "^5.1.3",
"url-loader": "^4.1.1",
"webpack": "^5.76.0",
"webpack-assets-manifest": "^5.1.0",
Expand All @@ -220,21 +208,17 @@
"git add --force"
]
},
"nyc": {
"sourceMap": false,
"instrument": false
},
"scripts": {
"lint-js": "eslint --ignore-path .gitignore --ignore-pattern \"!**/.*\" .",
"lint-css": "stylelint \"src/**/*.{css,less,styl,scss,sass,sss}\"",
"lint": "npm run lint-js && npm run lint-css",
"fix-js": "npm run lint-js -- --fix",
"fix-css": "npm run lint-css -- --fix",
"fix": "npm run fix-js && npm run fix-css",
"test-file": "env TS_NODE_COMPILER_OPTIONS='{\"module\": \"commonjs\" }' mocha",
"test-file": "mocha",
"test-file-ci": "npm run test-file --reporter mocha-junit-reporter",
"test": "npm run test-file \"./src/**/*.test.{js,ts}\"",
"test-ci": "npm run test-file-ci \"./src/**/*.test.{js,ts}\"",
"test": "npm run test-file \"./src/**/*.test.ts\"",
"test-ci": "npm run test-file-ci \"./src/**/*.test.ts\"",
"test-watch": "npm run test --watch --notify",
"test-cover": "nyc npm run test",
"coverage": "npm run test-cover && open-cli coverage/lcov-report/index.html",
Expand All @@ -254,15 +238,15 @@
"integration-file": "cross-env NODE_ENV=test npm-run-all integration-setup -r -p serve \"cypress:run-file {1}\" --",
"integration-interactive": "cross-env NODE_ENV=test npm-run-all integration-setup -r -p serve cypress:open",
"integration-test-ci": "cross-env NODE_ENV=test npm-run-all integration-setup -r -p serve cypress:run-integration",
"clean": "babel-node tools/run clean",
"copy": "babel-node tools/run copy",
"bundle": "babel-node tools/run bundle",
"build": "babel-node tools/run build",
"clean": "ts-node tools/run clean",
"copy": "ts-node tools/run copy",
"bundle": "ts-node tools/run bundle",
"build": "ts-node tools/run build",
"build-stats": "npm run build -- --release --analyse",
"deploy": "babel-node tools/run deploy",
"render": "babel-node tools/run render",
"serve": "babel-node tools/run runServer || true",
"start": "babel-node tools/run start",
"deploy": "ts-node tools/run deploy",
"render": "ts-node tools/run render",
"serve": "ts-node tools/run runServer || true",
"start": "ts-node tools/run start",
"prepare": "husky install"
},
"packageManager": "[email protected]"
Expand Down
16 changes: 11 additions & 5 deletions src/DOMUtils.js → src/DOMUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,21 @@
* LICENSE.txt file in the root directory of this source tree.
*/

export function updateTag(tagName, keyName, keyValue, attrName, attrValue) {
export function updateTag(
tagName: string,
keyName: string,
keyValue: string,
attrName: string,
attrValue: string
) {
const node = document.head.querySelector(
`${tagName}[${keyName}="${keyValue}"]`
);
if (node && node.getAttribute(attrName) === attrValue) return;

// Remove and create a new tag in order to make it work with bookmarks in Safari
if (node) {
node.parentNode.removeChild(node);
node.parentNode?.removeChild(node);
}
if (typeof attrValue === "string") {
const nextNode = document.createElement(tagName);
Expand All @@ -25,14 +31,14 @@ export function updateTag(tagName, keyName, keyValue, attrName, attrValue) {
}
}

export function updateMeta(name, content) {
export function updateMeta(name: string, content: string) {
updateTag("meta", "name", name, "content", content);
}

export function updateCustomMeta(property, content) {
export function updateCustomMeta(property: string, content: string) {
updateTag("meta", "property", property, "content", content);
}

export function updateLink(rel, href) {
export function updateLink(rel: string, href: string) {
updateTag("link", "rel", rel, "href", href);
}
2 changes: 1 addition & 1 deletion src/actions/decisions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { ThunkAction } from "@reduxjs/toolkit";
import { processResponse, credentials, jsonHeaders } from "../core/ApiClient";
import { Action, Decision, State } from "../interfaces";

export function invalidateDecisions() {
export function invalidateDecisions(): Action {
return { type: "INVALIDATE_DECISIONS" };
}

Expand Down
Loading

0 comments on commit 5d64e5d

Please sign in to comment.