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

Typescript 4.5 #1350

Closed
wants to merge 20 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
9be1598
TypeScript 4.5 and Prettier 2.5 (for TS 4.5 syntax support
Stephen-ONeil Dec 22, 2021
a2df49c
Drop deprectaed prettier rule jsxBracketSameLine
Stephen-ONeil Dec 22, 2021
996f56e
Update eslint from 7 to 8, corresponding versions of @typescript-esli…
Stephen-ONeil Dec 22, 2021
81c6f1f
Rename root package.json prettier scripts, add eslint scripts
Stephen-ONeil Dec 22, 2021
355946b
Add a prettier write call post eslint:fix, closes #1213
Stephen-ONeil Dec 22, 2021
ff6663f
Change prettier:write log level to warn, default logging is overly ve…
Stephen-ONeil Dec 22, 2021
1f96213
Use consistent, desired, configuration for no-unused-vars in both js …
Stephen-ONeil Dec 22, 2021
db31144
Centralize eslint ignore rules at top level, like we have with the pr…
Stephen-ONeil Dec 22, 2021
3d285c1
Misc linting
Stephen-ONeil Dec 22, 2021
4113640
Sort out linting in root scripts, fix some lint errors there and in f…
Stephen-ONeil Dec 22, 2021
ec791eb
Lint instance of no-use-before-define in server code
Stephen-ONeil Dec 22, 2021
c01f377
Add stand alone repo-wide lint job to CI
Stephen-ONeil Dec 22, 2021
83c5532
Configure repo wide eslint command to cache
Stephen-ONeil Dec 22, 2021
bacfb4c
Make use of eslint caches in CI lint job
Stephen-ONeil Dec 22, 2021
aa77483
Lint no-unused-vars in form_backend and server
Stephen-ONeil Dec 22, 2021
ec4d093
Extract CI install steps to fragments, to make sure cache keys are co…
Stephen-ONeil Dec 22, 2021
6ae8ed4
Ah, CircleCI has a "commands" syntax for reusable blocks of steps, th…
Stephen-ONeil Dec 22, 2021
02d3a2c
Set max warnings to 0 for repo wide eslint scan, mainly so CI gets th…
Stephen-ONeil Dec 22, 2021
2bc831a
Fix rest arg error introduced by removing an unused var in the server…
Stephen-ONeil Dec 22, 2021
640bae6
Set ignoreRestSiblings: true in no-unused-vars lint rule, a bit of a …
Stephen-ONeil Dec 22, 2021
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
142 changes: 87 additions & 55 deletions .circleci/config.yml
@@ -1,44 +1,108 @@
version: 2.1

dockerhub_auth: &dockerhub_auth
auth:
username: $DOCKERHUB_USERNAME
password: $DOCKERHUB_PASSWORD

# yaml fragment for deploy filters
deploy_filter: &deploy_filter
filters:
branches:
ignore:
- /__.*/

version: 2.1

jobs:
test_form_backend:
docker:
- image: eaadtbs/ib-ci-build:3.0
<<: *dockerhub_auth
working_directory: "~/InfoBase"
commands:
top_level_install:
steps:
- checkout:
path: "~/InfoBase"
- restore_cache:
keys:
- form-backend-dependencies-{{ checksum "form_backend/package-lock.json" }}-v2
- top-level-dependencies-{{ checksum "package-lock.json" }}-v2
- run:
command: |
[ -e "form_backend/node_modules" ] || (cd form_backend && npm ci)
[ -e "node_modules" ] || npm ci
- save_cache:
key: top-level-dependencies-{{ checksum "package-lock.json" }}-v2
paths:
- node_modules
form_backend_install:
steps:
- restore_cache:
keys:
- form-backend-dependencies-{{ checksum "form_backend/package-lock.json" }}-v2
- run:
command: |
[ -e "node_modules" ] || npm ci
[ -e "form_backend/node_modules" ] || (cd form_backend && npm ci)
- save_cache:
key: form-backend-dependencies-{{ checksum "form_backend/package-lock.json" }}-v2
paths:
- form_backend/node_modules
server_install:
steps:
- restore_cache:
keys:
- server-dependencies-{{ checksum "server/package-lock.json" }}-v2
- run:
command: |
[ -e "server/node_modules" ] || (cd server && npm ci)
- save_cache:
key: top-level-dependencies-{{ checksum "package-lock.json" }}-v2
key: server-dependencies-{{ checksum "server/package-lock.json" }}-v2
paths:
- node_modules
- server/node_modules
client_install:
steps:
# need to bust the client package cache on patch changes in addition to package-lock changes
- run: cksum ./client/patches/* > client-patch-checksums
- restore_cache:
keys:
- client-dependencies-{{ checksum "client/package-lock.json" }}-{{ checksum "client-patch-checksums" }}-v2
- run:
command: |
[ -e "client/node_modules" ] || (cd client && npm ci)
- save_cache:
key: client-dependencies-{{ checksum "client/package-lock.json" }}-{{ checksum "client-patch-checksums" }}-v2
paths:
- client/node_modules
- client/.cache/Cypress # path set by CYPRESS_CACHE_FOLDER env var

jobs:
lint:
docker:
- image: eaadtbs/ib-ci-build:3.0
<<: *dockerhub_auth
working_directory: "~/InfoBase"
steps:
- checkout:
path: "~/InfoBase"

- top_level_install
- form_backend_install
- server_install
- client_install

- restore_cache:
keys:
- repo-wide-lint-cache-{{ .Branch }}
- repo-wide-lint-cache-master

- run:
command: npm run eslint

- save_cache:
key: repo-wide-lint-cache-{{ .Branch }}
paths:
- .eslintcache

test_form_backend:
docker:
- image: eaadtbs/ib-ci-build:3.0
<<: *dockerhub_auth
working_directory: "~/InfoBase"
steps:
- checkout:
path: "~/InfoBase"

- top_level_install
- form_backend_install

- restore_cache:
keys:
Expand Down Expand Up @@ -90,49 +154,15 @@ jobs:
- image: eaadtbs/ib-ci-build:3.0
<<: *dockerhub_auth
working_directory: "~/InfoBase"
environment:
CYPRESS_CACHE_FOLDER: "~/InfoBase/client/.cache/Cypress"
resource_class: medium
steps:
- checkout:
path: "~/InfoBase"
- run: ./scripts/ci_scripts/create_envs.sh

- restore_cache:
keys:
- top-level-dependencies-{{ checksum "package-lock.json" }}-v4
- run:
command: |
[ -e "node_modules" ] || npm ci
- save_cache:
key: top-level-dependencies-{{ checksum "package-lock.json" }}-v4
paths:
- node_modules

# need to bust the client package cache on patch changes in addition to package-lock changes
- run: cksum ./client/patches/* > client-patch-checksums
- restore_cache:
keys:
- client-dependencies-{{ checksum "client/package-lock.json" }}-{{ checksum "client-patch-checksums" }}-v2
- run:
command: |
[ -e "client/node_modules" ] || (cd client && npm ci)
- save_cache:
key: client-dependencies-{{ checksum "client/package-lock.json" }}-{{ checksum "client-patch-checksums" }}-v2
paths:
- client/node_modules
- client/.cache/Cypress

- restore_cache:
keys:
- server-dependencies-{{ checksum "server/package-lock.json" }}-v2
- run:
command: |
[ -e "server/node_modules" ] || (cd server && npm ci)
- save_cache:
key: server-dependencies-{{ checksum "server/package-lock.json" }}-v2
paths:
- server/node_modules
- top_level_install
- client_install
- server_install

# transpiling the server slightly out of place for this job, not needed till the server deploy step, but
# the deploy job image isn't guaranteed to have the necessary environment for this
Expand Down Expand Up @@ -272,8 +302,6 @@ jobs:
- image: eaadtbs/ib-ci-cypress:4.0
<<: *dockerhub_auth
working_directory: "~/InfoBase"
environment:
CYPRESS_CACHE_FOLDER: "~/InfoBase/client/.cache/Cypress"
parameters:
batch-count:
type: integer
Expand Down Expand Up @@ -380,6 +408,10 @@ jobs:
- run: if [[ $CIRCLE_BRANCH = master ]]; then ./scripts/ci_scripts/store_bundle_stats.sh; fi

workflows:
lint:
jobs:
- lint

test_form_backend:
jobs:
- test_form_backend
Expand Down
7 changes: 7 additions & 0 deletions .eslintignore
@@ -0,0 +1,7 @@
*/.coverage
*/.cache
*/transpiled_build
client/build
client/build_prod
client/src/**/*.scss.d.ts
client/scripts/typescript_progress/output
5 changes: 4 additions & 1 deletion .eslintrc.json
Expand Up @@ -8,7 +8,10 @@
"plugin:import/errors"
],
"rules": {
"no-unused-vars": ["warn", { "args": "none" }],
"no-unused-vars": [
"warn",
{ "ignoreRestSiblings": true, "argsIgnorePattern": "^_.+" }
],
"no-use-before-define": ["error", { "functions": true, "classes": true }],
"no-throw-literal": "error",
"lodash/no-double-unwrap": ["error"],
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Expand Up @@ -20,4 +20,5 @@ npm-debug*
node_modules/
.local_mongo
.coverage
.cache
.cache
.eslintcache
5 changes: 2 additions & 3 deletions .husky/pre-push
Expand Up @@ -22,6 +22,5 @@ if [[ ($local_branch_name =~ ^__ || $local_branch_name =~ ^archived__ ) && $remo
exit 1
fi


# run prettier check
npm run prettier_check .
# Prevent pushing if prettier is unhappy
npm run prettier
3 changes: 0 additions & 3 deletions client/.eslintignore

This file was deleted.

7 changes: 5 additions & 2 deletions client/.eslintrc.json
Expand Up @@ -47,8 +47,11 @@
],
"rules": {
"no-prototype-builtins": "off", //common TS pattern
"@typescript-eslint/no-unused-vars": "off", // Lot of false positives on this rule. Better to use the exprimental
"@typescript-eslint/no-unused-vars-experimental": "warn",
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": [
"warn",
{ "ignoreRestSiblings": true, "argsIgnorePattern": "^_.+" }
],
"@typescript-eslint/no-redeclare": ["error"],
"@typescript-eslint/explicit-module-boundary-types": "off", // TODO might want to turn this on later, but it will take a while to fix all the warnings
"@typescript-eslint/ban-types": [
Expand Down