Skip to content

Commit

Permalink
🔧 fix: regex linting
Browse files Browse the repository at this point in the history
  • Loading branch information
Rettend committed May 24, 2024
1 parent eabe087 commit 2e2e6be
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@
"dev": "node ./bin/eemoji.mjs",
"test": "vitest",
"test:ui": "vitest --ui --coverage --api 9527",
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"lint": "eslint . --fix",
"typecheck": "tsc --noEmit",
"gen:presets": "tsx scripts/presets",
"gen:schema": "tsx scripts/schema",
Expand Down
2 changes: 1 addition & 1 deletion src/commands/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ async function loadConfig(): Promise<Config> {

if (!config.format)
throw new Error('Format missing in config file.')
else if (!config.format.match(/{emoji}|{type}|{subject}/g))
else if (!config.format.match(/\{emoji\}|\{type\}|\{subject\}/g))
throw new Error('Invalid format specified in config file.')

return config
Expand Down
2 changes: 1 addition & 1 deletion src/eemoji.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import type { Config } from './config'
*/
export function eemojify(text: string, config: Config, DEBUG?: number): string {
// the separator is whatever character remains after removing the format placeholders, or a space
const separator = config.format.replace(/{emoji}|{type}|{subject}/g, '').trim() || ' '
const separator = config.format.replace(/\{emoji\}|\{type\}|\{subject\}/g, '').trim() || ' '

const separatorIndex = text.indexOf(separator)
const type = text.substring(0, separatorIndex).trim()
Expand Down

0 comments on commit 2e2e6be

Please sign in to comment.