Skip to content

Linting SVG files fails on GitHub Actions CI only #750

@thasmo

Description

@thasmo

Describe the bug

Running eslint in GitHub CI fails for all SVGs:

It seems it happens if @prettier/plugin-xml and eslint-plugin-format are not installed directly within the project but in a shared eslint-config package.

In other words; if @antfu/eslint-config, @prettier/plugin-xml and eslint-plugin-format are installed as direct dependencies, it runs well on GitHub CI, but if the packages are installed as a dependency of a custom/shared eslint config which uses these packages, the SVG linting fails with the mentioned error.

/home/runner/work/website/website/public/favicon.svg
Error:   1:1  error  Failed to format the code  format/prettier

Locally it works fine. No idea what is causing this.

That's my config:

{
	vue: true,
	unocss: true,
	formatters: {
		css: true,
		html: true,
		markdown: true,
		svg: true,
		xml: true,
	},
	imports: {
		overrides: {
			'perfectionist/sort-imports': [
				'error',
				{
					newlinesBetween: 0,
				},
			],
		},
	},
	stylistic: {
		indent: 'tab',
		semi: true,
	},
}

Reproduction

https://github.com/somehow-digital/website/tree/eslint-svg

System Info

System:
    OS: Linux 5.15 Ubuntu 24.04.2 LTS 24.04.2 LTS (Noble Numbat)
    CPU: (16) x64 AMD Ryzen 7 9800X3D 8-Core Processor
    Memory: 14.37 GB / 15.43 GB
    Container: Yes
    Shell: 5.9 - /usr/bin/zsh
  Binaries:
    Node: 22.17.0 - /run/user/1000/fnm_multishells/7814_1752947915897/bin/node
    Yarn: 1.22.22 - /run/user/1000/fnm_multishells/7814_1752947915897/bin/yarn
    npm: 10.9.2 - /run/user/1000/fnm_multishells/7814_1752947915897/bin/npm
    pnpm: 10.13.1 - /run/user/1000/fnm_multishells/7814_1752947915897/bin/pnpm

Used Package Manager

pnpm

Validations

  • Follow our Code of Conduct
  • Read the Contributing Guide.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
  • The provided reproduction is a minimal reproducible of the bug.

Contributions

  • I am willing to submit a PR to fix this issue
  • I am willing to submit a PR with failing tests (actually just go ahead and do it, thanks!)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions