-
-
Notifications
You must be signed in to change notification settings - Fork 292
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? |
If you want to beta test the flat-xo implementation I have been working on I went ahead and published a version. Since I made it a complete re-write I worked on it in a separate repo just for my convenience. When I started I wasn't sure I would ever get it to completion. https://github.com/spence-s/flat-xo If you want to use with the xo editor extension, do this in package.json:
The documentation is somewhat up to date, but may still need some tweaking so a few misleading things may be there. It can only be configured now with an It mostly works but there is still some bugs around tsconfig resolution, so for ts, you must have the files included in your tsconfig for the extension to work. There may be some minor API and CLI changes coming soon, I am working on getting a PR together for If you have trouble with it, file an issue over in that repo and it will be a great help! cc: @fregante @sindresorhus - if you have interest in beta testing and providing feedback, I will be working on opening a PR this weekend. |
Also note that the editor extension accepts a path to a nodejs binary as an option so you can run xo with your node version and not the default version bundled with vscode.
so you should still be able to use your work around if you'd rather. |
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: