aboutsummaryrefslogtreecommitdiff
path: root/src/shared/settings/Settings.ts
diff options
context:
space:
mode:
authorShin'ya Ueoka <ueokande@i-beam.org>2020-05-02 17:25:56 +0900
committerGitHub <noreply@github.com>2020-05-02 17:25:56 +0900
commit5df0537bcf65a341e79852b1b30379c73318529c (patch)
treeaee5efe52412855f620cb514a13a2c14373f27b7 /src/shared/settings/Settings.ts
parent685f2b7b69218b06b5bb676069e35f79c5048c9b (diff)
parent75abd90ecb8201ad845b266f96220d8adfe19b2d (diff)
Merge pull request #749 from ueokande/qa-0.28
QA 0.28
Diffstat (limited to 'src/shared/settings/Settings.ts')
-rw-r--r--src/shared/settings/Settings.ts31
1 files changed, 16 insertions, 15 deletions
diff --git a/src/shared/settings/Settings.ts b/src/shared/settings/Settings.ts
index add5389..1bb9249 100644
--- a/src/shared/settings/Settings.ts
+++ b/src/shared/settings/Settings.ts
@@ -1,16 +1,16 @@
-import Ajv from 'ajv';
+import Ajv from "ajv";
-import Keymaps, { KeymapsJSON } from './Keymaps';
-import Search, { SearchJSON } from './Search';
-import Properties, { PropertiesJSON } from './Properties';
-import Blacklist, { BlacklistJSON } from './Blacklist';
-import validate from './validate';
+import Keymaps, { KeymapsJSON } from "./Keymaps";
+import Search, { SearchJSON } from "./Search";
+import Properties, { PropertiesJSON } from "./Properties";
+import Blacklist, { BlacklistJSON } from "./Blacklist";
+import validate from "./validate";
export type SettingsJSON = {
- keymaps?: KeymapsJSON,
- search?: SearchJSON,
- properties?: PropertiesJSON,
- blacklist?: BlacklistJSON,
+ keymaps?: KeymapsJSON;
+ search?: SearchJSON;
+ properties?: PropertiesJSON;
+ blacklist?: BlacklistJSON;
};
export default class Settings {
@@ -42,11 +42,11 @@ export default class Settings {
static fromJSON(json: unknown): Settings {
const valid = validate(json);
if (!valid) {
- const message = (validate as any).errors!!
- .map((err: Ajv.ErrorObject) => {
+ const message = (validate as any)
+ .errors!!.map((err: Ajv.ErrorObject) => {
return `'${err.dataPath}' ${err.message}`;
})
- .join('; ');
+ .join("; ");
throw new TypeError(message);
}
@@ -162,5 +162,6 @@ export const DefaultSettingJSONText = `{
]
}`;
-export const DefaultSetting: Settings =
- Settings.fromJSON(JSON.parse(DefaultSettingJSONText));
+export const DefaultSetting: Settings = Settings.fromJSON(
+ JSON.parse(DefaultSettingJSONText)
+);