Repository: obsidian-tasks-group/obsidian-tasks
Pull request #1118 (2022-09-06 09:07:01)

refactor: Make tasks src directory structure match tasks-x
<!--- Provide a general summary of your changes in the Title above -->

# Description

- refactor: Move `src/Query.ts` to `src/Query/Query.ts`
- refactor: Move `src/Sort.ts` to `src/Query/Sort.ts`
- refactor: Rename `src/config/` to `src/Config`

## Motivation and Context

See #1052 for motivation

## How has this been tested?

- `yarn run lint`
- and running all the tests

## Screenshots (if appropriate)

## Types of changes

<!--- What types of changes does your code introduce? Put an `x` in all the boxes that apply: -->


Internal changes:

- [x] **Refactor** (prefix: `refactor` - non-breaking change which only improves the design or structure of existing code, and making no changes to its external behaviour)

## 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! -->

- [x] My code follows the code style of this project and passes `yarn run lint`.

## Terms

<!--
By submitting this pull request, you must agree to follow our
[contributing guide](https://github.com/obsidian-tasks-group/obsidian-tasks/blob/main/CONTRIBUTING.md) and
[Code of Conduct](https://github.com/obsidian-tasks-group/obsidian-tasks/blob/main/CODE_OF_CONDUCT.md).
Put an x in the boxes to confirm you agree.
-->

- [x] My contribution follow this project's [contributing guide](https://github.com/obsidian-tasks-group/obsidian-tasks/blob/main/CONTRIBUTING.md)
- [x] I agree to follow this project's [Code of Conduct](https://github.com/obsidian-tasks-group/obsidian-tasks/blob/main/CODE_OF_CONDUCT.md)



Patch:
diff --git a/src/config/Feature.ts b/src/Config/Feature.ts
similarity index 100%
rename from src/config/Feature.ts
rename to src/Config/Feature.ts
diff --git a/src/config/Settings.ts b/src/Config/Settings.ts
similarity index 100%
rename from src/config/Settings.ts
rename to src/Config/Settings.ts
diff --git a/src/config/SettingsTab.ts b/src/Config/SettingsTab.ts
similarity index 100%
rename from src/config/SettingsTab.ts
rename to src/Config/SettingsTab.ts
diff --git a/src/config/featureConfiguration.json b/src/Config/featureConfiguration.json
similarity index 100%
rename from src/config/featureConfiguration.json
rename to src/Config/featureConfiguration.json
diff --git a/src/File.ts b/src/File.ts
index b7a8ada9..cc27eb2c 100644
--- a/src/File.ts
+++ b/src/File.ts
@@ -1,7 +1,7 @@
 import { MetadataCache, TFile, Vault } from 'obsidian';
 import type { ListItemCache } from 'obsidian';
 
-import { getSettings } from './config/Settings';
+import { getSettings } from './Config/Settings';
 import type { Task } from './Task';
 
 let metadataCache: MetadataCache | undefined;
diff --git a/src/IQuery.ts b/src/IQuery.ts
index 35e9975f..24dc134a 100644
--- a/src/IQuery.ts
+++ b/src/IQuery.ts
@@ -1,7 +1,7 @@
 import type { LayoutOptions } from './LayoutOptions';
 import type { Task } from './Task';
 import type { TaskGroups } from './Query/TaskGroups';
-import type { Grouping } from './Query';
+import type { Grouping } from './Query/Query';
 
 /**
  * Standard interface for the query engine used by Tasks, multiple
diff --git a/src/InlineRenderer.ts b/src/InlineRenderer.ts
index b84d2140..9ab8c2da 100644
--- a/src/InlineRenderer.ts
+++ b/src/InlineRenderer.ts
@@ -1,4 +1,4 @@
-import { getSettings } from 'config/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 cf913fef..167c9a32 100644
--- a/src/Query/Filter/DescriptionField.ts
+++ b/src/Query/Filter/DescriptionField.ts
@@ -1,4 +1,4 @@
-import { getSettings } from '../../config/Settings';
+import { getSettings } from '../../Config/Settings';
 import type { Task } from '../../Task';
 import { TextField } from './TextField';
 
diff --git a/src/Query/Filter/HappensDateField.ts b/src/Query/Filter/HappensDateField.ts
index 75c1801f..4040d61a 100644
--- a/src/Query/Filter/HappensDateField.ts
+++ b/src/Query/Filter/HappensDateField.ts
@@ -1,7 +1,7 @@
 import type { Moment } from 'moment';
 import type { Task } from '../../Task';
 import { DateParser } from '../DateParser';
-import { Sort } from '../../Sort';
+import { Sort } from '../Sort';
 import { Field } from './Field';
 import { FilterOrErrorMessage } from './Filter';
 
diff --git a/src/Query/Group.ts b/src/Query/Group.ts
index ea1f1b34..711c6154 100644
--- a/src/Query/Group.ts
+++ b/src/Query/Group.ts
@@ -1,6 +1,6 @@
-import type { Grouping, GroupingProperty } from '../Query';
 import type { Task } from '../Task';
 import { Priority } from '../Task';
+import type { Grouping, GroupingProperty } from './Query';
 import { TaskGroups } from './TaskGroups';
 import { HappensDateField } from './Filter/HappensDateField';
 
diff --git a/src/Query/IntermediateTaskGroups.ts b/src/Query/IntermediateTaskGroups.ts
index def73799..9ad26f65 100644
--- a/src/Query/IntermediateTaskGroups.ts
+++ b/src/Query/IntermediateTaskGroups.ts
@@ -1,5 +1,5 @@
-import type { Grouping } from '../Query';
 import type { Task } from '../Task';
+import type { Grouping } from './Query';
 import { Group } from './Group';
 import { GroupingTreeNode } from './GroupingTreeNode';
 
diff --git a/src/Query.ts b/src/Query/Query.ts
similarity index 96%
rename from src/Query.ts
rename to src/Query/Query.ts
index e40d3cdb..68449a20 100644
--- a/src/Query.ts
+++ b/src/Query/Query.ts
@@ -1,11 +1,10 @@
-import { Group } from './Query/Group';
-import { parseFilter } from './Query/FilterParser';
-import type { TaskGroups } from './Query/TaskGroups';
-
-import { LayoutOptions } from './LayoutOptions';
+import { LayoutOptions } from '../LayoutOptions';
+import type { Task } from '../Task';
+import type { IQuery } from '../IQuery';
 import { Sort } from './Sort';
-import type { Task } from './Task';
-import type { IQuery } from './IQuery';
+import type { TaskGroups } from './TaskGroups';
+import { parseFilter } from './FilterParser';
+import { Group } from './Group';
 
 export type SortingProperty =
     | 'urgency'
diff --git a/src/Sort.ts b/src/Query/Sort.ts
similarity index 98%
rename from src/Sort.ts
rename to src/Query/Sort.ts
index 58cf6b3c..a0b81cc4 100644
--- a/src/Sort.ts
+++ b/src/Query/Sort.ts
@@ -1,9 +1,8 @@
 import type moment from 'moment';
-import type { Task } from './Task';
+import type { Task } from '../Task';
+import { getSettings } from '../Config/Settings';
 import type { Query, SortingProperty } from './Query';
 
-import { getSettings } from './config/Settings';
-
 type Comparator = (a: Task, b: Task) => number;
 
 export class Sort {
diff --git a/src/Query/TaskGroups.ts b/src/Query/TaskGroups.ts
index 8cdafbf6..d2203bdd 100644
--- a/src/Query/TaskGroups.ts
+++ b/src/Query/TaskGroups.ts
@@ -1,5 +1,5 @@
-import type { Grouping } from '../Query';
 import type { Task } from '../Task';
+import type { Grouping } from './Query';
 import { GroupHeadings } from './GroupHeadings';
 import { IntermediateTaskGroups } from './IntermediateTaskGroups';
 import { TaskGroup } from './TaskGroup';
diff --git a/src/QueryRenderer.ts b/src/QueryRenderer.ts
index 1da1614f..3ad7fbf2 100644
--- a/src/QueryRenderer.ts
+++ b/src/QueryRenderer.ts
@@ -10,7 +10,7 @@ import type { EventRef, MarkdownPostProcessorContext } from 'obsidian';
 import type { IQuery } from './IQuery';
 import { State } from './Cache';
 import { replaceTaskWithTasks } from './File';
-import { Query } from './Query';
+import { Query } from './Query/Query';
 import type { GroupHeading } from './Query/GroupHeading';
 import { TaskModal } from './TaskModal';
 import type { Events } from './Events';
diff --git a/src/Recurrence.ts b/src/Recurrence.ts
index 34dc255d..fef055e4 100644
--- a/src/Recurrence.ts
+++ b/src/Recurrence.ts
@@ -1,6 +1,6 @@
 import type { Moment } from 'moment';
 import { RRule } from 'rrule';
-import { Sort } from './Sort';
+import { Sort } from './Query/Sort';
 
 export class Recurrence {
     private readonly rrule: RRule;
diff --git a/src/Suggestor/EditorSuggestorPopup.ts b/src/Suggestor/EditorSuggestorPopup.ts
index 19d4a697..5c9a1371 100644
--- a/src/Suggestor/EditorSuggestorPopup.ts
+++ b/src/Suggestor/EditorSuggestorPopup.ts
@@ -5,7 +5,7 @@ import type {
     EditorSuggestTriggerInfo,
 } from 'obsidian';
 
-import type { Settings } from '../config/Settings';
+import type { Settings } from '../Config/Settings';
 import * as task from '../Task';
 import { buildSuggestions } from './Suggestor';
 import type { SuggestInfo } from './Suggestor';
diff --git a/src/Suggestor/Suggestor.ts b/src/Suggestor/Suggestor.ts
index 2e87239d..9286f94d 100644
--- a/src/Suggestor/Suggestor.ts
+++ b/src/Suggestor/Suggestor.ts
@@ -1,4 +1,4 @@
-import type { Settings } from '../config/Settings';
+import type { Settings } from '../Config/Settings';
 import { DateParser } from '../Query/DateParser';
 import { doAutocomplete } from '../DateAbbreviations';
 import { Recurrence } from '../Recurrence';
diff --git a/src/Task.ts b/src/Task.ts
index f00ae1e2..5bb25b6c 100644
--- a/src/Task.ts
+++ b/src/Task.ts
@@ -3,9 +3,9 @@ import { Component, MarkdownRenderer } from 'obsidian';
 import { replaceTaskWithTasks } from './File';
 import { LayoutOptions } from './LayoutOptions';
 import { Recurrence } from './Recurrence';
-import { getSettings } from './config/Settings';
+import { getSettings } from './Config/Settings';
 import { Urgency } from './Urgency';
-import { Sort } from './Sort';
+import { Sort } from './Query/Sort';
 
 /**
  * Collection of status types supported by the plugin.
diff --git a/src/main.ts b/src/main.ts
index e0fe1340..c9dfa781 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 './config/Settings';
-import { SettingsTab } from './config/SettingsTab';
+import { getSettings, updateSettings } from './Config/Settings';
+import { SettingsTab } from './Config/SettingsTab';
 import { EditorSuggestor } from './Suggestor/EditorSuggestorPopup';
 
 export default class TasksPlugin extends Plugin {
diff --git a/src/ui/EditTask.svelte b/src/ui/EditTask.svelte
index 2c26f4d7..de41f5ac 100644
--- a/src/ui/EditTask.svelte
+++ b/src/ui/EditTask.svelte
@@ -2,7 +2,7 @@
     import * as chrono from 'chrono-node';
     import { onMount } from 'svelte';
     import { Recurrence } from '../Recurrence';
-    import { getSettings } from '../config/Settings';
+    import { getSettings } from '../Config/Settings';
     import { Priority, Status, Task } from '../Task';
     import {
         prioritySymbols,


Test patch:
diff --git a/tests/EditorSuggest.test.ts b/tests/EditorSuggest.test.ts
index 1a7fe2bd..b6d63155 100644
--- a/tests/EditorSuggest.test.ts
+++ b/tests/EditorSuggest.test.ts
@@ -2,7 +2,7 @@
  * @jest-environment jsdom
  */
 import moment from 'moment';
-import { getSettings } from '../src/config/Settings';
+import { getSettings } from '../src/Config/Settings';
 import { buildSuggestions } from '../src/Suggestor/Suggestor';
 import type { SuggestInfo } from '../src/Suggestor/Suggestor';
 
diff --git a/tests/Group.test.ts b/tests/Group.test.ts
index 194762bd..90d5c044 100644
--- a/tests/Group.test.ts
+++ b/tests/Group.test.ts
@@ -3,7 +3,7 @@
  */
 import moment from 'moment';
 import { Group } from '../src/Query/Group';
-import type { Grouping, GroupingProperty } from '../src/Query';
+import type { Grouping, GroupingProperty } from '../src/Query/Query';
 import type { Task } from '../src/Task';
 import { fromLine } from './TestHelpers';
 
diff --git a/tests/Query.test.ts b/tests/Query.test.ts
index 951d2e43..e7a9004a 100644
--- a/tests/Query.test.ts
+++ b/tests/Query.test.ts
@@ -2,7 +2,7 @@
  * @jest-environment jsdom
  */
 import moment from 'moment';
-import { Query } from '../src/Query';
+import { Query } from '../src/Query/Query';
 import { Priority, Status, Task } from '../src/Task';
 import { createTasksFromMarkdown, fromLine } from './TestHelpers';
 import { shouldSupportFiltering } from './TestingTools/FilterTestHelpers';
diff --git a/tests/Query/Filter/DescriptionField.test.ts b/tests/Query/Filter/DescriptionField.test.ts
index aee35f5a..5646e3f1 100644
--- a/tests/Query/Filter/DescriptionField.test.ts
+++ b/tests/Query/Filter/DescriptionField.test.ts
@@ -3,7 +3,7 @@
  */
 import moment from 'moment';
 import { DescriptionField } from '../../../src/Query/Filter/DescriptionField';
-import { resetSettings, updateSettings } from '../../../src/config/Settings';
+import { resetSettings, 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 8a0332c6..32ca535f 100644
--- a/tests/Query/Filter/TagsField.test.ts
+++ b/tests/Query/Filter/TagsField.test.ts
@@ -1,4 +1,4 @@
-import { resetSettings, updateSettings } from '../../../src/config/Settings';
+import { resetSettings, updateSettings } from '../../../src/Config/Settings';
 import type { FilteringCase } from '../../TestingTools/FilterTestHelpers';
 import { shouldSupportFiltering } from '../../TestingTools/FilterTestHelpers';
 import { toMatchTaskFromLine } from '../../CustomMatchers/CustomMatchersForFilters';
diff --git a/tests/Sort.test.ts b/tests/Sort.test.ts
index e24f9b79..c6c25ce9 100644
--- a/tests/Sort.test.ts
+++ b/tests/Sort.test.ts
@@ -5,8 +5,8 @@ import moment from 'moment';
 
 window.moment = moment;
 
-import { Sort } from '../src/Sort';
-import { resetSettings, updateSettings } from '../src/config/Settings';
+import { Sort } from '../src/Query/Sort';
+import { resetSettings, updateSettings } from '../src/Config/Settings';
 import { fromLine } from './TestHelpers';
 
 describe('Sort', () => {
diff --git a/tests/Task.test.ts b/tests/Task.test.ts
index 30b7fd8a..5cda93da 100644
--- a/tests/Task.test.ts
+++ b/tests/Task.test.ts
@@ -3,7 +3,7 @@
  */
 import moment from 'moment';
 import { Priority, Status, Task } from '../src/Task';
-import { resetSettings, updateSettings } from '../src/config/Settings';
+import { resetSettings, updateSettings } from '../src/Config/Settings';
 import { fromLine } from './TestHelpers';
 import { TaskBuilder } from './TestingTools/TaskBuilder';
 import { RecurrenceBuilder } from './TestingTools/RecurrenceBuilder';
diff --git a/tests/TestingTools/FilterTestHelpers.ts b/tests/TestingTools/FilterTestHelpers.ts
index 784ef1fc..6c638301 100644
--- a/tests/TestingTools/FilterTestHelpers.ts
+++ b/tests/TestingTools/FilterTestHelpers.ts
@@ -1,6 +1,6 @@
 import type { FilterOrErrorMessage } from '../../src/Query/Filter/Filter';
 import { Task } from '../../src/Task';
-import { Query } from '../../src/Query';
+import { Query } from '../../src/Query/Query';
 import type { TaskBuilder } from './TaskBuilder';
 
 /**
diff --git a/tests/config/Feature.test.ts b/tests/config/Feature.test.ts
index 002eab5c..874e360e 100644
--- a/tests/config/Feature.test.ts
+++ b/tests/config/Feature.test.ts
@@ -1,7 +1,7 @@
 /**
  * @jest-environment jsdom
  */
-import { Feature } from '../../src/config/Feature';
+import { Feature } from '../../src/Config/Feature';
 
 describe('feature-usage', () => {
     it('load current features', () => {
diff --git a/tests/config/Settings.test.ts b/tests/config/Settings.test.ts
index f8efc6e6..089ea1f6 100644
--- a/tests/config/Settings.test.ts
+++ b/tests/config/Settings.test.ts
@@ -5,7 +5,7 @@ import {
     getSettings,
     isFeatureEnabled,
     toggleFeature,
-} from '../../src/config/Settings';
+} from '../../src/Config/Settings';
 
 describe('settings-usage', () => {
     it('load default settings and validate features', () => {