Pattern: Use of relative path for aliased module
Issue: -
Allows you to enforce that aliased modules are not using relative paths.
Given the babel configuration below
...
"plugins": [
[
"module-resolver",
{
"root": ["."],
"alias": {
"action": "./actions"
}
}
]
]
...
The following patterns are considered warnings:
import fetchData from '../../actions/fetchData'
const fetchData = require('../../actions/fetchData')
const fetchData = await import('../../actions/fetchData')
The following patterns are not considered warnings:
import fetchData from 'actions/fetchData'
const fetchData = require('actions/fetchData')
const fetchData = await import('actions/fetchData')