{"id":13524653,"url":"https://github.com/jaydenseric/fake-tag","last_synced_at":"2025-04-14T19:52:46.009Z","repository":{"id":32092519,"uuid":"131552000","full_name":"jaydenseric/fake-tag","owner":"jaydenseric","description":"A fake template literal tag to trick syntax highlighters, linters and formatters into action.","archived":false,"fork":false,"pushed_at":"2022-08-20T04:09:44.000Z","size":60,"stargazers_count":34,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-28T08:11:54.242Z","etag":null,"topics":["maintained","node","npm","typescript"],"latest_commit_sha":null,"homepage":"https://npm.im/fake-tag","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jaydenseric.png","metadata":{"files":{"readme":"readme.md","changelog":"changelog.md","contributing":null,"funding":".github/funding.yml","license":"license.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":"jaydenseric"}},"created_at":"2018-04-30T03:28:44.000Z","updated_at":"2025-01-03T13:56:56.000Z","dependencies_parsed_at":"2022-08-07T17:15:16.386Z","dependency_job_id":null,"html_url":"https://github.com/jaydenseric/fake-tag","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaydenseric%2Ffake-tag","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaydenseric%2Ffake-tag/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaydenseric%2Ffake-tag/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaydenseric%2Ffake-tag/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jaydenseric","download_url":"https://codeload.github.com/jaydenseric/fake-tag/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248631686,"owners_count":21136562,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["maintained","node","npm","typescript"],"created_at":"2024-08-01T06:01:12.136Z","updated_at":"2025-04-14T19:52:45.972Z","avatar_url":"https://github.com/jaydenseric.png","language":"JavaScript","funding_links":["https://github.com/sponsors/jaydenseric"],"categories":["JavaScript"],"sub_categories":[],"readme":"# fake-tag\n\nA fake template literal tag to trick syntax highlighters, linters and formatters into action. Interpolations and escapes are tested.\n\n## Installation\n\nFor [Node.js](https://nodejs.org), to install [`fake-tag`](https://npm.im/fake-tag) with [npm](https://npmjs.com/get-npm), run:\n\n```sh\nnpm install fake-tag\n```\n\nFor [Deno](https://deno.land) and browsers, an example import map:\n\n```json\n{\n  \"imports\": {\n    \"fake-tag\": \"https://unpkg.com/fake-tag@5.0.0/fakeTag.mjs\"\n  }\n}\n```\n\nThen, import and use the template literal tag [`fakeTag`](./fakeTag.mjs).\n\n## Examples\n\nTagging a [GraphQL](https://graphql.org) SDL string with `gql`:\n\n```js\nimport gql from \"fake-tag\";\n\nconst typeDefs = gql`\n  \"A foo.\"\n  type Foo {\n    \"The \\`Foo\\` ID.\"\n    id: ID!\n  }\n`;\n```\n\n## Requirements\n\nSupported runtime environments:\n\n- [Node.js](https://nodejs.org) versions `^14.17.0 || ^16.0.0 || \u003e= 18.0.0`.\n- [Deno](https://deno.land).\n- Browsers matching the [Browserslist](https://browsersl.ist) query [`\u003e 0.5%, not OperaMini all, not dead`](https://browsersl.ist/?q=%3E+0.5%25%2C+not+OperaMini+all%2C+not+dead).\n\nNon [Deno](https://deno.land) projects must configure [TypeScript](https://typescriptlang.org) to use types from the ECMAScript modules that have a `// @ts-check` comment:\n\n- [`compilerOptions.allowJs`](https://typescriptlang.org/tsconfig#allowJs) should be `true`.\n- [`compilerOptions.maxNodeModuleJsDepth`](https://typescriptlang.org/tsconfig#maxNodeModuleJsDepth) should be reasonably large, e.g. `10`.\n- [`compilerOptions.module`](https://typescriptlang.org/tsconfig#module) should be `\"node16\"` or `\"nodenext\"`.\n\n## Exports\n\nThe [npm](https://npmjs.com) package [`fake-tag`](https://npm.im/fake-tag) features [optimal JavaScript module design](https://jaydenseric.com/blog/optimal-javascript-module-design). These ECMAScript modules are exported via the [`package.json`](./package.json) field [`exports`](https://nodejs.org/api/packages.html#exports):\n\n- [`fakeTag.mjs`](./fakeTag.mjs)\n\n## FAQ\n\n### Why not comment tags?\n\nA comment tag looks like this:\n\n```js\nconst QUERY = /* GraphQL */ `\n  {\n    foo\n  }\n`;\n```\n\nThey are far superior to a fake tag:\n\n- No dependency to manage.\n- No inconvenient imports.\n- No bundle size bloat.\n- No runtime overhead.\n\nUnfortunately not all tools support them yet. [`prettier` has since v1.13.0](https://github.com/prettier/prettier/issues/4360#issuecomment-392391729), but [`eslint-plugin-graphql` at v3.1.0 still doesn’t](https://github.com/apollographql/eslint-plugin-graphql/issues/224).\n\n### Why not `String.raw`?\n\nThis may be temptingly simple:\n\n```js\nconst gql = String.raw;\nconst QUERY = gql`\n  {\n    foo\n  }\n`;\n```\n\nHowever, it doesn’t unescape characters. For the usage example, if you `console.log(typeDefs)` before and after replacing the import with `const gql = String.raw` you will see the difference in the type description markdown:\n\n```diff\n    \"A foo.\"\n    type Foo {\n-     \"The `Foo` ID.\"\n+     \"The \\`Foo\\` ID.\"\n      id: ID!\n    }\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaydenseric%2Ffake-tag","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjaydenseric%2Ffake-tag","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaydenseric%2Ffake-tag/lists"}