eslint-plugin-relay
ESLint plugin for Relay.
Last updated 4 years ago by xiaobu .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install eslint-plugin-relay 
SYNC missed versions from official npm registry.

eslint-plugin-relay Build Status npm version

eslint-plugin-relay is a plugin for ESLint to catch common problems in code using Relay early.

Install

npm i --save-dev eslint-plugin-relay

How To Use

  1. Add "relay" to your eslint plugins section.
  2. Add the relay rules such as "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/must-colocate-fragment-spreads': 'warn',
    'relay/no-future-added-value': 'warn',
    'relay/unused-fields': 'warn',
    'relay/function-required-argument': 'warn',
    'relay/hook-required-argument': '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"
  ]
}

Suppressing rules within graphql tags

The following rules support suppression within graphql tags:

  • relay/unused-fields
  • relay/must-colocate-fragment-spreads

Supported rules can be suppressed by adding # eslint-disable-next-line relay/name-of-rule to the preceding line:

graphql`fragment foo on Page {
  # eslint-disable-next-line relay/must-colocate-fragment-spreads
  ...unused1
}`

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.

Contribute

We actively welcome pull requests, learn how to contribute.

License

eslint-plugin-relay is MIT licensed.

Current Tags

  • 1.8.3                                ...           latest (4 years ago)

54 Versions

  • 1.8.3                                ...           4 years ago
  • 1.8.2                                ...           5 years ago
  • 1.8.1                                ...           6 years ago
  • 1.8.0                                ...           6 years ago
  • 1.7.1                                ...           6 years ago
  • 1.7.0                                ...           6 years ago
  • 1.6.0                                ...           6 years ago
  • 1.5.0                                ...           6 years ago
  • 1.4.1                                ...           6 years ago
  • 1.4.0                                ...           6 years ago
  • 1.3.12                                ...           7 years ago
  • 1.3.11                                ...           7 years ago
  • 1.3.10                                ...           7 years ago
  • 1.3.9                                ...           7 years ago
  • 1.3.8                                ...           7 years ago
  • 1.3.7                                ...           7 years ago
  • 1.3.6                                ...           7 years ago
  • 1.3.5                                ...           7 years ago
  • 1.3.4                                ...           7 years ago
  • 1.3.3                                ...           7 years ago
  • 1.3.2                                ...           7 years ago
  • 1.3.1                                ...           7 years ago
  • 1.3.0                                ...           7 years ago
  • 1.2.0                                ...           7 years ago
  • 1.1.0                                ...           7 years ago
  • 1.0.0                                ...           7 years ago
  • 0.0.28                                ...           8 years ago
  • 0.0.27                                ...           8 years ago
  • 0.0.26                                ...           8 years ago
  • 0.0.25                                ...           8 years ago
  • 0.0.24                                ...           8 years ago
  • 0.0.23                                ...           8 years ago
  • 0.0.22                                ...           8 years ago
  • 0.0.21                                ...           8 years ago
  • 0.0.20                                ...           8 years ago
  • 0.0.19                                ...           9 years ago
  • 0.0.18                                ...           9 years ago
  • 0.0.17                                ...           9 years ago
  • 0.0.16                                ...           9 years ago
  • 0.0.15                                ...           9 years ago
  • 0.0.14                                ...           9 years ago
  • 0.0.13                                ...           9 years ago
  • 0.0.12                                ...           9 years ago
  • 0.0.11                                ...           9 years ago
  • 0.0.10                                ...           9 years ago
  • 0.0.9                                ...           9 years ago
  • 0.0.8                                ...           9 years ago
  • 0.0.7                                ...           9 years ago
  • 0.0.6                                ...           9 years ago
  • 0.0.5                                ...           9 years ago
  • 0.0.4                                ...           9 years ago
  • 0.0.3                                ...           9 years ago
  • 0.0.2                                ...           9 years ago
  • 0.0.1                                ...           9 years ago
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 23
Dependencies (1)
Dev Dependencies (6)
Dependents (1)

Copyright 2013 - present © cnpmjs.org | Home |