just eslint things
This commit is contained in:
parent
ecaefc115c
commit
e53a289ea1
6 changed files with 113 additions and 654 deletions
2
.vscode/extensions.json
vendored
2
.vscode/extensions.json
vendored
|
@ -1,3 +1,3 @@
|
||||||
{
|
{
|
||||||
"recommendations": ["rvest.vs-code-prettier-eslint", "dbaeumer.vscode-eslint"]
|
"recommendations": ["dbaeumer.vscode-eslint"]
|
||||||
}
|
}
|
||||||
|
|
13
.vscode/settings.json
vendored
13
.vscode/settings.json
vendored
|
@ -1,9 +1,8 @@
|
||||||
{
|
{
|
||||||
"editor.defaultFormatter": "rvest.vs-code-prettier-eslint",
|
"editor.defaultFormatter": "dbaeumer.vscode-eslint",
|
||||||
"editor.formatOnType": false,
|
"eslint.format.enable": true,
|
||||||
"editor.formatOnPaste": true,
|
"eslint.codeActionsOnSave.mode": "problems",
|
||||||
"editor.formatOnSave": true,
|
"eslint.options": {
|
||||||
"editor.formatOnSaveMode": "file",
|
"overrideConfigFile": "eslint.config.mjs"
|
||||||
"files.autoSave": "onFocusChange",
|
}
|
||||||
"vs-code-prettier-eslint.prettierLast": false // set as "true" to run 'prettier' last not first
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,13 +2,15 @@ import globals from "globals";
|
||||||
import pluginJs from "@eslint/js";
|
import pluginJs from "@eslint/js";
|
||||||
import tseslint from "typescript-eslint";
|
import tseslint from "typescript-eslint";
|
||||||
import pluginReact from "eslint-plugin-react";
|
import pluginReact from "eslint-plugin-react";
|
||||||
|
import pluginPrettierRecommended from "eslint-plugin-prettier/recommended";
|
||||||
|
|
||||||
/** @type {import('eslint').Linter.Config[]} */
|
/** @type {import('eslint').Linter.Config[]} */
|
||||||
export default [
|
export default [
|
||||||
{files: ["**/*.{js,mjs,cjs,ts,jsx,tsx}"]},
|
{
|
||||||
{languageOptions: { globals: globals.browser }},
|
files: ["**/*.{js,mjs,cjs,ts,jsx,tsx}"],
|
||||||
|
},
|
||||||
pluginJs.configs.recommended,
|
pluginJs.configs.recommended,
|
||||||
...tseslint.configs.recommended,
|
...tseslint.configs.recommended,
|
||||||
pluginReact.configs.flat.recommended,
|
pluginReact.configs.flat.recommended,
|
||||||
|
pluginPrettierRecommended,
|
||||||
];
|
];
|
|
@ -20,11 +20,11 @@
|
||||||
"@types/which": "^3.0.4",
|
"@types/which": "^3.0.4",
|
||||||
"@typescript-eslint/parser": "^8.18.1",
|
"@typescript-eslint/parser": "^8.18.1",
|
||||||
"eslint": "^9.17.0",
|
"eslint": "^9.17.0",
|
||||||
|
"eslint-config-prettier": "^9.1.0",
|
||||||
|
"eslint-plugin-prettier": "^5.2.1",
|
||||||
"eslint-plugin-react": "^7.37.2",
|
"eslint-plugin-react": "^7.37.2",
|
||||||
"globals": "^15.14.0",
|
"globals": "^15.14.0",
|
||||||
"prettier": "^3.4.2",
|
"prettier": "^3.4.2",
|
||||||
"prettier-eslint": "^16.3.0",
|
|
||||||
"prettier-eslint-cli": "^8.0.1",
|
|
||||||
"typescript": "^5.7.2",
|
"typescript": "^5.7.2",
|
||||||
"typescript-eslint": "^8.18.1"
|
"typescript-eslint": "^8.18.1"
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,10 @@
|
||||||
import { Action, ActionPanel, Content, Icons, Inline } from "@project-gauntlet/api/components";
|
import {
|
||||||
|
Action,
|
||||||
|
ActionPanel,
|
||||||
|
Content,
|
||||||
|
Icons,
|
||||||
|
Inline,
|
||||||
|
} from "@project-gauntlet/api/components";
|
||||||
import React, { ReactNode } from "react";
|
import React, { ReactNode } from "react";
|
||||||
import { Clipboard, showHud } from "@project-gauntlet/api/helpers";
|
import { Clipboard, showHud } from "@project-gauntlet/api/helpers";
|
||||||
import * as UnicodeEmoji from "unicode-emoji";
|
import * as UnicodeEmoji from "unicode-emoji";
|
||||||
|
@ -7,17 +13,21 @@ import * as UnicodeEmoji from "unicode-emoji";
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
const denoCore: DenoCore = Deno[Deno.internal].core;
|
const denoCore: DenoCore = Deno[Deno.internal].core;
|
||||||
|
|
||||||
export default function EmojiPicker(props: { text: string }): ReactNode | undefined {
|
export default function EmojiPicker(props: {
|
||||||
|
text: string;
|
||||||
|
}): ReactNode | undefined {
|
||||||
const text = props.text.trim();
|
const text = props.text.trim();
|
||||||
|
|
||||||
if (text.length < 3) {
|
if (text.length < 3) {
|
||||||
return undefined
|
return undefined;
|
||||||
};
|
}
|
||||||
|
|
||||||
const emoji = UnicodeEmoji.getEmojis().find(emoji => emoji.keywords.includes(text));
|
const emoji = UnicodeEmoji.getEmojis().find((emoji) =>
|
||||||
|
emoji.keywords.includes(text),
|
||||||
|
);
|
||||||
if (!emoji) {
|
if (!emoji) {
|
||||||
return undefined
|
return undefined;
|
||||||
};
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Inline
|
<Inline
|
||||||
|
@ -26,7 +36,7 @@ export default function EmojiPicker(props: { text: string }): ReactNode | undefi
|
||||||
<Action
|
<Action
|
||||||
label={`Copy ${emoji.emoji} to clipboard`}
|
label={`Copy ${emoji.emoji} to clipboard`}
|
||||||
onAction={async () => {
|
onAction={async () => {
|
||||||
console.log(emoji.emoji)
|
console.log(emoji.emoji);
|
||||||
await Clipboard.writeText(emoji.emoji);
|
await Clipboard.writeText(emoji.emoji);
|
||||||
showHud(`${emoji.emoji} copied to clipboard`);
|
showHud(`${emoji.emoji} copied to clipboard`);
|
||||||
}}
|
}}
|
||||||
|
@ -35,16 +45,12 @@ export default function EmojiPicker(props: { text: string }): ReactNode | undefi
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<Inline.Left>
|
<Inline.Left>
|
||||||
<Content.H3>
|
<Content.H3>{text}</Content.H3>
|
||||||
{text}
|
|
||||||
</Content.H3>
|
|
||||||
</Inline.Left>
|
</Inline.Left>
|
||||||
<Inline.Separator icon={Icons.ArrowRight} />
|
<Inline.Separator icon={Icons.ArrowRight} />
|
||||||
<Inline.Right>
|
<Inline.Right>
|
||||||
<Content.H3>
|
<Content.Paragraph>{emoji.emoji}</Content.Paragraph>
|
||||||
{emoji.emoji}
|
|
||||||
</Content.H3>
|
|
||||||
</Inline.Right>
|
</Inline.Right>
|
||||||
</Inline>
|
</Inline>
|
||||||
);
|
);
|
||||||
};
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue