Repository: obsidian-tasks-group/obsidian-tasks
Pull request #801 (2022-06-17 05:23:13)

refactor: Move Settings.ts and SettingsTab.ts to src/config/
## Description

This only moves `Settings.ts` and `SettingsTab.ts` from `src` to `src/config/`.

## Motivation and Context

This matches changes made by @sytone in their fork https://github.com/sytone/obsidian-tasks-x and will simplify reviewing of PRs based on this layout.

## How has this been tested?

By running the tests and confirming that a distribution can still be created

## Screenshots (if appropriate):

## Types of changes
<!--- What types of changes does your code introduce? Put an `x` in all the boxes that apply: -->
- [ ] Bug fix (non-breaking change which fixes an issue)
- [x] Refactor (non-breaking change which only improves the design or structure of existing code, and making no changes to its external behaviour)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)

## Checklist:
<!--- Go over all the following points, and put an `x` in all the boxes that apply. -->
<!--- If you're unsure about any of these, don't hesitate to ask. We're here to help! -->
- [ ] My code follows the code style of this project and passes `yarn run lint`.
- [ ] My change requires a change to the documentation.
- [ ] I have updated the documentation accordingly.
- [ ] My change has adequate Unit Test coverage.

By creating a Pull Request you agree to our [Code of Conduct](https://github.com/obsidian-tasks-group/obsidian-tasks/blob/main/CODE_OF_CONDUCT.md). For further guidance on contributing please see [contributing guide](https://github.com/obsidian-tasks-group/obsidian-tasks/blob/main/CONTRIBUTING.md)



Patch:
diff --git a/src/File.ts b/src/File.ts
index b55f5ad5..02fc00a0 100644
--- a/src/File.ts
+++ b/src/File.ts
@@ -1,6 +1,6 @@
 import { ListItemCache, MetadataCache, TFile, Vault } from 'obsidian';
 
-import { getSettings } from './Settings';
+import { getSettings } from './config/Settings';
 import type { Task } from './Task';
 
 let metadataCache: MetadataCache | undefined;
diff --git a/src/InlineRenderer.ts b/src/InlineRenderer.ts
index 701a1806..b84d2140 100644
--- a/src/InlineRenderer.ts
+++ b/src/InlineRenderer.ts
@@ -1,4 +1,4 @@
-import { getSettings } from 'Settings';
+import { getSettings } from 'config/Settings';
 
 import type { MarkdownPostProcessorContext, Plugin } from 'obsidian';
 import { Task } from './Task';
diff --git a/src/Query/Filter/DescriptionField.ts b/src/Query/Filter/DescriptionField.ts
index 68868096..fa9c5577 100644
--- a/src/Query/Filter/DescriptionField.ts
+++ b/src/Query/Filter/DescriptionField.ts
@@ -1,4 +1,4 @@
-import { getSettings } from '../../Settings';
+import { getSettings } from '../../config/Settings';
 import type { Task } from '../../Task';
 import { TextField } from './TextField';
 
diff --git a/src/Sort.ts b/src/Sort.ts
index 42cc7fcb..2d211079 100644
--- a/src/Sort.ts
+++ b/src/Sort.ts
@@ -2,7 +2,7 @@ import type moment from 'moment';
 import type { Task } from './Task';
 import type { Query, SortingProperty } from './Query';
 
-import { getSettings } from './Settings';
+import { getSettings } from './config/Settings';
 
 type Comparator = (a: Task, b: Task) => number;
 
diff --git a/src/Task.ts b/src/Task.ts
index 572368f4..fa364a68 100644
--- a/src/Task.ts
+++ b/src/Task.ts
@@ -3,7 +3,7 @@ import { Component, MarkdownRenderer } from 'obsidian';
 import { replaceTaskWithTasks } from './File';
 import { LayoutOptions } from './LayoutOptions';
 import { Recurrence } from './Recurrence';
-import { getSettings } from './Settings';
+import { getSettings } from './config/Settings';
 import { Urgency } from './Urgency';
 
 /**
diff --git a/src/Settings.ts b/src/config/Settings.ts
similarity index 100%
rename from src/Settings.ts
rename to src/config/Settings.ts
diff --git a/src/SettingsTab.ts b/src/config/SettingsTab.ts
similarity index 98%
rename from src/SettingsTab.ts
rename to src/config/SettingsTab.ts
index 79ee7593..e25f95d3 100644
--- a/src/SettingsTab.ts
+++ b/src/config/SettingsTab.ts
@@ -1,5 +1,5 @@
 import { PluginSettingTab, Setting } from 'obsidian';
-import type TasksPlugin from './main';
+import type TasksPlugin from '../main';
 import { getSettings, updateSettings } from './Settings';
 
 export class SettingsTab extends PluginSettingTab {
diff --git a/src/main.ts b/src/main.ts
index ab602633..300afee8 100644
--- a/src/main.ts
+++ b/src/main.ts
@@ -7,8 +7,8 @@ import { initializeFile } from './File';
 import { InlineRenderer } from './InlineRenderer';
 import { newLivePreviewExtension } from './LivePreviewExtension';
 import { QueryRenderer } from './QueryRenderer';
-import { getSettings, updateSettings } from './Settings';
-import { SettingsTab } from './SettingsTab';
+import { getSettings, updateSettings } from './config/Settings';
+import { SettingsTab } from './config/SettingsTab';
 
 export default class TasksPlugin extends Plugin {
     private cache: Cache | undefined;
diff --git a/src/ui/EditTask.svelte b/src/ui/EditTask.svelte
index 18e66968..5e9cb5ca 100644
--- a/src/ui/EditTask.svelte
+++ b/src/ui/EditTask.svelte
@@ -2,7 +2,7 @@
     import chrono from 'chrono-node';
     import { onMount } from 'svelte';
     import { Recurrence } from '../Recurrence';
-    import { getSettings } from '../Settings';
+    import { getSettings } from '../config/Settings';
     import { Priority, Status, Task } from '../Task';
     import { doAutocomplete } from '../DateAbbreviations';
 


Test patch:
diff --git a/tests/Query/Filter/DescriptionField.test.ts b/tests/Query/Filter/DescriptionField.test.ts
index 10d221fa..a2986895 100644
--- a/tests/Query/Filter/DescriptionField.test.ts
+++ b/tests/Query/Filter/DescriptionField.test.ts
@@ -1,5 +1,5 @@
 import { DescriptionField } from '../../../src/Query/Filter/DescriptionField';
-import { getSettings, updateSettings } from '../../../src/Settings';
+import { getSettings, updateSettings } from '../../../src/config/Settings';
 import { testTaskFilter } from '../../TestingTools/FilterTestHelpers';
 import { fromLine } from '../../TestHelpers';
 import type { FilterOrErrorMessage } from '../../../src/Query/Filter/Filter';
diff --git a/tests/Query/Filter/TagsField.test.ts b/tests/Query/Filter/TagsField.test.ts
index 5dc3a241..aa160c13 100644
--- a/tests/Query/Filter/TagsField.test.ts
+++ b/tests/Query/Filter/TagsField.test.ts
@@ -1,4 +1,4 @@
-import { getSettings, updateSettings } from '../../../src/Settings';
+import { getSettings, updateSettings } from '../../../src/config/Settings';
 import type { FilteringCase } from '../../TestingTools/FilterTestHelpers';
 import { shouldSupportFiltering } from '../../TestingTools/FilterTestHelpers';
 
diff --git a/tests/Sort.test.ts b/tests/Sort.test.ts
index f710b28f..725b3808 100644
--- a/tests/Sort.test.ts
+++ b/tests/Sort.test.ts
@@ -6,7 +6,7 @@ import moment from 'moment';
 window.moment = moment;
 
 import { Sort } from '../src/Sort';
-import { getSettings, updateSettings } from '../src/Settings';
+import { getSettings, updateSettings } from '../src/config/Settings';
 import { fromLine } from './TestHelpers';
 
 describe('Sort', () => {
diff --git a/tests/Task.test.ts b/tests/Task.test.ts
index bd508155..c98ff222 100644
--- a/tests/Task.test.ts
+++ b/tests/Task.test.ts
@@ -3,7 +3,7 @@
  */
 import moment from 'moment';
 import { Status, Task } from '../src/Task';
-import { getSettings, updateSettings } from '../src/Settings';
+import { getSettings, updateSettings } from '../src/config/Settings';
 
 jest.mock('obsidian');
 window.moment = moment;