Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

template内での ?? と ?. の利用をeslintで制限する #1010

Merged
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@ module.exports = {
endOfLine: "auto",
},
],
"vue/no-restricted-syntax": [
"error",
{
selector: "LogicalExpression[operator=??]",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ついでになのですが、同様にオプショナルチェーン?.)もエラーにできそうでしょうか 🙇
たしかこちらも同様にsyntax highlightが崩れるので・・・。

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

optional chainingも MemberExpression[optional=true] で問題なく対応できそうでした!
利用箇所が10ヶ所ほど残っていたので合わせて修正しますね

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

51acc52 でoptional chainingを禁止し、
5f0db60 で利用箇所を修正しました。シンプルに三項演算子に置き換えています a?.b => a ? a.b : undefined

message: `template内で"??"を使うとgithubのsyntax highlightが崩れるので\n三項演算子等を使って書き換えてください`,
},
],
"@typescript-eslint/no-unused-vars": [
"warn",
{
Expand Down
4 changes: 3 additions & 1 deletion src/components/CharacterOrderDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,9 @@
<img
:src="
characterInfosMap[speakerUuid].metas.styles[
selectedStyleIndexes[speakerUuid] ?? 0
selectedStyleIndexes[speakerUuid]
? selectedStyleIndexes[speakerUuid]
: 0
].iconPath
"
class="style-icon"
Expand Down