-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
Add a new config for strict typescript checks #10433
Changes from all commits
dd47b5e
4ac991d
ab5f446
644e9b5
9cb8c61
6337cc6
23bd20e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -67,6 +67,8 @@ | |
TRAVIS_CI_PROTRACTOR_CHECK_CMDS = [ | ||
PYTHON_CMD, '-m', 'scripts.check_e2e_tests_are_captured_in_ci'] | ||
TYPESCRIPT_CHECKS_CMDS = [PYTHON_CMD, '-m', 'scripts.typescript_checks'] | ||
STRICT_TYPESCRIPT_CHECKS_CMDS = [ | ||
PYTHON_CMD, '-m', 'scripts.typescript_checks', '--strict_checks'] | ||
GIT_IS_DIRTY_CMD = 'git status --porcelain --untracked-files=no' | ||
|
||
|
||
|
@@ -453,6 +455,16 @@ def main(args=None): | |
'Push aborted due to failing typescript checks.') | ||
sys.exit(1) | ||
|
||
strict_typescript_checks_status = 0 | ||
if does_diff_include_ts_files(files_to_lint): | ||
strict_typescript_checks_status = run_script_and_get_returncode( | ||
STRICT_TYPESCRIPT_CHECKS_CMDS) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we need to run the typescript checks twice? If yes, will it be possible to run the "normal/simple" checks as well using the --strict_mode? Also, if we are running the script twice are we compiling files twice? One more: How much time will it add for pre_push checks? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually the thing is that we want to make the typescript checks more strict so we are enabling the So, only some files are compiled using the strict config and we plan to cover the complete codebase gradually. Also, I think it would be better to run only the strict checks when The time added to the pre_push_hooks is about 3 seconds. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see, so in the future, we will only have strict checks. Thanks for the info! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yup, correct! |
||
if strict_typescript_checks_status != 0: | ||
python_utils.PRINT( | ||
'Push aborted due to failing typescript checks in ' | ||
'strict mode.') | ||
sys.exit(1) | ||
|
||
frontend_status = 0 | ||
travis_ci_check_status = 0 | ||
if does_diff_include_js_or_ts_files(files_to_lint): | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
{ | ||
"compilerOptions": { | ||
"allowJs": true, | ||
"downlevelIteration": true, | ||
"lib": ["es2017", "dom", "webworker"], | ||
"outDir": "local_compiled_js_for_test", | ||
"rootDir": ".", | ||
"skipLibCheck": true, | ||
"target": "es5", | ||
"sourceMap": true, | ||
"strict": true, | ||
"typeRoots": ["./node_modules/@types"], | ||
"experimentalDecorators": true, | ||
"emitDecoratorMetadata": true, | ||
"allowSyntheticDefaultImports": true, | ||
"esModuleInterop": true, | ||
"baseUrl": ".", | ||
"paths": { | ||
"app.constants": ["core/templates/app.constants"], | ||
"app-type.constants": ["core/templates/app-type.constants"], | ||
"components/*": ["core/templates/components/*"], | ||
"domain/*": ["core/templates/domain/*"], | ||
"expressions/*": ["core/templates/expressions/*"], | ||
"pages/*": ["core/templates/pages/*"], | ||
"services/*": ["core/templates/services/*"], | ||
"classifiers/*": ["extensions/classifiers/*"], | ||
"interactions/*": ["extensions/interactions/*"], | ||
"filters/*": ["core/templates/filters/*"], | ||
"static/*": ["third_party/static/*"], | ||
"tests/*": ["core/templates/tests/*"] | ||
} | ||
}, | ||
"files": [ | ||
"core/templates/pages/admin-page/services/admin-router.service.ts", | ||
"core/templates/pages/admin-page/services/admin-router.service.spec.ts" | ||
], | ||
"include": ["typings/*.ts"] | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My understanding is that we want the typescript checks to pass before running e2e tests, that's why we have these in CircleCI. Is strict check tests required to pass for the e2e tests to run? Or is it specific to typescript checks itself?
If its the latter, can we move it to Github Actions? @nithusha21 FYI
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know, actually do we need both typescript checks and the strict typescript checks? What's the difference? Would just the strict checks suffice?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually the thing is that we want to make the typescript checks more strict so we are enabling the
strict
flag in tsconfig. But the strict checks can't be enabled in the complete codebase due to a lot of ts errors. You can refer the discussion at #10327So, only some files are compiled using the strict config and we plan to cover the complete codebase gradually.
I think we can enable the strict checks in circle ci given that they take a less amount of time (currently only 3s) and the checks are also present in pre_push_hoooks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah okay, sounds good. Thanks for the explanation!