Skip to content

Commit

Permalink
Migrate: optional chainに書き換える (#2387)
Browse files Browse the repository at this point in the history
Co-authored-by: Hiroshiba <[email protected]>
  • Loading branch information
sevenc-nanashi and Hiroshiba authored Dec 3, 2024
1 parent e339e61 commit 02ac972
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 125 deletions.
17 changes: 1 addition & 16 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,7 @@ module.exports = {
plugins: ["import"],
parser: vueEslintParser,
parserOptions: vueEslintParserOptions,
ignorePatterns: [
"dist/**/*",
"dist_*/**/*",
"node_modules/**/*",
],
ignorePatterns: ["dist/**/*", "dist_*/**/*", "node_modules/**/*"],
rules: {
"linebreak-style":
process.env.NODE_ENV === "production" && process.platform !== "win32"
Expand All @@ -63,17 +59,6 @@ module.exports = {
endOfLine: "auto",
},
],
"vue/no-restricted-syntax": [
"error",
{
selector: "LogicalExpression[operator=??]",
message: `template内で"??"を使うとgithubのsyntax highlightが崩れるので\n三項演算子等を使って書き換えてください`,
},
{
selector: "MemberExpression[optional=true]",
message: `template内で"?."を使うとgithubのsyntax highlightが崩れるので\n三項演算子等を使って書き換えてください`,
},
],
"@typescript-eslint/no-unused-vars": [
process.env.NODE_ENV === "development" ? "warn" : "error", // 開発時のみwarn
{
Expand Down
22 changes: 10 additions & 12 deletions src/components/Dialog/HelpDialog/HelpLibraryPolicySection.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@
>
<!-- エンジンが一つだけの場合は名前を表示しない -->
<h2 v-if="engineInfos.size > 1" class="subtitle">
{{ mapNullablePipe(engineInfos.get(engineId), (v) => v.name) }}
{{ engineInfos.get(engineId)?.name }}
</h2>
<BaseRowCard
v-for="([, characterInfo], characterIndex) in mapNullablePipe(
engineInfos.get(engineId),
(v) => v.characterInfos,
)"
v-for="([, characterInfo], characterIndex) in getOrThrow(
engineInfos,
engineId,
).characterInfos"
:key="characterIndex"
:title="characterInfo.metas.speakerName"
clickable
Expand Down Expand Up @@ -49,12 +49,10 @@
</div>
<h1 class="title">
{{
mapNullablePipe(
engineInfos.get(selectedInfo.engine),
(v) => v.characterInfos,
(v) => mapNullablePipe(selectedInfo, (i) => v.get(i.character)),
(v) => v.metas.speakerName,
)
selectedInfo &&
engineInfos
.get(selectedInfo.engine)
?.characterInfos.get(selectedInfo.character)?.metas.speakerName
}}
</h1>
<BaseDocumentView>
Expand All @@ -75,7 +73,7 @@ import BaseDocumentView from "@/components/Base/BaseDocumentView.vue";
import { useStore } from "@/store";
import { useMarkdownIt } from "@/plugins/markdownItPlugin";
import { EngineId, SpeakerId } from "@/type/preload";
import { mapNullablePipe } from "@/helpers/map";
import { getOrThrow } from "@/helpers/mapHelper";
type DetailKey = { engine: EngineId; character: SpeakerId };
Expand Down
39 changes: 0 additions & 39 deletions src/helpers/map.ts

This file was deleted.

58 changes: 0 additions & 58 deletions tests/unit/lib/map.spec.ts

This file was deleted.

0 comments on commit 02ac972

Please sign in to comment.