🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Sign inDemoInstall
Socket

eslint-plugin-relay

Package Overview
Dependencies
Maintainers
9
Versions
60
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-relay

ESLint plugin for Relay.

1.8.2
Source
npm
Version published
Weekly downloads
0
Maintainers
9
Weekly downloads
 
Created

What is eslint-plugin-relay?

eslint-plugin-relay is an ESLint plugin that provides linting rules for Relay, a JavaScript framework for building data-driven React applications. It helps ensure that your Relay code follows best practices and is free of common errors.

What are eslint-plugin-relay's main functionalities?

GraphQL Template Literal Linting

This feature ensures that GraphQL template literals are correctly formatted and syntactically valid. The rule checks for common mistakes in GraphQL queries embedded in JavaScript code.

/* eslint relay/graphql-syntax: 'error' */
const query = graphql`
  query UserQuery {
    user(id: "4") {
      name
    }
  }
`;

Compat Mode

This feature helps in transitioning to Relay Modern by ensuring that variables used in compat mode are correctly handled. It warns about potential issues when using older Relay Classic fragments with Relay Modern.

/* eslint relay/compat-uses-vars: 'warn' */
const fragment = graphql`
  fragment UserFragment on User {
    id
    name
  }
`;

No Unused Variables

This rule checks for unused variables in GraphQL queries, helping to keep the code clean and efficient by ensuring that all declared variables are used in the query.

/* eslint relay/no-unused-variables: 'error' */
const query = graphql`
  query UserQuery($id: ID!) {
    user(id: $id) {
      name
    }
  }
`;

Other packages similar to eslint-plugin-relay

FAQs

Package last updated on 05 Feb 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts