Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: Converting circular structure to JSON #243

Closed
moltar opened this issue Mar 11, 2024 · 3 comments
Closed

TypeError: Converting circular structure to JSON #243

moltar opened this issue Mar 11, 2024 · 3 comments

Comments

@moltar
Copy link

moltar commented Mar 11, 2024

After upgrading from 3.0.1 to 4.0.1 I've started to get the following error:

Oops! Something went wrong! :(

ESLint: 8.57.0

TypeError: Converting circular structure to JSON
    --> starting at object with constructor 'Array'
    |     index 0 -> object with constructor 'Object'
    |     property 'plugins' -> object with constructor 'Object'
    |     ...
    |     property 'configs' -> object with constructor 'Object'
    --- property 'recommended' closes the circle
Referenced from: /prj/.eslintrc.json
    at JSON.stringify (<anonymous>)
    at /prj/node_modules/.pnpm/@[email protected]/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:2156:45
    at Array.map (<anonymous>)
    at ConfigValidator.formatErrors (/prj/node_modules/.pnpm/@[email protected]/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:2147:23)
    at ConfigValidator.validateConfigSchema (/prj/node_modules/.pnpm/@[email protected]/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:2177:84)
    at ConfigArrayFactory._normalizeConfigData (/prj/node_modules/.pnpm/@[email protected]/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:3019:19)
    at ConfigArrayFactory._loadExtendedPluginConfig (/prj/node_modules/.pnpm/@[email protected]/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:3239:25)
    at ConfigArrayFactory._loadExtends (/prj/node_modules/.pnpm/@[email protected]/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:3154:29)
    at ConfigArrayFactory._normalizeObjectConfigDataBody (/prj/node_modules/.pnpm/@[email protected]/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:3095:25)
    at _normalizeObjectConfigDataBody.next (<anonymous>)

Is this the expected behaviour due to flat config change?


Simplified config:

{
  "env": {
    "jest": true,
    "node": true
  },
  "root": true,
  "plugins": [
    "markdown"
  ],
  "overrides": [
    {
      "extends": [
        "plugin:markdown/recommended"
      ],
      "files": [
        "**/*.md"
      ],
      "processor": "markdown/markdown"
    },
    {
      "files": [
        "**/*.md/*.+(cjs|cts|js|jsx|mjs|mts|ts|tsx)"
      ],
      "rules": {

      },
      "parserOptions": {
        "project": false
      }
    },
  ]
}
@eslintbot eslintbot added this to Triage Mar 11, 2024
@github-project-automation github-project-automation bot moved this to Needs Triage in Triage Mar 11, 2024
@mdjermanovic
Copy link
Member

Hi @moltar, thanks for the issue!

recommended config is now in the new flat config format. Since you're using eslintrc config format, can you try with plugin:markdown/recommended-legacy:

{
  "env": {
    "jest": true,
    "node": true
  },
  "root": true,
  "plugins": [
    "markdown"
  ],
  "overrides": [
    {
      "extends": [
-       "plugin:markdown/recommended"
+       "plugin:markdown/recommended-legacy"
      ],
      "files": [
        "**/*.md"
      ],
      "processor": "markdown/markdown"
    },
    {
      "files": [
        "**/*.md/*.+(cjs|cts|js|jsx|mjs|mts|ts|tsx)"
      ],
      "rules": {

      },
      "parserOptions": {
        "project": false
      }
    },
  ]
}

https://github.com/eslint/eslint-plugin-markdown?tab=readme-ov-file#configuring

@simlu
Copy link
Contributor

simlu commented Mar 11, 2024

That fixed it. Could this be handled without forced changes? I.e. could the way this is important be automatically detected?

@mdjermanovic
Copy link
Member

No, plugin:markdown/recommended is just a reference to configs.recommended configuration from the markdown plugin, which is now in a different format.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

No branches or pull requests

3 participants