Gathering detailed insights and metrics for eslint-plugin-relay
Gathering detailed insights and metrics for eslint-plugin-relay
Gathering detailed insights and metrics for eslint-plugin-relay
Gathering detailed insights and metrics for eslint-plugin-relay
@kbjz/eslint-plugin-relay
ESLint plugin for Relay.
eslint-plugin-relay-ds
ESLint plugin for Relay.
eslint-plugin-relay-imports
ESLint plugin to check Flow type imports from files generated by the Relay Compiler
eslint-plugin-relay-fragments
ESLint plugin to improve the quality of your Relay fragment declarations.
A plugin for the code linter ESLint to lint specific details about Relay.
npm install eslint-plugin-relay
Typescript
Module System
Node Version
NPM Version
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
104 Stars
267 Commits
50 Forks
17 Watchers
5 Branches
33 Contributors
Updated on Jul 03, 2025
Latest Version
2.0.0
Package Id
eslint-plugin-relay@2.0.0
Unpacked Size
63.92 kB
Size
14.15 kB
File Count
13
NPM Version
10.9.2
Node Version
22.15.0
Published on
May 12, 2025
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
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:
1module.exports = { 2 // Other eslint properties here 3 rules: { 4 'relay/graphql-syntax': 'error', 5 'relay/graphql-naming': 'error', 6 'relay/must-colocate-fragment-spreads': 'warn', 7 'relay/no-future-added-value': 'warn', 8 'relay/unused-fields': 'warn', 9 'relay/function-required-argument': 'warn', 10 'relay/hook-required-argument': 'warn' 11 }, 12 plugins: ['relay'] 13};
You can also enable all the recommended or strict rules at once.
Add plugin:relay/recommended
or plugin:relay/strict
in extends
:
1{ 2 "extends": [ 3 "plugin:relay/recommended" 4 ] 5}
Brief descriptions for each rule:
relay/graphql-syntax
: Ensures each graphql\
`` tagged template literal contains syntactically valid GraphQL. This is also validated by the Relay Compiler, but the ESLint plugin can often provide faster feedback.relay/graphql-naming
: Ensures GraphQL fragments and queries follow Relay's naming conventions. This is also validated by the Relay Compiler, but the ESLint plugin can often provide faster feedback.relay/no-future-added-value
: Ensures code does not try to explicitly handle the "%future added value"
enum variant which Relay inserts as a placeholder to ensure you handle the possibility that new enum variants may be added by the server after your application has been deployed.relay/unused-fields
: Ensures that every GraphQL field referenced is used within the module that includes it. This helps enable Relay's optimal data fetchingrelay/function-required-argument
: Ensures that readInlineData
is always passed an explicit argument even though that argument is allowed to be undefined
at runtime.relay/hook-required-argument
: Ensures that Relay hooks are always passed an explicit argument even though that argument is allowed to be undefined
at runtime.relay/must-colocate-fragment-spreads
: Ensures that when a fragment spread is added within a module, that module directly imports the module which defines that fragment. This prevents the anti-pattern when one component fetches a fragment that is not used by a direct child component. Note: This rule leans heavily on Meta's globally unique module names. It likely won't work well in other environments.The following rules support suppression within graphql tags:
Supported rules can be suppressed by adding # eslint-disable-next-line relay/name-of-rule
to the preceding line:
1graphql` 2 fragment foo on Page { 3 # eslint-disable-next-line relay/must-colocate-fragment-spreads 4 ...unused1 5 } 6`;
Note that only the eslint-disable-next-line
form of suppression works. eslint-disable-line
doesn't currently work until graphql-js provides support for parsing Comment nodes in their AST.
We actively welcome pull requests, learn how to contribute.
eslint-plugin-relay
is MIT licensed.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
license file detected
Details
Reason
Found 9/10 approved changesets -- score normalized to 9
Reason
7 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 5
Reason
6 existing vulnerabilities detected
Details
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More