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 Pragmatic topics Top

jamis
The following is cross-posted from the original Ray Tracer Challenge forum, from a post by garfieldnate. I’m cross-posting it so that the...
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
leonW
I ran this command after installing the sample application: $ cards add do something --owner Brian And got a file not found error: Fil...
New
curtosis
Running mix deps.get in the sensor_hub directory fails with the following error: ** (Mix) No SSH public keys found in ~/.ssh. An ssh aut...
New
adamwoolhether
Is there any place where we can discuss the solutions to some of the exercises? I can figure most of them out, but am having trouble with...
New
taguniversalmachine
It seems the second code snippet is missing the code to set the current_user: current_user: Accounts.get_user_by_session_token(session["...
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
bjnord
Hello @herbert ! Trying to get the very first “Hello, Bracket Terminal!" example to run (p. 53). I develop on an Amazon EC2 instance runn...
New
gorkaio
root_layout: {PentoWeb.LayoutView, :root}, This results in the following following error: no “root” html template defined for PentoWeb...
New
dachristenson
I’ve got to the end of Ch. 11, and the app runs, with all tabs displaying what they should – at first. After switching around between St...
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
AstonJ
Or looking forward to? :nerd_face:
New
brentjanderson
Bought the Moonlander mechanical keyboard. Cherry Brown MX switches. Arms and wrists have been hurting enough that it’s time I did someth...
New
AstonJ
poll poll Be sure to check out @Dusty’s article posted here: An Introduction to Alternative Keyboard Layouts It’s one of the best write-...
New
New
AstonJ
I ended up cancelling my Moonlander order as I think it’s just going to be a bit too bulky for me. I think the Planck and the Preonic (o...
New
Maartz
Hi folks, I don’t know if I saw this here but, here’s a new programming language, called Roc Reminds me a bit of Elm and thus Haskell. ...
New
AstonJ
Was just curious to see if any were around, found this one: I got 51/100: Not sure if it was meant to buy I am sure at times the b...
New
PragmaticBookshelf
Author Spotlight Rebecca Skinner @RebeccaSkinner Welcome to our latest author spotlight, where we sit down with Rebecca Skinner, auth...
New
AstonJ
If you’re getting errors like this: psql: error: connection to server on socket “/tmp/.s.PGSQL.5432” failed: No such file or directory ...
New

Latest in PragProg

View all threads ❯