Convert Material UI icons to path imports. E.g.
-import { ErrorOutline as ErrorIcon } from "@material-ui/icons";
+import ErrorIcon from "@material-ui/icons/ErrorOutline";
Reasoning:-
// Patch ANY untyped Apollo-ish hooks: useQuery/useLazyQuery (<any>), useMutation (<any, any>) | |
// regardless of import origin (direct, re-exports, namespace, etc.) | |
module.exports.parser = "tsx"; | |
module.exports = function transformer(file, api) { | |
const j = api.jscodeshift; | |
const root = j(file.source); | |
const HOOKS = { | |
useQuery: { arity: 1 }, |
// Robust patcher for Apollo Client calls: | |
// - Edits client.query({...}) and client.mutate({...}) | |
// - If options arg is an ObjectExpression, casts its `query:` or `mutation:` value to | |
// `TypedDocumentNode<any, any>` and inserts a type-only import. | |
// - If options arg is an Identifier bound to an object literal in the same file, edits that. | |
// - Otherwise, falls back to adding generics to the call: <any, any> | |
// Works with awaited and non-awaited calls. Also tolerates optional chaining. | |
// Run with: --parser=tsx --extensions=ts,tsx | |
module.exports.parser = "tsx"; |
/** | |
* Usage: | |
* npx jscodeshift -t transform-gql-to-graphql.js src \ | |
* --extensions=ts,tsx,js,jsx --gitignore \ | |
* --graphqlImportPath=@/gql | |
* | |
* Options: | |
* --graphqlImportPath=../gql Path to your generated helper (default ../gql) | |
* | |
* What it does: |
function pluralize(count, word) { | |
// Basic pluralization rules | |
const pluralRules = [ | |
{ match: /(?:ch|sh|ss|x|z)$/, replace: "$&es" }, // Matches words ending in ch, sh, ss, x, z | |
{ match: /([^aeiou])y$/, replace: "$1ies" }, // Changes words ending in y preceded by a consonant to ies | |
{ match: /([^aeiou])o$/, replace: "$1oes" }, // Changes words ending in o preceded by a consonant to oes (e.g., hero to heroes) | |
{ match: /is$/, replace: "es" }, // Special case for words ending in is | |
{ match: /([^aeiou]o)$/, replace: "$1es" }, // Special case for words ending in o preceded by a consonant | |
// Add more rules as needed | |
]; |
Compiling proc-macro2 v1.0.49 | |
Compiling quote v1.0.23 | |
Compiling unicode-ident v1.0.6 | |
Compiling syn v1.0.107 | |
Compiling winapi-x86_64-pc-windows-gnu v0.4.0 | |
Compiling libc v0.2.139 | |
Compiling serde_derive v1.0.152 | |
<jemalloc>: MADV_DONTNEED does not work (memset will be used instead) | |
<jemalloc>: (This is the expected behaviour if you are running under QEMU) | |
<jemalloc>: MADV_DONTNEED does not work (memset will be used instead) |
mdl . | ( grep -v "Kramdown Warning: No link definition for link ID '\[\?_toc_\]\?' found on line" || true ) | |
<div class="tos-wrapper"> | |
<h1 class="title">TOS</h1> | |
<div id="count"></div> | |
<div id="tos"></div> | |
</div> |
I hereby claim:
To claim this, I am signing this object: