Instantly share code, notes, and snippets.
Creator of@textlint,@secretlint,@honkit and@almin.Editor of@efcl,@jser and@ecmascript-daily.Author of@js-primer.(Don't send me email-ad.)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
#!/usr/bin/env node --experimental-strip-types | |
// # npm/yarn を pnpm に移行するスクリプト | |
// ## 制限 | |
// Node.jsのコアパッケージのみを利用する | |
// - fsのglob | |
// https://nodejs.org/api/fs.html#fspromisesglobpattern-options | |
// - util.parseArgv | |
// https://nodejs.org/api/util.html#utilparseargsconfig | |
// ## 変更箇所 |
azu /tj-actions.md
Last activeMarch 15, 2025 08:46
Research for tj-actions org.https://www.stepsecurity.io/blog/harden-runner-detection-tj-actions-changed-files-action-is-compromisedazu /ts-mini-compiler.ts
CreatedMarch 13, 2025 07:33
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
import*astsfrom"typescript"; | |
constgetLineTextFromFilePosition=( | |
file:ts.SourceFile, | |
{ line, character}:ts.LineAndCharacter, | |
):string=>{ | |
constlines=file.getFullText().split("\n"); | |
returnlines[line]?.slice(character)??""; | |
}; |
azu /require-comment-on-useEffect.js
Last activeApril 17, 2025 22:43
ESLint plugin forhttps://www.pandanoir.info/entry/2025/01/29/205439 This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
exportconstrequireComment={ | |
meta:{ | |
type:"suggestion", | |
docs:{ | |
description:"useEffectにはコメントでの説明が必須です。", | |
}, | |
schema:[], | |
messages:{ | |
requireCommentOnUseEffect: `useEffectにはコメントでの説明が必須です。 |
azu /pnpm-up.sh
Last activeJanuary 5, 2025 13:31
`pnpm --recursive update --interactive --latest` for pnpm catalogs. pnpm + fzf + yq This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
# Update pnpm catalog with interactive | |
# pnpm catalog: https://pnpm.io/ja/catalogs | |
# fzf: https://github.com/junegunn/fzf | |
# yq: https://github.com/kislyuk/yq | |
selected_cataglogs=$(pnpm outdated --recursive --json| jq -r'to_entries[] | .key + ": " + .value.current + " → " + .value.latest'| fzf --multi) | |
echo$selected_cataglogs|whileread line;do | |
pkg_name=$(echo"$line"| cut -d: -f1) | |
pkg_version=$(echo"$line"| cut -d'' -f4) | |
echo"Update$pkg_name to$pkg_version" | |
yq -i".catalog += {\"$pkg_name\":\"$pkg_version\"}" pnpm-workspace.yaml |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
exporttypeBaseEnvRecord=Record< | |
string, | |
{ | |
value:string|undefined; | |
required:boolean; | |
defaultValue?:string; | |
} | |
>; | |
exporttypeReturnTypeOfCreateEnv<TextendsBaseEnvRecord>={ | |
// If the value is required, it should be a string, otherwise it should be a string or undefined |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
{ | |
// ベースのtsconfigは決められたカテゴリのみを設定する | |
// それ以外は、プロジェクトごとに設定する | |
// https://www.typescriptlang.org/tsconfig/#compilerOptions | |
"compilerOptions": { | |
// incrementalビルドは特別にデフォルトで有効にする | |
"incremental":true, | |
// # JavaScript Support | |
"allowJs":false, | |
// # Type Checking |
NewerOlder