How do I get expo/metro to run eslint on reload? (for the second time)

Reposting due to the stupid automatic thread locking feature.

“Your topic is similar to…” Yeah no doubt. I posted it. “Title has already been used” YEAH NO DOUBT.

Old thread: How do I get expo/metro to run eslint on reload?

Ooh look, nearly 15 days. Better post again.

hello! i’m not sure what expo/metro have to do with eslint, neither are concerned with linting. your editor should run eslint for you automatically, or you can run some script alongside expo start if you want

Well I’d prefer to have less terminals. Right now there’s one for docker-compose running all the server stuff, npm run, npm run lint:watch, and npm run test:watch, and it’s all a bit silly. Especially if I want to open a node REPL to test something out, or heaven forbid use git.

No, it would be much better if, when it saw my files reload, metro ran the linter (and tests) before reloading, to save time, screen real estate, CPU cycles, etc.

I do believe create-react-app runs linting (albeit with cruddy rules) in the webpack terminal session, so I don’t think it’s unreasonable to expect expo to, too.

we definitely do not want to get into prescribing different lint rules :slight_smile: but perhaps some general mechanism for running another program when watched files change and reporting the output to the expo-cli logs could be useful. it’s not really high priority for us but if you’d like to look into what it would take to build it into expo-cli, please do! then open an issue that roughly follows the react fcs template but replace anything react specific with expo-cli, as we don’t have a rfc template for it yet :stuck_out_tongue: looking forward to hearing what you come up with if you are motivated to do so!

we definitely do not want to get into prescribing different lint rules

For sure, the user would provide their own .eslintrc.js.

but perhaps some general mechanism for running another program when watched files change and reporting the output to the expo-cli logs could be useful

Exactly this - currently I have nodemon --delay 17ms -e js,jsx --exec 'npm run lint' and jest --watch --changedSince=origin/master open in terminals, along with npm start, docker-compose up, etc. It all gets a little silly.

if you are motivated to do so!

It’s for sure outside my skills and abilities as it stands, but thank you for the benefit of the doubt.

I agree that it would be nice for the expo toolchain to run ESLint on save and display the ESLint errors on the Expo Client (as well as the editor). Similar to Create React App’s workflow, if there is an ESLint error, then the app fails to compile.

1 Like