Skip to content

Flat Config False Positiv "Parsing error: Unexpected token ." #222

@georgiossalon

Description

@georgiossalon

In the newest version of eslint v9 I added the package pluginReact.configs.flat.recommended in the eslint.config.mjs file. All of a sudden I am getting in multiple files the error message "Parsing error: Unexpected token ." in places like result?.data.

Moving the plugin down or up the order didnt seem to solve the problem. If I comment it out, the error dissapears.

This is how my eslint.config.mjs looks like

import globals from "globals";
import pluginJs from "@eslint/js";
import pluginReact from "eslint-plugin-react";
import eslintConfigPrettier from "eslint-config-prettier";
import pluginCypress from 'eslint-plugin-cypress/flat'


export default [
  pluginCypress.configs.recommended,
  {files: ["**/*.{js,mjs,cjs,jsx}"]},
  {languageOptions: { globals: globals.browser }},
  pluginJs.configs.recommended,
  pluginReact.configs.flat.recommended,
  eslintConfigPrettier,
  {
    settings: {
      react: {
        version: "detect"
      }
    },
    rules: {
      "react/react-in-jsx-scope": 0,
      "no-unused-vars": 1,
      "react/prop-types": 0,
      "react/function-component-definition": [2, {"namedComponents": "arrow-function"}],
      "react/destructuring-assignment": 1,
      'cypress/no-unnecessary-waiting': 'off'
    }
  }
];

and the packages in the package.json

"eslint-plugin-cypress": "^3.5.0",
"eslint-plugin-react": "^7.35.0",
"eslint-config-prettier": "^9.1.0",
"eslint": "^9.9.0",
"@eslint/js": "^9.9.0",

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions