tools icon indicating copy to clipboard operation
tools copied to clipboard

📎 Support source type overrides

Open MichaReiser opened this issue 3 years ago • 5 comments

Description

Rome enables JSX for *.js files by default:

https://github.com/rome/tools/blob/ac43cf02ee4ac86bb8303936247243f531f46335/crates/rome_js_syntax/src/source_type.rs#L242-L249

This is great to require minimal configuration but has the issue that not all valid JavaScript is valid JSX.

It should be possible for users to disable JSX (or module parsing).

MichaReiser avatar Nov 09 '22 08:11 MichaReiser

How do we plan to support this? Rome classic had this option:

{ 
	"parser": {
		"jsxEverywhere": true
	}
}

ematipico avatar Nov 14 '22 09:11 ematipico

That's something that should be figured out as part of the issue.

I would favor a non parser specific option as we don't want that users must enable jsx in parsing, lintining.

MichaReiser avatar Nov 14 '22 10:11 MichaReiser

Considering how our rome.json differs from the classic one, maybe

{
	"javascript": {
		"parser": {
			"jsxEverywhere": true
		}
	}
}

Or

{
	"javascript": {
		"jsxEverywhere": true
	}
}

Seem good candidates.

For the name, no strong options. It can be the classic name or a new one.

ematipico avatar Nov 14 '22 13:11 ematipico

Seem good candidates.

For the name, no strong options. It can be the classic name or a new one.

A boolean is probably not sufficient because Rome must know the JSX dialect to decide whether to enable React lint rules and how to transform the files. Let's solve this when we start working on this issue.

MichaReiser avatar Nov 14 '22 13:11 MichaReiser

👋 @rome/staff please triage this issue by adding one of the following labels: S-Bug: confirmed, S-Planned , S-Wishlist or umbrella

github-actions[bot] avatar Nov 29 '22 12:11 github-actions[bot]