jaydenseric / Fake Tag
A fake template literal tag to trick syntax highlighters, linters and formatters into action.
Stars: ✭ 22
Programming Languages
javascript
184084 projects - #8 most used programming language
Projects that are alternatives of or similar to Fake Tag
Minimal Feedback
🗳 minimal-feedback is a blazingly fast and highly customizable component to get user feedback.
Stars: ✭ 78 (+254.55%)
Mutual labels: featured, npm
Graphql Upload
Middleware and an Upload scalar to add support for GraphQL multipart requests (file uploads via queries and mutations) to various Node.js GraphQL servers.
Stars: ✭ 1,071 (+4768.18%)
Mutual labels: featured, npm
Graphql Multipart Request Spec
A spec for GraphQL multipart form requests (file uploads).
Stars: ✭ 622 (+2727.27%)
Mutual labels: featured
Npm Font Open Sans
npm package of Open Sans (incl. CSS/LESS/SCSS)
Stars: ✭ 6 (-72.73%)
Mutual labels: npm
Npm Check Updates
Find newer versions of package dependencies than what your package.json allows
Stars: ✭ 6,617 (+29977.27%)
Mutual labels: npm
Showdown Htmlescape
Plugin for Showdown to prevent the use of arbitrary HTML and allow only the specific Markdown syntax.
Stars: ✭ 6 (-72.73%)
Mutual labels: npm
Lerna
Splitting up large codebases into separate independently versioned packages
is extremely useful for code sharing. However, making changes across many
repositories is messy and difficult to track, and testing across repositories
becomes complicated very quickly.
Stars: ✭ 31,079 (+141168.18%)
Mutual labels: npm
Rando.js
The world's easiest, most powerful random function.
Stars: ✭ 659 (+2895.45%)
Mutual labels: npm
Shrinkpack
Fast, resilient, reproducible builds with npm install.
Stars: ✭ 774 (+3418.18%)
Mutual labels: npm
Simplestatemanager
A responsive state manager which allows you to run different javascript at different browser widths
Stars: ✭ 632 (+2772.73%)
Mutual labels: npm
Declarativ
A declarative HTML rendering library that is definitely not JSX.
Stars: ✭ 16 (-27.27%)
Mutual labels: npm
Django Drip
💧 Use Django admin to manage drip campaign emails using querysets on Django's User model.
Stars: ✭ 620 (+2718.18%)
Mutual labels: featured
Autodeploy
🚀 Autodeploy is a small and highly customizable CLI-Tool to automatically deploy your git repo and execute arbitrary commands/scripts after a specific git action (e.g. push, merge, ...)
Stars: ✭ 20 (-9.09%)
Mutual labels: npm
fake-tag
A fake template literal tag to trick syntax highlighters, linters and formatters into action. Interpolations and escapes are tested.
Setup
Install with npm:
npm install fake-tag
Usage
Import and use the tag with the required name:
import gql from 'fake-tag'
const typeDefs = gql`
"A foo."
type Foo {
"The \`Foo\` ID."
id: ID!
}
`
Names other than gql
can be used for other use cases.
Why not comment tags?
A comment tag looks like this:
const QUERY = /* GraphQL */ `
{
foo
}
`
They are far superior to a fake tag:
- No dependency to manage.
- No inconvenient imports.
- No bundle size bloat.
- No runtime overhead.
Unfortunately not all tools support them yet. prettier
has since v1.13.0, but eslint-plugin-graphql
at v3.1.0 still doesn’t.
String.raw
?
Why not This may be temptingly simple:
const gql = String.raw
const QUERY = gql`
{
foo
}
`
However, 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:
"A foo."
type Foo {
- "The `Foo` ID."
+ "The \`Foo\` ID."
id: ID!
}
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].