Skip to content

Latest commit

 

History

History
43 lines (27 loc) · 1016 Bytes

File metadata and controls

43 lines (27 loc) · 1016 Bytes

Disallow direct import of axios (@ezylab/no-axios-import)

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

Disallows direct import of axios and suggests using 'Utils/api' instead.

Rule Details

This rule aims to prevent direct imports of axios.

Examples of incorrect code for this rule:

import axios from "axios";

Examples of correct code for this rule:

import callApi from "Utils/api";

Options

This rule has an options to specify the importPath of the api util file.

{
    "rules": {
        "@ezylab/no-axios-import": ["error", { "importPath": "custom/path" }]
    }
}

When Not To Use It

If you think that it is fine to use axios directly in your code, you can disable this rule.

Further Reading

If there are other links that describe the issue this rule addresses, please include them here in a bulleted list.