Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ESLINT: Parsing error: Unexpected token in package.json

{
  "name": "react-redux-starter-kit",
  "version": "1.0.0",
  "description": "This would be the starter kit for react projects.",
  "main": "index.html",
  "scripts": {
    "start": "rm -rf build/ && rm -rf dist/ && webpack && webpack-dev-server --progress --colors",
    "build": "rm -rf build/ && rm -rf dist/ && NODE_ENV=production webpack --config ./webpack.production.config.babel.js --progress"
  },
  "repository": {
    "type": "git",
    "url": "git+https://[email protected]/rahulshettyprdxn/react-devops.git"
  },
  "keywords": [
    "react",
    "webpack",
    "react-native"
  ],
  "author": "Rahul Shetty",
  "license": "MIT",
  "homepage": "https://bitbucket.org/rahulshettyprdxn/react-devops#readme",
  "devDependencies": {
    "babel-core": "^6.5.2",
    "babel-eslint": "^5.0.0",
    "babel-loader": "^6.2.3",
    "babel-plugin-react-transform": "^2.0.0",
    "babel-preset-es2015-without-strict": "0.0.2",
    "babel-preset-react": "^6.5.0",
    "css-loader": "^0.23.1",
    "eslint": "^2.2.0",
    "eslint-plugin-react": "^4.1.0",
    "extract-text-webpack-plugin": "^1.0.1",
    "file-loader": "^0.8.5",
    "html-webpack-plugin": "^2.9.0",
    "image-webpack-loader": "^1.6.3",
    "node-sass": "^3.4.2",
    "react-css-modules": "^3.7.5",
    "react-transform-hmr": "^1.0.2",
    "sass-loader": "^3.1.2",
    "style-loader": "^0.13.0",
    "webpack": "^1.12.14",
    "webpack-dev-server": "^1.14.1"
  },
  "dependencies": {
    "bootstrap": "^3.3.6",
    "react": "^0.14.7",
    "react-bootstrap": "^0.28.3",
    "react-dom": "^0.14.7"
  }
}

Below is the error that I am receiving:
Parsing error: Unexpected token at line 2 col 8 in Atom editor.

Note that I'm currently getting this error on Windows 10.

ESLint Version:
"eslint": "^2.2.0",
"eslint-plugin-react": "^4.1.0"

I have installed linter-eslint in my Atom editor and Global npm ESLint setting is off.

I am quite confused as the error message is not that descriptive. This in no way is hampering my project but I am quite inquisitive as to why I am getting this error in my editor.

like image 451
shet_tayyy Avatar asked Mar 12 '16 16:03

shet_tayyy


People also ask

How do I resolve a parsing error in ESLint?

The Best Answer is. Unexpected token errors in ESLint parsing occur due to incompatibility between your development environment and ESLint's current parsing capabilities with the ongoing changes with JavaScripts ES6~7. The solution is to have ESLint parsed by a compatible parser.

Can not read file Tsconfig JSON?

To solve the error "Parsing Error: Cannot read file 'tsconfig. json'", update your . eslintrc. js file to set the tsconfigRootDir option to __dirname to force eslint to resolve your project configuration relative to the folder where .

What are ESLint's unexpected token errors?

Unexpected token errors in ESLint parsing occur due to incompatibility between your development environment and ESLint's current parsing capabilities with the ongoing changes with JavaScripts ES6~7.

What's the problem with ESLint parsing?

Why? .... .... What's the problem? Show activity on this post. Unexpected token errors in ESLint parsing occur due to incompatibility between your development environment and ESLint's current parsing capabilities with the ongoing changes with JavaScripts ES6~7.

What does error 7/16 mean in ESLint?

Show activity on this post. 7:16 error Parsing error: Unexpected token .. Why? .... .... What's the problem? Show activity on this post. Unexpected token errors in ESLint parsing occur due to incompatibility between your development environment and ESLint's current parsing capabilities with the ongoing changes with JavaScripts ES6~7.

How to add parser to ESLint-plugin-Vue?

Just for the record, if you are using eslint-plugin-vue, the correct place to add 'parser': 'babel-eslint' is inside parserOptions param. Show activity on this post. ecmaVersion - set to 3, 5 (default), 6, 7, 8, 9, 10, 11, or 12 to specify the version of ECMAScript syntax you want to use.


1 Answers

ESLint is for validating JavaScript, not JSON.

From the website:

ESLint

The pluggable linting utility for JavaScript and JSX

[emphasis mine]

(You can try your code on the online demo here, and you get the same error)

If you want to use ESLint on a JSON file, you could use a package like eslint-plugin-json.

like image 184
Hatchet Avatar answered Sep 22 '22 12:09

Hatchet