Browse Source

ref(js): Consistent naming for storeConfig objects (#29129)

Co-authored-by: getsantry[bot] <66042841+getsantry[bot]@users.noreply.github.com>
Evan Purkhiser 3 years ago
parent
commit
917a18763e

+ 2 - 2
static/app/stores/alertStore.tsx

@@ -15,7 +15,7 @@ type Alert = {
   noDuplicates?: boolean;
 };
 
-type AlertStoreInterface = Reflux.StoreDefinition & {
+type AlertStoreInterface = {
   init(): void;
   getInitialState(): Alert[];
   onAddAlert(alert: Alert): void;
@@ -27,7 +27,7 @@ type Internals = {
   count: number;
 };
 
-const storeConfig: AlertStoreInterface & Internals = {
+const storeConfig: Reflux.StoreDefinition & Internals & AlertStoreInterface = {
   listenables: AlertActions,
   alerts: [],
   count: 0,

+ 2 - 2
static/app/stores/committerStore.tsx

@@ -35,7 +35,7 @@ type CommitterStoreInterface = {
   };
 };
 
-export const CommitterStoreConfig: Reflux.StoreDefinition & CommitterStoreInterface = {
+export const storeConfig: Reflux.StoreDefinition & CommitterStoreInterface = {
   listenables: CommitterActions,
   state: {},
 
@@ -104,7 +104,7 @@ export function getCommitterStoreKey(
   return `${orgSlug} ${projectSlug} ${eventId}`;
 }
 
-const CommitterStore = Reflux.createStore(CommitterStoreConfig) as Reflux.Store &
+const CommitterStore = Reflux.createStore(storeConfig) as Reflux.Store &
   CommitterStoreInterface;
 
 export default CommitterStore;

+ 6 - 4
static/app/stores/configStore.tsx

@@ -4,8 +4,6 @@ import Reflux from 'reflux';
 import {Config} from 'app/types';
 
 type ConfigStoreInterface = {
-  config: Config;
-
   get<K extends keyof Config>(key: K): Config[K];
   set<K extends keyof Config>(key: K, value: Config[K]): void;
   getConfig(): Config;
@@ -13,7 +11,11 @@ type ConfigStoreInterface = {
   loadInitialData(config: Config): void;
 };
 
-const configStoreConfig: Reflux.StoreDefinition & ConfigStoreInterface = {
+type Internals = {
+  config: Config;
+};
+
+const storeConfig: Reflux.StoreDefinition & Internals & ConfigStoreInterface = {
   // When the app is booted we will _immediately_ hydrate the config store,
   // effecively ensureing this is not empty.
   config: {} as Config,
@@ -69,7 +71,7 @@ const configStoreConfig: Reflux.StoreDefinition & ConfigStoreInterface = {
   },
 };
 
-const ConfigStore = Reflux.createStore(configStoreConfig) as Reflux.Store &
+const ConfigStore = Reflux.createStore(storeConfig) as Reflux.Store &
   ConfigStoreInterface;
 
 export default ConfigStore;

+ 2 - 3
static/app/stores/formSearchStore.tsx

@@ -26,7 +26,7 @@ type Internals = {
 /**
  * Store for "form" searches, but probably will include more
  */
-const formSearchStoreConfig: Reflux.StoreDefinition & Internals & StoreInterface = {
+const storeConfig: Reflux.StoreDefinition & Internals & StoreInterface = {
   searchMap: null,
 
   init() {
@@ -57,7 +57,6 @@ const formSearchStoreConfig: Reflux.StoreDefinition & Internals & StoreInterface
   },
 };
 
-const FormSearchStore = Reflux.createStore(formSearchStoreConfig) as Reflux.Store &
-  StoreInterface;
+const FormSearchStore = Reflux.createStore(storeConfig) as Reflux.Store & StoreInterface;
 
 export default FormSearchStore;

+ 2 - 3
static/app/stores/guideStore.tsx

@@ -75,7 +75,7 @@ type GuideStoreInterface = {
   updatePrevGuide(nextGuide: Guide | null): void;
 };
 
-const guideStoreConfig: Reflux.StoreDefinition & GuideStoreInterface = {
+const storeConfig: Reflux.StoreDefinition & GuideStoreInterface = {
   state: defaultState,
 
   init() {
@@ -249,7 +249,6 @@ const guideStoreConfig: Reflux.StoreDefinition & GuideStoreInterface = {
   },
 };
 
-const GuideStore = Reflux.createStore(guideStoreConfig) as Reflux.Store &
-  GuideStoreInterface;
+const GuideStore = Reflux.createStore(storeConfig) as Reflux.Store & GuideStoreInterface;
 
 export default GuideStore;

+ 2 - 3
static/app/stores/hookStore.tsx

@@ -14,7 +14,7 @@ type HookStoreInterface = {
   get<H extends HookName>(hookName: H): Array<Hooks[H]>;
 };
 
-const hookStoreConfig: Reflux.StoreDefinition & HookStoreInterface = {
+const storeConfig: Reflux.StoreDefinition & HookStoreInterface = {
   hooks: {},
 
   init() {
@@ -49,7 +49,6 @@ const hookStoreConfig: Reflux.StoreDefinition & HookStoreInterface = {
  *
  * This functionality is primarily used by the SASS sentry.io product.
  */
-const HookStore = Reflux.createStore(hookStoreConfig) as Reflux.Store &
-  HookStoreInterface;
+const HookStore = Reflux.createStore(storeConfig) as Reflux.Store & HookStoreInterface;
 
 export default HookStore;

+ 1 - 1
static/app/stores/indicatorStore.tsx

@@ -57,7 +57,7 @@ type Internals = {
   lastId: number;
 };
 
-const storeConfig: Reflux.StoreDefinition & IndicatorStoreInterface & Internals = {
+const storeConfig: Reflux.StoreDefinition & Internals & IndicatorStoreInterface = {
   items: [],
   lastId: 0,
   init() {

+ 8 - 6
static/app/stores/latestContextStore.tsx

@@ -27,12 +27,14 @@ type LatestContextStoreInterface = {
   onUpdateProject(project: Project | null): void;
 };
 
-// Keeps track of last usable project/org
-// this currently won't track when users navigate out of a org/project completely,
-// it tracks only if a user switches into a new org/project
-//
-// Only keep slug so that people don't get the idea to access org/project data here
-// Org/project data is currently in organizationsStore/projectsStore
+/**
+ * Keeps track of last usable project/org this currently won't track when users
+ * navigate out of a org/project completely, it tracks only if a user switches
+ * into a new org/project.
+ *
+ * Only keep slug so that people don't get the idea to access org/project data
+ * here Org/project data is currently in organizationsStore/projectsStore
+ */
 const storeConfig: Reflux.StoreDefinition & LatestContextStoreInterface = {
   state: {
     project: null,

+ 2 - 2
static/app/stores/memberListStore.tsx

@@ -12,7 +12,7 @@ type MemberListStoreInterface = {
   getAll(): User[];
 };
 
-const memberListStoreConfig: Reflux.StoreDefinition & MemberListStoreInterface = {
+const storeConfig: Reflux.StoreDefinition & MemberListStoreInterface = {
   // listenables: MemberActions,
 
   loaded: false,
@@ -67,7 +67,7 @@ const memberListStoreConfig: Reflux.StoreDefinition & MemberListStoreInterface =
   },
 };
 
-const MemberListStore = Reflux.createStore(memberListStoreConfig) as Reflux.Store &
+const MemberListStore = Reflux.createStore(storeConfig) as Reflux.Store &
   MemberListStoreInterface;
 
 export default MemberListStore;

+ 2 - 2
static/app/stores/organizationsStore.tsx

@@ -17,7 +17,7 @@ type OrganizationsStoreInterface = {
   load(items: Organization[]): void;
 };
 
-const organizationsStoreConfig: Reflux.StoreDefinition & OrganizationsStoreInterface = {
+const storeConfig: Reflux.StoreDefinition & OrganizationsStoreInterface = {
   listenables: [OrganizationsActions],
 
   state: [],
@@ -85,7 +85,7 @@ const organizationsStoreConfig: Reflux.StoreDefinition & OrganizationsStoreInter
   },
 };
 
-const OrganizationsStore = Reflux.createStore(organizationsStoreConfig) as Reflux.Store &
+const OrganizationsStore = Reflux.createStore(storeConfig) as Reflux.Store &
   OrganizationsStoreInterface;
 
 export default OrganizationsStore;

Some files were not shown because too many files changed in this diff