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

iPaul
page 37 ANTLRInputStream input = new ANTLRInputStream(is); as of ANTLR 4 .8 should be: CharStream stream = CharStreams.fromStream(i...
New
telemachus
Python Testing With Pytest - Chapter 2, warnings for “unregistered custom marks” While running the smoke tests in Chapter 2, I get these...
New
jesse050717
Title: Web Development with Clojure, Third Edition, pg 116 Hi - I just started chapter 5 and I am stuck on page 116 while trying to star...
New
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
herminiotorres
Hi! I know not the intentions behind this narrative when called, on page XI: mount() |> handle_event() |> render() but the correc...
New
gilesdotcodes
In case this helps anyone, I’ve had issues setting up the rails source code. Here were the solutions: In Gemfile, change gem 'rails' t...
New
adamwoolhether
When trying to generate the protobuf .go file, I receive this error: Unknown flag: --go_opt libprotoc 3.12.3 MacOS 11.3.1 Googling ...
New
brunogirin
When installing Cards as an editable package, I get the following error: ERROR: File “setup.py” not found. Directory cannot be installe...
New
andreheijstek
After running /bin/setup, the first error was: The foreman' command exists in these Ruby versions: That was easy to fix: gem install fore...
New
a.zampa
@mfazio23 I’m following the indications of the book and arriver ad chapter 10, but the app cannot be compiled due to an error in the Bas...
New

Other popular topics Top

malloryerik
Any thoughts on Svelte? Svelte is a radical new approach to building user interfaces. Whereas traditional frameworks like React and Vue...
New
DevotionGeo
I know that these benchmarks might not be the exact picture of real-world scenario, but still I expect a Rust web framework performing a ...
New
Exadra37
I am thinking in building or buy a desktop computer for programing, both professionally and on my free time, and my choice of OS is Linux...
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
New
PragmaticBookshelf
A Hero’s Journey with Chris Pine @chrispine Chris Pine, author of Learn to Program, Third Edition, discusses his journey to beco...
New
PragmaticBookshelf
Build efficient applications that exploit the unique benefits of a pure functional language, learning from an engineer who uses Haskell t...
New
Help
I am trying to crate a game for the Nintendo switch, I wanted to use Java as I am comfortable with that programming language. Can you use...
New
PragmaticBookshelf
Author Spotlight Erin Dees @undees Welcome to our new author spotlight! We had the pleasure of chatting with Erin Dees, co-author of ...
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

Latest in PragProg

View all threads ❯