-
-
Notifications
You must be signed in to change notification settings - Fork 293
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
Extending eslint-plugin-svelte/recommended
throws a Converting circular structure to JSON
error
#773
Comments
As a workaround, I replaced const eslintPluginSvelte = require('eslint-plugin-svelte');
/** @type {import('xo').Options} */
const config = {
extensions: ['svelte'],
plugins: ['svelte'],
overrides: [
{
files: ['*.svelte', '**/*.svelte', '**/*.svelte.js', '*.svelte.js'],
processor: 'svelte/svelte',
parser: 'svelte-eslint-parser',
envs: ['browser'],
rules: Object.assign({}, ...eslintPluginSvelte.configs.recommended.flatMap(({rules}) => rules)),
},
],
};
module.exports = config; This works, by replacing the The above bears little resemblance to the example configuration described in import eslintPluginSvelte from 'eslint-plugin-svelte';
export default [
...eslintPluginSvelte.configs.recommended,
]; Perhaps xo should align with the new style of eslint config files, or there should be more documentation and examples in xo’s docs of how to translate configurations such as this one into xo’s config file schema. |
Update: There’s an issue with the workaround, in that it doesn’t work with https://github.com/xojs/vscode-linter-xo, the xo extension for Visual Studio Code. As of today, VS Code runs Node.js 20.18.1 internally, which doesn’t support The |
Thanks - this is a known issue related to the eslint 9/flat config upgrade as we are still waiting for dependents of xo to become compatible. I think the last blocker is the eslint prettier config we rely on for prettier support. The update is a long time WIP and thanks for your patience 🙏🏻 |
Thanks so much for your work on this library. I dug through the code to try to find a fix to propose but I came up empty. I don’t use Prettier; is there a way to use this updated xo without Prettier support, but hopefully with support for flat config and ESM dependents? |
Using
"extends": "plugin:eslint-plugin-svelte/recommended"
with[email protected]
throws aConverting circular structure to JSON
error. Perhaps something related to legacy vs flat config?Steps to reproduce
Create a new blank SvelteKit app and answer the prompts as shown:
Now add xo:
So far so good, but we aren’t linting Svelte files yet. Let’s add
eslint-plugin-svelte@next
(the@next
is for Svelte 5 support) and configure xo to use it:Edit the newly created
.xo-config.json
to include the following, adapted from https://github.com/sveltejs/eslint-plugin-svelte#configuration:Now
npx xo
returns:Removing the
"extends": "plugin:eslint-plugin-svelte/recommended"
line makes the error go away, but linting of Svelte files breaks.The text was updated successfully, but these errors were encountered: