ESLINT: Parsing error: Unexpected token in package.json
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://rahulshettyprdxn@bitbucket.org/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"
}
}
以下是我收到的错误:
解析错误:Atom 编辑器中第 2 行第 8 栏 出现意外标记。
请注意,我目前在 Windows 10.
收到此错误
ESLint 版本:
"eslint": "^2.2.0",
"eslint-plugin-react": "^4.1.0"
我已经在我的 Atom 编辑器中安装了 linter-eslint,全局 npm ESLint 设置 已关闭。
我很困惑,因为错误消息不是那么具有描述性。这绝不会妨碍我的项目,但我很好奇为什么我的编辑器会出现这个错误。
ESLint 用于验证 JavaScript,而不是 JSON。
来自the website:
ESLint
The pluggable linting utility for JavaScript and JSX
[强调我的]
(您可以在在线演示 here 上尝试您的代码,您会得到同样的错误)
如果你想在 JSON 文件上使用 ESLint,你可以使用像 eslint-plugin-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://rahulshettyprdxn@bitbucket.org/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"
}
}
以下是我收到的错误:
解析错误:Atom 编辑器中第 2 行第 8 栏 出现意外标记。
请注意,我目前在 Windows 10.
收到此错误ESLint 版本:
"eslint": "^2.2.0",
"eslint-plugin-react": "^4.1.0"
我已经在我的 Atom 编辑器中安装了 linter-eslint,全局 npm ESLint 设置 已关闭。
我很困惑,因为错误消息不是那么具有描述性。这绝不会妨碍我的项目,但我很好奇为什么我的编辑器会出现这个错误。
ESLint 用于验证 JavaScript,而不是 JSON。
来自the website:
ESLint
The pluggable linting utility for JavaScript and JSX
[强调我的]
(您可以在在线演示 here 上尝试您的代码,您会得到同样的错误)
如果你想在 JSON 文件上使用 ESLint,你可以使用像 eslint-plugin-json.
这样的包