简体   繁体   中英

Why does Rome think my file is empty when I try to compile it?

I'm trying out this new thing from Facebook called Rome

As it is still experimental, you need to first build this tool from source. I followed these steps without any issues.

In a nutshell, what I did was:

cd /tmp
git clone https://github.com/facebookexperimental/rome.git
cd rome
./scripts/build-release dist

I then installed it with:

cd /tmp
mkdir try-rome
cd try-rome/
npm install ../rome/dist/

That was all fine. I then created this file index.js with the following content:

alert("wat?")

And put an empty rome.json file at the root as per the "Getting Started" instructions at time of writing:

Rome requires a project configuration in order to operate. This can take three possible forms.

  • A rome.json file
  • A rome.rjson file (What is RJSON? See #13)
  • A rome field on package.json

This can just be an empty file. It's required in order for Rome to determine all the files in a project

And ran this command:

./node_modules/.bin/rome compile index.js 

Which failed with the following error:

在此处输入图片说明

I know this file isn't empty so why does Rome think it is?

In the documentation I saw this line:

$ echo '{}' >rome.json

It seems like the rome.json file should have at least an empty json {}

In this context an empty rome.json file means it has at least {} . I agree the docs should reword this to make it more clear.

The better way to generate the rome.json file which will result in less issues is to use the ./scripts/dev-rome init script which gives a recommended configuration that enables linting.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM