RCE: Enable noImplicitAny for typescript

- Matches recent changes to canvas core tsconfig
- Enable noImplicitAny in packages/canvas-rce/package.json
- Remove canvas-rce pre-commit hook
- Add @ts-nocheck to files that have errors due to noImplicitAny

test plan:
  - existing tests pass

flag=none

Change-Id: I6540a42ba5089deaab851f113e5f665dcff2851e
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/317214
Reviewed-by: Aaron Shafovaloff <ashafovaloff@instructure.com>
QA-Review: Aaron Shafovaloff <ashafovaloff@instructure.com>
Product-Review: Yona Appletree <yona.appletree@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
This commit is contained in:
Yona Appletree 2023-04-27 16:32:04 -07:00
parent ce864bb5ff
commit ac34b669e1
33 changed files with 32 additions and 45 deletions

View File

@ -25,21 +25,6 @@ if [ $(pwd -P) = $CANVAS ]; then
echo "You should run yarn locally or check to make sure docker is running."
fi
# per-package pre-commit hooks
git diff --cached --name-only | grep -E -o '^(packages/[^/]+)' | sort | uniq | while read -r PACKAGE; do
# check if CHANGED_PACKAGES/pre-commit-hook.sh exists and run it
if [ -f "$PACKAGE/pre-commit-hook.sh" ]; then
echo "Running pre-commit hook for $PACKAGE"
(cd "$PACKAGE" && "./pre-commit-hook.sh")
if [ $? -ne 0 ]; then
echo "Pre-commit hook for $PACKAGE failed, aborting commit"
exit 1
fi
fi
done || exit 1
if git diff --cached --name-only | grep -q Gemfile.lock; then
echo "Checking lockfiles..."
script/sync_lockfiles.rb

View File

@ -38,7 +38,7 @@
// Prefer @typescript-eslint/no-empty-function over no-empty-function
"no-empty-function": "off",
"@typescript-eslint/no-empty-function": "error"
"@typescript-eslint/no-empty-function": "warn"
}
}
]

View File

@ -1,26 +0,0 @@
#!/usr/bin/env bash
#
# This file is executed automatically by /hooks/pre-commit if package files are changed
#
cd "$(dirname "$0")" || exit 1
PACKAGE_DIR=$(git rev-parse --show-prefix)
# Check typescript
if git diff --cached --name-only . | grep -qE '\.(ts|tsx)$'; then
if [ -f node_modules/.bin/tsc ]; then
echo "Checking $PACKAGE_DIR TypeScript..."
node_modules/.bin/tsc
else
echo 'Trying to run tsc inside Docker. If you want things quicker yarn install locally.'
docker-compose run --rm web node_modules/.bin/tsc
fi
if [ $? -ne 0 ]; then
echo "TypeScript checking failed in $PACKAGE_DIR, aborting commit"
exit 1
fi
fi
# Note that eslint is handled by the root hook, so we don't need to do that here

View File

@ -1,3 +1,4 @@
// @ts-nocheck
/*
* Copyright (C) 2022 - present Instructure, Inc.
*

View File

@ -1,3 +1,4 @@
// @ts-nocheck
/*
* Copyright (C) 2019 - present Instructure, Inc.
*

View File

@ -1,3 +1,4 @@
// @ts-nocheck
/*
* Copyright (C) 2019 - present Instructure, Inc.
*

View File

@ -1,3 +1,4 @@
// @ts-nocheck
/*
* Copyright (C) 2018 - present Instructure, Inc.
*

View File

@ -1,3 +1,4 @@
// @ts-nocheck
/*
* Copyright (C) 2018 - present Instructure, Inc.
*

View File

@ -1,3 +1,4 @@
// @ts-nocheck
/*
* Copyright (C) 2022 - present Instructure, Inc.
*

View File

@ -1,3 +1,4 @@
// @ts-nocheck
/*
* Copyright (C) 2021 - present Instructure, Inc.
*

View File

@ -1,3 +1,4 @@
// @ts-nocheck
/*
* Copyright (C) 2022 - present Instructure, Inc.
*

View File

@ -1,3 +1,4 @@
// @ts-nocheck
/*
* Copyright (C) 2022 - present Instructure, Inc.
*

View File

@ -1,3 +1,4 @@
// @ts-nocheck
/*
* Copyright (C) 2022 - present Instructure, Inc.
*

View File

@ -1,3 +1,4 @@
// @ts-nocheck
/*
* Copyright (C) 2022 - present Instructure, Inc.
*

View File

@ -1,3 +1,4 @@
// @ts-nocheck
/*
* Copyright (C) 2018 - present Instructure, Inc.
*

View File

@ -1,3 +1,4 @@
// @ts-nocheck
/*
* Copyright (C) 2019 - present Instructure, Inc.
*

View File

@ -1,3 +1,4 @@
// @ts-nocheck
/*
* Copyright (C) 2022 - present Instructure, Inc.
*

View File

@ -1,3 +1,4 @@
// @ts-nocheck
/*
* Copyright (C) 2023 - present Instructure, Inc.
*

View File

@ -1,3 +1,4 @@
// @ts-nocheck
/*
* Copyright (C) 2023 - present Instructure, Inc.
*

View File

@ -1,3 +1,4 @@
// @ts-nocheck
/*
* Copyright (C) 2021 - present Instructure, Inc.
*

View File

@ -1,3 +1,4 @@
// @ts-nocheck
/*
* Copyright (C) 2019 - present Instructure, Inc.
*

View File

@ -1,3 +1,4 @@
// @ts-nocheck
/*
* Copyright (C) 2019 - present Instructure, Inc.
*

View File

@ -1,3 +1,4 @@
// @ts-nocheck
/*
* Copyright (C) 2019 - present Instructure, Inc.
*

View File

@ -1,3 +1,4 @@
// @ts-nocheck
/*
* Copyright (C) 2011 - present Instructure, Inc.
*

View File

@ -1,3 +1,4 @@
// @ts-nocheck
/*
* Copyright (C) 2018 - present Instructure, Inc.
*

View File

@ -1,3 +1,4 @@
// @ts-nocheck
/*
* Copyright (C) 2018 - present Instructure, Inc.
*

View File

@ -1,3 +1,4 @@
// @ts-nocheck
/*
* Copyright (C) 2018 - present Instructure, Inc.
*

View File

@ -1,3 +1,4 @@
// @ts-nocheck
/*
* Copyright (C) 2022 - present Instructure, Inc.
*

View File

@ -1,3 +1,4 @@
// @ts-nocheck
/*
* Copyright (C) 2019 - present Instructure, Inc.
*

View File

@ -1,3 +1,4 @@
// @ts-nocheck
/*
* Copyright (C) 2023 - present Instructure, Inc.
*

View File

@ -1,3 +1,4 @@
// @ts-nocheck
/*
* Copyright (C) 2023 - present Instructure, Inc.
*
@ -165,5 +166,4 @@ export type DeepMocked<T> = {
: T[P] extends object | null | undefined
? DeepMocked<T[P]>
: T[P]
} &
T & {mockClear(): void}
} & T & {mockClear(): void}

View File

@ -1,3 +1,4 @@
// @ts-nocheck
/*
* Copyright (C) 2023 - present Instructure, Inc.
*

View File

@ -13,7 +13,7 @@
"skipLibCheck": true, // don't do type-checking on dependencies' internal types for improved performance
"strict": true, // enables a bunch of strict mode family options. See https://www.typescriptlang.org/tsconfig#strict
"target": "ES2020", // support the most modern JS features (let babel handle transpilation)
"noImplicitAny": false, // temporarily allows un-typed variables (and imports) to be automatically defined as "any"
"noImplicitAny": true,
"experimentalDecorators": true,
"outDir": "es"
},