New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@sprucelabs/eslint-plugin-spruce

Package Overview
Dependencies
Maintainers
10
Versions
154
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sprucelabs/eslint-plugin-spruce - npm Package Compare versions

Comparing version 8.10.1-canary.43 to 8.10.1-canary.44

50

index.js

@@ -29,3 +29,3 @@ const rules = [

!QueryOption.value.name.match(
new RegExp(`.*${rule.suffix}`, 'gi')
new RegExp(`.*${rule.suffix}$`, 'gi')
)

@@ -54,31 +54,31 @@ ) {

},
TemplateLiteral(node) {
// `value` will return up until the `${` (if one exists).
// Bad: { ${
// Good: { {} } ${
// Good: { {} }
const source = context.getSourceCode()
const tokens = source.getTokens(node)
const previousTokens = source.getTokensBefore(node, { count: 1 })
const openBrackets = tokens[0].value.match(/{/gi)
const closeBrackets = tokens[0].value.match(/}/gi)
if (
previousTokens[0].value === 'gql' &&
(openBrackets && openBrackets.length - 1) >
(closeBrackets && closeBrackets.length)
) {
context.report(
node,
'No nested interpolation in GraphQL documents.'
)
}
},
Identifier(node) {
rules.forEach(rule => {
if (node.name.match(new RegExp(`.*${rule.suffix}`, 'gi'))) {
if (node.name.match(new RegExp(`.*${rule.suffix}$`, 'gi'))) {
const source = context.getSourceCode()
const tokens = source.getTokensAfter(node, { count: 3 })
if (
tokens[0].value === '=' &&
tokens[1].value === 'gql' &&
tokens[2].type === 'Template'
) {
// `value` will return up until the `${` (if one exists).
// Bad: { ${
// Good: { {} } ${
// Good: { {} }
const openBrackets = tokens[2].value.match(/{/gi)
const closeBrackets = tokens[2].value.match(/}/gi)
if (
(openBrackets && openBrackets.length - 1) >
(closeBrackets && closeBrackets.length)
) {
context.report(
node,
'No nested interpolation in GraphQL documents.'
)
}
}
if (tokens[0].value === '=' && tokens[1].type === 'Template') {

@@ -85,0 +85,0 @@ context.report(

@@ -6,3 +6,3 @@ {

},
"version": "8.10.1-canary.43+421ecfef",
"version": "8.10.1-canary.44+8a2e00f8",
"description": "ESLint plugin for Spruce Javascript projects",

@@ -21,3 +21,3 @@ "author": "George Pantazis <gcpantazis@gmail.com>",

},
"gitHead": "421ecfef7423c3d5df7999a91fd0ba79aea153f7"
"gitHead": "8a2e00f84491aa3ebaea124fb3dcf9acb3cafe71"
}
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