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!