Skip to content

False Positive for 'customElement: true'. #602

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

Closed
2 tasks done
irvingoujAtDevolution opened this issue Nov 2, 2023 · 4 comments · Fixed by #604
Closed
2 tasks done

False Positive for 'customElement: true'. #602

irvingoujAtDevolution opened this issue Nov 2, 2023 · 4 comments · Fixed by #604

Comments

@irvingoujAtDevolution
Copy link

irvingoujAtDevolution commented Nov 2, 2023

Before You File a Bug Report Please Confirm You Have Done The Following...

  • I have tried restarting my IDE and the issue persists.
  • I have updated to the latest version of the packages.

What version of ESLint are you using?

8.52.0

What version of eslint-plugin-svelte are you using?

2.34.0

What did you do?

Configuration
module.exports = {
	root: true,
	parser: '@typescript-eslint/parser',
	extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended', 'prettier', 'plugin:svelte/recommended'],
	plugins: ['@typescript-eslint'],
	ignorePatterns: ['*.cjs'],
	overrides: [
		{
			files: ['*.svelte'],
			parser: 'svelte-eslint-parser',
			parserOptions: {
				parser: '@typescript-eslint/parser'
			}
		}
	],
	parserOptions: {
		sourceType: 'module',
		ecmaVersion: 2020,
		project: './tsconfig.json',
		extraFileExtensions: ['.svelte']
	},
	env: {
		browser: true,
		es2017: true,
		node: true
	},
	rules: {
		'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
		'@typescript-eslint/no-explicit-any': 'off',
		'no-prototype-builtins': 'off',
		// 'svelte/valid-compile':'off'
	},
	settings: {
		svelte: {
			compileOptions: {
				customElement: true
			}
		}
	}
};

<svelte:options tag="iron-remote-gui"/>

<script lang="ts">
    import {onMount} from 'svelte';
...
</script>
...

What did you expect to happen?

I expect eslint throw no error with run npx eslint src/**

What actually happened?

> npx eslint src/**


C:\Users\jou\code\IronRDP\web-client\iron-remote-gui\src\iron-remote-gui.svelte
  1:17  error  The 'tag' option is used when generating a custom element. Did you forget the 'customElement: true' compile option?(missing-custom-element-compile-options)  svelte/valid-compile

✖ 1 problem (1 error, 0 warnings)

Link to GitHub Repo with Minimal Reproducible Example

IronRDP

inside the ./web-client/iron-remote-gui, one can try remove the

svelte/valid-compile': 'off'

to reproduce this problem

Additional comments

No response

@baseballyama
Copy link
Member

This error is came from Svelte compiler, so I think this is not ESLint issue.
Can you try to compile your code with Svelte compilar and share the result?

@irvingoujAtDevolution
Copy link
Author

I use vite build and it works well. Everything compiles.

@irvingoujAtDevolution
Copy link
Author

here is my vite config

import { defineConfig } from 'vite'
import { svelte } from '@sveltejs/vite-plugin-svelte'
import wasm from "vite-plugin-wasm";
import topLevelAwait from "vite-plugin-top-level-await";
import dtsPlugin from "vite-plugin-dts";

// https://vitejs.dev/config/
export default defineConfig({
  build: {
    lib: {
      entry: './src/main.ts',
      name: 'IronRemoteGui',
      formats: ["umd", "es"],
    }
  },
  server: {
    fs: {
      strict: false
    }
  },
  plugins: [svelte({
    compilerOptions:{
      customElement:true
    }
  }), wasm(), topLevelAwait(), dtsPlugin()],
})

@baseballyama
Copy link
Member

It should be fix in 2.34.1!

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