Converts relative path of a module reference to a default node_module based path.
Input:
import {a, b, c} from '../../../abc'
Output:
import {a, b, c} from 'abc'
tscodemodrc:
{
"name": "normalize-import-path",
"params": {
// name of the module
"module": "abc"
}
}
Migrates imports from one module to another.
Input:
import {a, b, x, xx} from 'ab'
Output:
import {a, b} from 'ab'
import {x, xx} from 'x'
tscodemodrc:
{
"name": "shift-imports",
"params": {
// name of the source module
"from": "ab",
// name of the target module
"to": "x",
// all the import specifiers that should be migrated
"imports": ["x, "xx"]
}
}
Converts a function call that takes an argument of type Array
into a function call where each element of the array is passed as a separate argument.
Input:
myCustomFunction([1, 2, 3])
Output:
myCustomFunction(1, 2, 3)
tscodemodrc:
{
"name": "array-to-rest-params",
"params": {
// name of the function to transform
"functionName": "myCustomFunction"
}
}