diff --git a/.changeset/healthy-moose-kneel.md b/.changeset/healthy-moose-kneel.md new file mode 100644 index 00000000000..125fd52c0f7 --- /dev/null +++ b/.changeset/healthy-moose-kneel.md @@ -0,0 +1,7 @@ +--- +"@graphql-eslint/eslint-plugin": patch +--- + +The import attribute syntax (with { type: "json" }) is still experimental so warnings showed up when using the library as it was being used to import the package.json file to extract the package version + +As an alternative, the current version will be injected on build time through tsup configuration. diff --git a/packages/plugin/__tests__/examples.spec.ts b/packages/plugin/__tests__/examples.spec.ts index f6990885db2..fa7ca770d59 100644 --- a/packages/plugin/__tests__/examples.spec.ts +++ b/packages/plugin/__tests__/examples.spec.ts @@ -22,14 +22,10 @@ function getESLintOutput(cwd: string): ESLint.LintResult[] { const errorOutput = stderr .toString() .replace( - /\(node:\d{4,5}\) ExperimentalWarning: Importing JSON modules is an experimental feature and might change at any time/, + /\(node:\d{4,7}\) \[DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead./, '', ) - .replace( - /\(node:\d{4,5}\) \[DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead./, - '', - ) - .replace('(Use `node --trace-warnings ...` to show where the warning was created)', '') + .replace('(Use `node --trace-deprecation ...` to show where the warning was created)', '') .trimEnd(); if (errorOutput) { throw new Error(errorOutput); diff --git a/packages/plugin/src/meta.ts b/packages/plugin/src/meta.ts index 50aebe6bca1..39a9cca11b7 100644 --- a/packages/plugin/src/meta.ts +++ b/packages/plugin/src/meta.ts @@ -1,3 +1 @@ -import packageJson from '../package.json' with { type: 'json' }; - -export const { version } = packageJson; +export const version = process.env.VERSION diff --git a/packages/plugin/tsup.config.ts b/packages/plugin/tsup.config.ts index d8c8e06479d..ec995dba8c6 100644 --- a/packages/plugin/tsup.config.ts +++ b/packages/plugin/tsup.config.ts @@ -10,6 +10,7 @@ const opts: Options = { dts: true, env: { ...(process.env.NODE_ENV && { NODE_ENV: process.env.NODE_ENV }), + VERSION: packageJson.version, }, format: 'esm', minifySyntax: true,