OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

React Project ESlint error "Unexpected Token Export"

  • Thread starter Thread starter William Addison
  • Start date Start date
W

William Addison

Guest
I was working on a new react project and had set up my ESlint which was running fine before I changed code in another file and now it's giving me an error:

Code:
Error: Unexpected token 'export'

I'm new to eslint and so I'm using all the default settings that are recommended however I'm hesitant to post this just because I feel like this may be a formatting error on my part. Any help would be greatly appreciated.

Here is my ESlint file:

Code:
export default{
    "env": {
        "browser": true,
        "es2021": true
    },
    "extends": [
        "eslint:recommended",
        "plugin:react/recommended"
    ],
    "parserOptions": {
        "ecmaFeatures": {
            "jsx": true
        },
        "ecmaVersion": 12,
        "sourceType": "module"
    },
    "plugins": [
        "react"
    ],
    "rules": {
        "no-extra-semi":"error"

    }
    
};

and here is the Package's json:

Code:
{
  "name": "testapp",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@testing-library/jest-dom": "^5.12.0",
    "@testing-library/react": "^11.2.6",
    "@testing-library/user-event": "^12.8.3",
    "react": "^17.0.2",
    "react-dom": "^17.0.2",
    "react-scripts": "4.0.3",
    "web-vitals": "^1.1.1"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": [
      "react-app",
      "react-app/jest"
    ]
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  },
  "devDependencies": {
    "eslint": "^7.25.0",
    "eslint-plugin-react": "^7.23.2"
  }
}

any help is very appreciated

<p>I was working on a new react project and had set up my ESlint which was running fine before I changed code in another file and now it's giving me an error:</p>
<pre><code>Error: Unexpected token 'export'
</code></pre>
<p>I'm new to eslint and so I'm using all the default settings that are recommended however I'm hesitant to post this just because I feel like this may be a formatting error on my part. Any help would be greatly appreciated.</p>
<p>Here is my ESlint file:</p>
<pre><code>export default{
"env": {
"browser": true,
"es2021": true
},
"extends": [
"eslint:recommended",
"plugin:react/recommended"
],
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"ecmaVersion": 12,
"sourceType": "module"
},
"plugins": [
"react"
],
"rules": {
"no-extra-semi":"error"

}

};

</code></pre>
<p>and here is the Package's json:</p>
<pre><code>{
"name": "testapp",
"version": "0.1.0",
"private": true,
"dependencies": {
"@testing-library/jest-dom": "^5.12.0",
"@testing-library/react": "^11.2.6",
"@testing-library/user-event": "^12.8.3",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-scripts": "4.0.3",
"web-vitals": "^1.1.1"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"eslint": "^7.25.0",
"eslint-plugin-react": "^7.23.2"
}
}

</code></pre>
<p>any help is very appreciated</p>
 

Latest posts

Top