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

belgoros
Following the steps described in Chapter 6 of the book, I’m stuck with running the migration as described on page 84: bundle exec sequel...
New
raul
Hi Travis! Thank you for the cool book! :slight_smile: I made a list of issues and thought I could post them chapter by chapter. I’m rev...
New
HarryDeveloper
Hi @venkats, It has been mentioned in the description of ‘Supervisory Job’ title that 2 things as mentioned below result in the same eff...
New
New
brian-m-ops
#book-python-testing-with-pytest-second-edition Hi. Thanks for writing the book. I am just learning so this might just of been an issue ...
New
brunogirin
When I run the coverage example to report on missing lines, I get: pytest --cov=cards --report=term-missing ch7 ERROR: usage: pytest [op...
New
akraut
The markup used to display the uploaded image results in a Phoenix.LiveView.HTMLTokenizer.ParseError error. lib/pento_web/live/product_l...
New
taguniversalmachine
Hi, I am getting an error I cannot figure out on my test. I have what I think is the exact code from the book, other than I changed “us...
New
rainforest
Hi, I’ve got a question about the implementation of PubSub when using a Phoenix.Socket.Transport behaviour rather than channels. Before ...
New
gorkaio
root_layout: {PentoWeb.LayoutView, :root}, This results in the following following error: no “root” html template defined for PentoWeb...
New

Other popular topics Top

AstonJ
A thread that every forum needs! Simply post a link to a track on YouTube (or SoundCloud or Vimeo amongst others!) on a separate line an...
New
ohm
Which, if any, games do you play? On what platform? I just bought (and completed) Minecraft Dungeons for my Nintendo Switch. Other than ...
New
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
mafinar
Crystal recently reached version 1. I had been following it for awhile but never got to really learn it. Most languages I picked up out o...
New
AstonJ
If you get Can't find emacs in your PATH when trying to install Doom Emacs on your Mac you… just… need to install Emacs first! :lol: bre...
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
CommunityNews
A Brief Review of the Minisforum V3 AMD Tablet. Update: I have created an awesome-minisforum-v3 GitHub repository to list information fo...
New

Sub Categories: