diff options
author | Shin'ya Ueoka <ueokande@i-beam.org> | 2019-12-22 10:01:24 +0900 |
---|---|---|
committer | Shin'ya Ueoka <ueokande@i-beam.org> | 2019-12-22 10:48:39 +0900 |
commit | 2e7006ce24c42ec2b6642346d153429338e7334e (patch) | |
tree | f1eb9e843ab4ec5d7d3f08fff8c858174b6f1284 /src/shared/settings | |
parent | 0881f92d20cb7b4f5a75671df739c3eaa3cd0ff0 (diff) |
npm run lint:fix
Diffstat (limited to 'src/shared/settings')
-rw-r--r-- | src/shared/settings/Blacklist.ts | 4 | ||||
-rw-r--r-- | src/shared/settings/Key.ts | 4 | ||||
-rw-r--r-- | src/shared/settings/Keymaps.ts | 4 | ||||
-rw-r--r-- | src/shared/settings/Search.ts | 4 | ||||
-rw-r--r-- | src/shared/settings/Settings.ts | 8 |
5 files changed, 12 insertions, 12 deletions
diff --git a/src/shared/settings/Blacklist.ts b/src/shared/settings/Blacklist.ts index 1903a78..6e6b51c 100644 --- a/src/shared/settings/Blacklist.ts +++ b/src/shared/settings/Blacklist.ts @@ -8,7 +8,7 @@ export type BlacklistItemJSON = string | { export type BlacklistJSON = BlacklistItemJSON[]; const regexFromWildcard = (pattern: string): RegExp => { - let regexStr = '^' + pattern.replace(/\*/g, '.*') + '$'; + const regexStr = '^' + pattern.replace(/\*/g, '.*') + '$'; return new RegExp(regexStr); }; @@ -72,7 +72,7 @@ export default class Blacklist { } static fromJSON(json: BlacklistJSON): Blacklist { - let items = json.map(o => BlacklistItem.fromJSON(o)); + const items = json.map(o => BlacklistItem.fromJSON(o)); return new Blacklist(items); } diff --git a/src/shared/settings/Key.ts b/src/shared/settings/Key.ts index 3a3eb3b..cfe1e7e 100644 --- a/src/shared/settings/Key.ts +++ b/src/shared/settings/Key.ts @@ -33,8 +33,8 @@ export default class Key { static fromMapKey(str: string): Key { if (str.startsWith('<') && str.endsWith('>')) { - let inner = str.slice(1, -1); - let shift = inner.includes('S-'); + const inner = str.slice(1, -1); + const shift = inner.includes('S-'); let base = inner.slice(inner.lastIndexOf('-') + 1); if (shift && base.length === 1) { base = base.toUpperCase(); diff --git a/src/shared/settings/Keymaps.ts b/src/shared/settings/Keymaps.ts index 5870313..3880654 100644 --- a/src/shared/settings/Keymaps.ts +++ b/src/shared/settings/Keymaps.ts @@ -15,8 +15,8 @@ export default class Keymaps { } static fromJSON(json: KeymapsJSON): Keymaps { - let entries: { [key: string]: operations.Operation } = {}; - for (let key of Object.keys(json)) { + const entries: { [key: string]: operations.Operation } = {}; + for (const key of Object.keys(json)) { entries[key] = operations.valueOf(json[key]); } return new Keymaps(entries); diff --git a/src/shared/settings/Search.ts b/src/shared/settings/Search.ts index 7d7e555..7de03de 100644 --- a/src/shared/settings/Search.ts +++ b/src/shared/settings/Search.ts @@ -13,11 +13,11 @@ export default class Search { } static fromJSON(json: SearchJSON): Search { - for (let [name, url] of Object.entries(json.engines)) { + for (const [name, url] of Object.entries(json.engines)) { if (!(/^[a-zA-Z0-9]+$/).test(name)) { throw new TypeError('Search engine\'s name must be [a-zA-Z0-9]+'); } - let matches = url.match(/{}/g); + const matches = url.match(/{}/g); if (matches === null) { throw new TypeError(`No {}-placeholders in URL of "${name}"`); } else if (matches.length > 1) { diff --git a/src/shared/settings/Settings.ts b/src/shared/settings/Settings.ts index 97dda7f..add5389 100644 --- a/src/shared/settings/Settings.ts +++ b/src/shared/settings/Settings.ts @@ -40,9 +40,9 @@ export default class Settings { } static fromJSON(json: unknown): Settings { - let valid = validate(json); + const valid = validate(json); if (!valid) { - let message = (validate as any).errors!! + const message = (validate as any).errors!! .map((err: Ajv.ErrorObject) => { return `'${err.dataPath}' ${err.message}`; }) @@ -50,8 +50,8 @@ export default class Settings { throw new TypeError(message); } - let obj = json as SettingsJSON; - let settings = { ...DefaultSetting }; + const obj = json as SettingsJSON; + const settings = { ...DefaultSetting }; if (obj.keymaps) { settings.keymaps = Keymaps.fromJSON(obj.keymaps); } |