- Facebookが開発した クエリ言語
- 今はGraphQL Foundationに移管されている
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 * as ts from "typescript"; | |
import { SourceCode, Linter, AST } from "eslint"; | |
import { Extra } from "@typescript-eslint/typescript-estree/dist/parser-options"; | |
import convert from "@typescript-eslint/typescript-estree/dist/ast-converter"; | |
function initExtra() { | |
return { | |
tokens: null, | |
range: false, | |
loc: false, |
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 { Rule } from "eslint"; | |
const rule: Rule.RuleModule = { | |
create: (context) => { | |
return { | |
['NewExpression:not(:has(*.arguments)) > Identifier[name="Date"], CallExpression > MemberExpression:has(Identifier.object[name="Date"]) > Identifier.property[name="now"]']: (node: any) => { | |
context.report({ | |
message: "Don't use side-effective Date function.", | |
node, | |
}); |
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
/** | |
* | |
* Mini calc with TypeScript template string types | |
* | |
* EBNF | |
* | |
* ``` | |
* expr = mul ("+" mul)* | |
* mul = primary ("*" primary)* | |
* primary = num | "(" expr ")" |
https://devblogs.microsoft.com/typescript/announcing-typescript-4-2/
下記のように、Rest Elements が tuple の最初でなくても使えるようになっています。
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 assert from "assert"; | |
import { parse, print, DocumentNode, visit } from "graphql"; | |
function removeUnusedFragment(document: DocumentNode) { | |
const usedFragmentSet = new Set<string>(); | |
// mark used | |
visit(document, { | |
FragmentSpread(node) { | |
usedFragmentSet.add(node.name.value); |
Relay や Apollo のスタンス:
- Performance 都合のみであれば、Document Cache でも十分。
- Cached Data の一貫性を保持することを考えると、Document Cache では不十分であり、正規化が必要
https://relay.dev/docs/principles-and-architecture/thinking-in-graphql/#client-caching
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 { cache } from "react"; | |
import DataLoader from "dataloader"; | |
// backend service clients | |
import { getPopularPosts, getUserById, getUsers } from "@/services"; | |
const memoizedGetUserById = cache(getUserById); | |
const getUserLoader = () => |
先週に同僚と会話していたときに気になっていた Experimental Test Proxy について。
mugi さんの素振りメモ や この機能が実装された際の PR のコードを読んで、ようやく何が行われているかを理解した。
まず、README にある以下のコードがどこをスタブしているかであるが、
import { test, expect } from "next/experimental/testmode/playwright";