amagnasco

amagnasco

Test-Driven React 2: eslint version is outdated (page 31)

Hi Trevor,

I had picked up the original version of this book a while ago. I’m just now getting into several of the topics covered here, and was thrilled to rediscover the book. What an amazing resource!

Unfortunately, I ran into a wall pretty much immediately due to the fact that v1 of the book was using the outdated pre-version-9 config file for eslint, plus that it was missing typescript, etc. Oh joy when I found the updated version! But this one also uses the old eslint config-- what a rollercoaster.

Trying to get it set up properly took some time, since the actual eslint v9 flat config is still being worked on, and therefore many of the eslint plugins might still have breaking API changes.

Here’s my humble contribution for an updated eslint config on page 31 for the following versions:
@eslint/js”: “^9.10.0”,
“eslint”: “^9.10.0”,
“eslint-plugin-jest”: “^28.8.3”,
“eslint-plugin-react”: “^7.35.2”,
“jest”: “^29.7.0”

code:

// eslint.config.mjs

import globals from "globals";
import pluginJs from "@eslint/js";
import pluginJest from "eslint-plugin-jest"
//import pluginReact from "eslint-plugin-react";

export default [
    {files: ["**/*.{js,mjs,cjs,jsx}"]},
    {languageOptions: {
        globals: globals.node
    }},
    pluginJs.configs.recommended,
    //pluginReact.configs.flat.recommended,

	// tests
	{
		files: ["**/*.test.{js,ts}"],
		plugins: {
			jest: pluginJest,
		},
        ...pluginJest.configs['flat/recommended'],
		languageOptions: {
			globals: {
				...globals.jest
			}
		},
		rules: {}
	}
];

It’s pretty funny how eslint didn’t change for so many years, and now downstream migrations are being a bit of a problem from what I can see online.

Thank you for an amazing book! Can’t wait to finish it!

Popular Prag Prog topics Top

simonpeter
When I try the command to create a pair of migration files I get an error. user=> (create-migration "guestbook") Execution error (Ill...
New
mikecargal
Title: Hands-On Rust (Chapter 11: prefab) Just played a couple of amulet-less games. With a bit of debugging, I believe that your can_p...
New
jdufour
Hello! On page xix of the preface, it says there is a community forum "… for help if your’re stuck on one of the exercises in this book… ...
New
herminiotorres
Hi @Margaret , On page VII the book tells us the example and snippets will be all using Elixir version 1.11 But on page 3 almost the en...
New
joepstender
The generated iex result below should list products instead of product for the metadata. (page 67) iex> product = %Product{} %Pento....
New
Charles
In general, the book isn’t yet updated for Phoenix version 1.6. On page 18 of the book, the authors indicate that an auto generated of ro...
New
mert
AWDWR 7, page 152, page 153: Hello everyone, I’m a little bit lost on the hotwire part. I didn’t fully understand it. On page 152 @rub...
New
dtonhofer
@parrt In the context of Chapter 4.3, the grammar Java.g4, meant to parse Java 6 compilation units, no longer passes ANTLR (currently 4....
New
New
ggerico
I got this error when executing the plot files on macOS Ventura 13.0.1 with Python 3.10.8 and matplotlib 3.6.1: programming_ML/code/03_...
New

Other popular topics Top

wolf4earth
@AstonJ prompted me to open this topic after I mentioned in the lockdown thread how I started to do a lot more for my fitness. https://f...
New
siddhant3030
I’m thinking of buying a monitor that I can rotate to use as a vertical monitor? Also, I want to know if someone is using it for program...
New
AstonJ
You might be thinking we should just ask who’s not using VSCode :joy: however there are some new additions in the space that might give V...
New
PragmaticBookshelf
Rust is an exciting new programming language combining the power of C with memory safety, fearless concurrency, and productivity boosters...
New
AstonJ
In case anyone else is wondering why Ruby 3 doesn’t show when you do asdf list-all ruby :man_facepalming: do this first: asdf plugin-upd...
New
AstonJ
Biggest jackpot ever apparently! :upside_down_face: I don’t (usually) gamble/play the lottery, but working on a program to predict the...
New
New
First poster: bot
The overengineered Solution to my Pigeon Problem. TL;DR: I built a wifi-equipped water gun to shoot the pigeons on my balcony, controlle...
New
First poster: bot
Large Language Models like ChatGPT say The Darnedest Things. The Errors They MakeWhy We Need to Document Them, and What We Have Decided ...
New
DevotionGeo
I have always used antique keyboards like Cherry MX 1800 or Cherry MX 8100 and almost always have modified the switches in some way, like...
New

Latest in PragProg

View all threads ❯