
Research
Security News
The Landscape of Malicious Open Source Packages: 2025 Mid‑Year Threat Report
A look at the top trends in how threat actors are weaponizing open source packages to deliver malware and persist across the software supply chain.
eslint-plugin-relay
Advanced tools
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.
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
}
}
`;
eslint-plugin-graphql is a similar package that provides ESLint rules for GraphQL. It supports various GraphQL clients, including Relay, Apollo, and Lokka. While eslint-plugin-relay is specifically tailored for Relay, eslint-plugin-graphql offers broader support for different GraphQL clients, making it more versatile for projects that use multiple GraphQL libraries.
graphql-eslint is another package that offers a comprehensive set of ESLint rules for GraphQL. It provides more extensive linting capabilities for GraphQL schemas and operations, and it can be used with various GraphQL clients. Compared to eslint-plugin-relay, graphql-eslint offers a wider range of rules and is suitable for projects that require detailed GraphQL linting beyond just Relay.
eslint-plugin-relay
is a plugin for ESLint to catch common problems in code using Relay early.
npm i --save-dev eslint-plugin-relay
"relay"
to your eslint plugins
section."relay/graphql-syntax": "error"
to your eslint rules
section, see the example for all rules.Example .eslintrc.js:
module.exports = {
// Other eslint properties here
rules: {
'relay/graphql-syntax': 'error',
'relay/compat-uses-vars': 'warn',
'relay/graphql-naming': 'error',
'relay/generated-flow-types': 'warn',
'relay/no-future-added-value': 'warn',
'relay/unused-fields': 'warn'
},
plugins: ['relay']
};
You can also enable all the recommended or strict rules at once.
Add plugin:relay/recommended
or plugin:relay/strict
in extends
:
{
"extends": [
"plugin:relay/recommended"
]
}
We actively welcome pull requests, learn how to contribute.
eslint-plugin-relay
is MIT licensed.
FAQs
ESLint plugin for Relay.
The npm package eslint-plugin-relay receives a total of 0 weekly downloads. As such, eslint-plugin-relay popularity was classified as not popular.
We found that eslint-plugin-relay demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 6 open source maintainers collaborating on the project.
Did you know?
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.
Research
Security News
A look at the top trends in how threat actors are weaponizing open source packages to deliver malware and persist across the software supply chain.
Security News
ESLint now supports HTML linting with 48 new rules, expanding its language plugin system to cover more of the modern web development stack.
Security News
CISA is discontinuing official RSS support for KEV and cybersecurity alerts, shifting updates to email and social media, disrupting automation workflows.