Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

fake-tag

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fake-tag - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

26

changelog.md
# fake-tag changelog
## 0.1.0
## 1.0.1
* Initial release.
### Patch
- Updated dev dependencies.
- Removed [`husky`](https://npm.im/husky) and [`lint-staged`](https://npm.im/lint-staged).
- Replaced old ESLint config with [`eslint-config-env`](https://npm.im/eslint-config-env).
- Use [`test-director`](https://npm.im/test-director) instead of [`ava`](https://npm.im/ava) for tests.
- Updated the package description.
- Simplified the package `repository` field.
- Added a package `main` field.
- Added a package `engines` field declaring support for Node.js >= v8.10, as that is what ESLint supports. This only limits the dev environment; the published code is very simple and should be able to run almost anywhere.
- Added a package `browserslist` field, for linting.
- Moved dev tool config from `package.json` to separate files to reduce the published package size.
- Updated package scripts.
- Ensure Prettier also lints `.yml` files.
- Replaced Travis with GitHub Actions for CI.
- Removed `package-lock.json` from the `.gitignore` file, as it has been disabled anyway.
- Removed some readme badges, and used [badgen.net](https://badgen.net) instead of [shields.io](https://shields.io) for the npm version badge.
- Updated the readme with more details, links, and a typo fix.
- Corrected the first version number in the changelog from `0.1.0` to `1.0.0`.
## 1.0.0
- Initial release.

73

package.json
{
"name": "fake-tag",
"version": "1.0.0",
"description": "A fake template literal tag to trick linters and formatters into action.",
"version": "1.0.1",
"description": "A fake template literal tag to trick syntax highlighters, linters and formatters into action.",
"license": "MIT",

@@ -11,6 +11,3 @@ "author": {

},
"repository": {
"type": "git",
"url": "https://github.com/jaydenseric/fake-tag.git"
},
"repository": "github:jaydenseric/fake-tag",
"homepage": "https://github.com/jaydenseric/fake-tag#readme",

@@ -30,49 +27,27 @@ "bugs": "https://github.com/jaydenseric/fake-tag/issues",

],
"main": "index.js",
"engines": {
"node": ">=8.10"
},
"browserslist": "> 0.2%, not dead, not OperaMini all",
"devDependencies": {
"ava": "^1.0.0-beta.4",
"eslint": "^4.19.1",
"eslint-plugin-ava": "^4.5.1",
"eslint-plugin-prettier": "^2.5.0",
"husky": "^0.14.3",
"lint-staged": "^7.0.4",
"prettier": "^1.12.1"
"eslint": "^6.6.0",
"eslint-config-env": "^11.0.0",
"eslint-config-prettier": "^6.5.0",
"eslint-plugin-compat": "^3.3.0",
"eslint-plugin-import": "^2.18.2",
"eslint-plugin-import-order-alphabetical": "^1.0.0",
"eslint-plugin-jsdoc": "^17.1.2",
"eslint-plugin-node": "^10.0.0",
"eslint-plugin-prettier": "^3.1.1",
"prettier": "^1.19.1",
"test-director": "^1.0.0"
},
"scripts": {
"lint": "eslint . --fix && prettier '**/*.{json,md}' --write",
"test": "ava",
"watch": "ava -w",
"precommit": "lint-staged",
"prepublishOnly": "npm run lint && npm test"
},
"lint-staged": {
"*.js": "eslint",
"*.{json,md}": "prettier -l"
},
"eslintConfig": {
"env": {
"es6": true,
"node": true,
"browser": true
},
"extends": [
"eslint:recommended",
"plugin:ava/recommended"
],
"plugins": [
"ava",
"prettier"
],
"rules": {
"curly": [
"error",
"multi"
],
"prettier/prettier": "error"
}
},
"prettier": {
"proseWrap": "never",
"singleQuote": true,
"semi": false
"test": "npm run test:eslint && npm run test:prettier && npm run test:api",
"test:eslint": "eslint .",
"test:prettier": "prettier '**/*.{json,yml,md}' -l",
"test:api": "node test",
"prepublishOnly": "npm test"
}
}
# fake-tag
[![npm version](https://img.shields.io/npm/v/fake-tag.svg)](https://npm.im/fake-tag) ![Licence](https://img.shields.io/npm/l/fake-tag.svg) [![Github issues](https://img.shields.io/github/issues/jaydenseric/fake-tag.svg)](https://github.com/jaydenseric/fake-tag/issues) [![Github stars](https://img.shields.io/github/stars/jaydenseric/fake-tag.svg)](https://github.com/jaydenseric/fake-tag/stargazers) [![Travis status](https://img.shields.io/travis/jaydenseric/fake-tag.svg)](https://travis-ci.org/jaydenseric/fake-tag)
[![npm version](https://badgen.net/npm/v/fake-tag)](https://npm.im/fake-tag) [![CI status](https://github.com/jaydenseric/fake-tag/workflows/CI/badge.svg)](https://github.com/jaydenseric/fake-tag/actions)
A fake template literal tag to trick linters and formatters into action. Interpolations and escapes are tested.
A fake template literal tag to trick syntax highlighters, linters and formatters into action. Interpolations and escapes are tested.
This hack will be redundant once comment tags are supported by tools [such as Prettier](https://github.com/prettier/prettier/issues/4360):
## Setup
<!-- prettier-ignore -->
```js
/* GraphQL */`
{
foo
}
`
```
## Install
Install with [npm](https://npmjs.com):

@@ -42,6 +31,40 @@

Names other than `gql` can be used for other use cases.
## Why not comment tags?
A comment tag looks like this:
```js
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](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).
## Why not `String.raw`?
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:
This may be temptingly simple:
```js
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:
```diff

@@ -48,0 +71,0 @@ "A foo."

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc