Taitava / obsidian-shellcommands

Execute system commands via hotkeys or command palette in Obsidian (https://obsidian.md). Some automated events are also supported, and execution via URI links.
GNU General Public License v3.0
351 stars 11 forks source link

Internal: TypeScript compiler: Use strict null checks #70

Closed Taitava closed 1 year ago

Taitava commented 2 years ago

TypeScript compiler should be configured to be more strict about the nullability of data types. Null should only be allowed when explicitly defined that a value can be null.

https://www.typescriptlang.org/tsconfig#strictNullChecks

2022-11-28: I've now done the refactoring.

Still TODO:

Summary of changes

Main application areas that were touched

Making the plugin more type-safe introduced small changes to almost all parts of the plugin. Here's a condensed list of the changed parts. The changes should not be visible to users, but as all changes may cause new bugs, I feel it's good to document on a rough level, which parts were changed.

A complete list of classes/function that were modified

Subheadings are folder names.
! Added a TODO item.
!! Added a FIXME item. NEED TO CREATE ISSUES about all of these!

# root of src
 - Common.ts: getVaultAbsolutePath(), getEditor(), normalizePath2(), copyToClipboard()
 - main.ts: SC_Plugin !
 - Shell.ts: getUsersDefaultShell()
 - ShellCommandExecutor
 - TShellCommand !

# events
 - SC_EventList.ts: getSC_Events() ja getSC_Event()
 - SC_MenuEvent !!

# models
 - createNewModelInstanceButton()
## custom_variable
 - CustomVariableInstance
## output_wrapper
 - OutputWrapperSettingsModal
## prompt
 - PromptModal !
 - PromptSettingsModal
### prompt_fields
 - PromptField
 - PromptField_Text
 - PromptFieldModel

# output_channels
 - OutputChannel
 - OutputChannel_Modal !! !
 - OutputChannel_Notification
 - OutputChannel_OpenFiles

# preactions
 - Preaction
 - Preaction_Prompt

# settings
 - DeleteModal
 - ExtraOptionsModal
 - SC_MainSettingsTab
## setting_elements
 - Autocomplete.ts: createAutocomplete()
 - CreateShellCommandFieldCore.ts: getShellCommandPreview()
 - PathEnvironmentVariableFunctions.ts: createPATHAugmentationFields()

# variables
 - EditorVariable
 - parseVariables.ts: parseVariables()
 - ParsingProcess
 - Variable
 - Variable_CaretParagraph
 - Variable_CaretPosition
 - Variable_Environment
 - Variable_Selection
 - Variable_YAMLValue
 - VariableHelpers.ts: getFileTags(), getFileYAMLValue()
## event_variables
 - Variable_EventYAMLValue
Taitava commented 1 year ago

Released.