Closed
Description
currently all node-modules are imported like import { dirname, join } from 'path'
for maintainability, this could be optimized:
- group built-in modules and 3rd part modules
- prefix built-in modules
example result
from
import * as CDX from '@cyclonedx/cyclonedx-library'
import { readdirSync, readFileSync } from 'fs'
import * as normalizePackageJson from 'normalize-package-data'
import { dirname, join } from 'path'
to
import { readdirSync, readFileSync } from 'node:fs'
import { dirname, join } from 'node:path'
import * as CDX from '@cyclonedx/cyclonedx-library'
import * as normalizePackageJson from 'normalize-package-data'
enforcement
maybe there is a eslint
rule for this? import-js/eslint-plugin-import#2717
risks and problems:
the following section became obsolete due to #1209
the lib supports node versions that do not know the node-colon(node:
) prefix.
this can be "fixed" on compile time. (untested):
{
"compilerOptions": {
"baseUrl": ".",
"paths": {
"node:*": ["*"]
}
}
}
Metadata
Metadata
Assignees
Labels
No labels