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

Force using TypeScript (force lang='ts') #199

Open
bosung90 opened this issue Jan 31, 2023 · 1 comment
Open

Force using TypeScript (force lang='ts') #199

bosung90 opened this issue Jan 31, 2023 · 1 comment

Comments

@bosung90
Copy link

It is far too easy to forget to put lang='ts'.
Can we have a feature similar to vue-block-lang
https://eslint.vuejs.org/rules/block-lang.html#vue-block-lang

@bosung90 bosung90 changed the title Force using typescript (force lang='ts') Force using TypeScript (force lang='ts') Jan 31, 2023
@s1gr1d
Copy link

s1gr1d commented Aug 28, 2023

This is possible with an eslint rule: sveltejs/eslint-plugin-svelte#380

I have the following setup:

module.exports = {
	root: true,
	extends: [
		'eslint:recommended',
		'plugin:@typescript-eslint/recommended',
		'plugin:svelte/recommended',
		'prettier'
	],
	rules: {
		'svelte/block-lang': [
			'error',
			{
				enforceScriptPresent: false,
				enforceStylePresent: false,
				script: ['ts'], // enforce TS
				style: ['scss'] // enforce scss
			}
		]
	},
}

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

No branches or pull requests

2 participants