diff --git a/eslint.config.mjs b/eslint.config.mjs index fb937cc821..374bf28f88 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -35,7 +35,18 @@ export default tseslint.config( { // Need to be in first before any other configuration // https://eslint.org/docs/latest/use/configure/ignore - ignores: ['.github/*', '.idea/*', '/build/*', '/config/*', '/dist/*', 'node_modules/*', 'scripts/utils/dist/*', 'test/performance/data/*', 'test/typescript-support/*'], + ignores: [ + '.github/*', + '.idea/*', + '/build/*', + '/config/*', + '/dist/*', + 'node_modules/*', + 'scripts/shared/types-info.mjs', + 'scripts/utils/dist/*', + 'test/performance/data/*', + 'test/typescript-support/*', + ], }, { diff --git a/scripts/add-license-header.mjs b/scripts/add-license-header.mjs index 987040a4d0..a8d441409b 100644 --- a/scripts/add-license-header.mjs +++ b/scripts/add-license-header.mjs @@ -17,6 +17,7 @@ limitations under the License. import fs, { readFileSync } from 'node:fs'; import { computeBanner } from './shared/banner.mjs'; +// eslint-disable-next-line import/namespace import { getTypeFilesInformation } from './shared/types-info.mjs'; const { notSupportedTSVersionsFilePath, typesFilePath } = getTypeFilesInformation(); diff --git a/scripts/generate-types-for-not-supported-ts-versions.mjs b/scripts/generate-types-for-not-supported-ts-versions.mjs index 0039bd01df..a266efd265 100644 --- a/scripts/generate-types-for-not-supported-ts-versions.mjs +++ b/scripts/generate-types-for-not-supported-ts-versions.mjs @@ -16,6 +16,7 @@ limitations under the License. import * as fs from 'node:fs'; +// eslint-disable-next-line import/namespace import { getTypeFilesInformation } from './shared/types-info.mjs'; // generate a definition file for not supported TS versions. It provokes syntax error to show an explicit message about what are the supported versions. diff --git a/scripts/shared/types-info.mjs b/scripts/shared/types-info.mjs index 01b9dba837..d1014601a0 100644 --- a/scripts/shared/types-info.mjs +++ b/scripts/shared/types-info.mjs @@ -15,10 +15,10 @@ limitations under the License. */ import assert from 'node:assert'; -import { readFileSync } from 'node:fs'; -import path from 'node:path'; -const packageJSON = JSON.parse(readFileSync(path.resolve(__dirname, '../../package.json'), 'utf8')); +// generate warning when running with Node 20 +// (node:75278) ExperimentalWarning: Importing JSON modules is an experimental feature. This feature could change at any time +import packageJSON from '../../package.json' with { type: 'json' }; export const getTypeFilesInformation = () => { const notSupportedTSVersionsFilePath = packageJSON.types;