Skip to content

Latest commit

 

History

History
35 lines (22 loc) · 1.13 KB

unused-operations.md

File metadata and controls

35 lines (22 loc) · 1.13 KB

Detect unused GraphQL operations (graphql-unused-operations/unused-operations)

🔧 This rule is automatically fixable by the --fix CLI option.

Rule Details

This rule aims to detect unused GraphQL operations and report them. If you import a GraphQL operation but never utilize it in your code, this rule will inform you so you can clean up unused code and keep your application lean.

Examples

Incorrect

import myOperation from './somePath.graphql';

Correct

import myOperation from './somePath.graphql';
function someFunction() {
    useMyOperationQuery();
}

When Not To Use It

If you have a particular reason for keeping unused GraphQL operations in your codebase (perhaps for future implementation or for documentation purposes), you might want to disable this rule in those specific files or scenarios.

Further Reading