How to install all the dependencies and plugins using package.json in ionic - json

I have cloned ionic project from git in which the node_modules, platforms, plugins are not available but in the package.json i am having all the detail so whether i have to install all one by one or is there any short way where i can use the package.json and install all the node_modules, platforms and plugins.
package.json
{
"private": true,
"engines": {
"node": ">=4.0.0"
},
"scripts": {
"test": "gulp build --minify && gulp karma"
},
"devDependencies": {
"browser-sync": "^2.8.3",
"chalk": "^1.1.0",
"cordova": "^6.0.0",
"del": "^2.0.0",
"elementtree": "^0.1.6",
"eslint": "^3.0.0",
"gulp": "^3.9.1",
"gulp-angular-filesort": "^1.1.1",
"gulp-autoprefixer": "^3.0.1",
"gulp-changed": "^1.3.0",
"gulp-csso": "^2.0.0",
"gulp-eslint": "^3.0.0",
"gulp-filter": "^4.0.0",
"gulp-htmlmin": "^2.0.0",
"gulp-if": "^2.0.0",
"gulp-imagemin": "^3.0.1",
"gulp-inject": "^4.0.0",
"gulp-jsonlint": "^1.1.0",
"gulp-load-plugins": "^1.0.0-rc",
"gulp-natural-sort": "^0.1.0",
"gulp-ng-annotate": "^2.0.0",
"gulp-plumber": "^1.0.1",
"gulp-protractor": "^3.0.0",
"gulp-rename": "^1.2.2",
"gulp-sass": "^3.1.0",
"gulp-shell": "^0.5.1",
"gulp-size": "^2.0.0",
"gulp-sourcemaps": "^1.5.2",
"gulp-uglify": "^2.0.0",
"gulp-useref": "^3.0.4",
"karma": "^1.1.0",
"karma-angular-filesort": "^1.0.0",
"karma-jasmine": "^1.0.2",
"karma-ng-html2js-preprocessor": "^1.0.0",
"karma-phantomjs-launcher": "^1.0.0",
"lodash": "^4.3.0",
"main-bower-files": "^2.9.0",
"minimist": "^1.2.0",
"phantomjs-prebuilt": "^2.1.4",
"plist": "git://github.com/akofman/plist.js.git#3f256fd21ab3ad3ada0f491cfc905098a2631342",
"proxy-middleware": "^0.15.0",
"require-dir": "^0.3.0",
"vinyl-paths": "^2.0.0",
"wiredep": "^4.0.0",
"xml2js": "^0.4.9",
"yeoman-test": "^1.1.0"
},
"generator-m-ionic": {
"proxies": [
{
"proxyMapFrom": "/postman-proxy",
"proxyMapTo": "https://echo.getpostman.com"
},
{
"proxyMapFrom": "/another-proxy",
"proxyMapTo": "https://echo.getpostman.com"
}
]
},
"dependencies": {
"angular-multiple-select": "^1.1.2",
"cordova-android": "^6.2.3",
"cordova-ios": "~4.3.1",
"cordova-plugin-device": "~1.1.5",
"cordova-plugin-network-information": "~1.3.2",
"cordova-plugin-whitelist": "1",
"cordova-plugin-x-toast": "~2.6.0",
"ionic-plugin-keyboard": "~2.2.1",
"pdfmake": "^0.1.31"
},
"cordova": {
"plugins": {
"cordova-plugin-x-toast": {},
"cordova-plugin-device": {},
"cordova-plugin-network-information": {},
"cordova-plugin-whitelist": {},
"ionic-plugin-keyboard": {}
},
"platforms": [
"android",
"ios"
]
}
}

First install both ionic and cordova cli.(It is an ionic v1 project with android/ios platforms) from your package.json.
npm i -g cordova ionic
To install dependencies and devDependencies, do:
npm install
To install plugins and platforms as per package.json,
ionic cordova prepare

You may use the npm install command,
which will install all of the project dependencies locally.
npm official docs description for npm install command:
This command installs a package, and any packages that it depends on.
If the package has a package-lock or shrinkwrap file, the installation
of dependencies will be driven by that, with an npm-shrinkwrap.json
taking precedence if both files exist. See package-lock.json and
npm-shrinkwrap.
source

Related

Build Issue With Angular Project while updating Angular 7 to 13

I wanted to upgrade the Angular version in my project from 7 to 13, but I am facing some issues. Below you can see my package in Json format:
{
"name": "comresi-angular",
"version": "0.0.0",
"scripts": {
"start": "ng serve",
"start:local": "ng serve --base-href=/",
"build:prod": "ng build --configuration production",
"build:dev": "ng build ----configuration dev",
"build:local": "npm run build:dev && npm run copy_tomcat",
"copy_tomcat": "xcopy \"../webapp/resources\\*\" \"%CATALINA_HOME%\\webapps\\erlcr\\resources\" /s /i /y > nul"
},
"private": true,
"dependencies": {
"#angular/animations": "~13.1.0",
"#angular/cdk": "~13.1.0",
"#angular/common": "~13.1.0",
"#angular/compiler": "~13.1.0",
"#angular/core": "~13.1.0",
"#angular/forms": "~13.1.0",
"#angular/http": "^7.0.0",
"#angular/material": "~13.1.0",
"#angular/platform-browser": "~13.1.0",
"#angular/platform-browser-dynamic": "~13.1.0",
"#angular/service-worker": "~13.1.0",
"#angular/router": "~13.1.0",
"#ngx-translate/core": "11.0.1",
"#ngx-translate/http-loader": "4.0.0",
"#types/bingmaps": "0.0.1",
"#types/jquery": "^3.3.22",
"#types/npm": "^2.0.29",
"#types/slickgrid": "^2.1.26",
"ag-grid-angular": "^19.0.0",
"ag-grid-community": "^19.0.0",
"angular-maps": "^6.0.1",
"angular-slickgrid": "^2.1.8",
"bingmaps": "^2.0.3",
"bootstrap": "^4.1.3",
"core-js": "^2.5.4",
"dhtmlx-gantt": "file:gantt_7.1.8_evaluation",
"font-awesome": "^4.7.0",
"jquery": "^3.3.1",
"jqwidgets-scripts": "^6.1.0",
"moment": "^2.19.1",
"rxjs": "~7.4.0",
"rxjs-compat": "^7.4.0",
"zone.js": "~0.11.4"
},
"devDependencies": {
"#angular-devkit/build-angular": "13.1.2",
"#angular/cli": "~13.1.0",
"#angular/compiler-cli": "~13.1.0",
"#angular/language-service": "~13.1.0",
"#types/jasmine": "~2.8.8",
"#types/jasminewd2": "~2.0.3",
"#types/node": "~8.9.4",
"codelyzer": "~4.3.0",
"jasmine-core": "~2.99.1",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~3.0.0",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~2.0.1",
"karma-jasmine": "~1.1.2",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "~5.4.0",
"ts-node": "~7.0.0",
"tslint": "~5.11.0",
"typescript": "~4.4.3",
"rxjs": "~7.4.0"
}
}
but I am getting the following error while running npm install:
While resolving: comresi-angular#0.0.0
Found: #angular-devkit/build-angular#0.10.7
node_modules/#angular-devkit/build-angular
dev #angular-devkit/build-angular#"13.1.2" from the root project
Could not resolve dependency:
dev #angular-devkit/build-angular#"13.1.2" from the root project
Conflicting peer dependency: #angular/core#13.1.1
node_modules/#angular/core
peer #angular/core#"13.1.1" from #angular/service-worker#13.1.1
node_modules/#angular/service-worker
#angular/service-worker#"~13.1.0" from the root project
peerOptional #angular/service-worker#"^13.0.0 || ^13.1.0-next" from #angular-devkit/build-angular#13.1.2
node_modules/#angular-devkit/build-angular
dev #angular-devkit/build-angular#"13.1.2" from the root project
Could you help me to understand why I am getting that error?
If you use the official angular update website and you put your angular versions From 7.0 To 13.0 you will get the following warning:
so obviously you need to go through all the major versions until v13.0
As per my experience with project. It is better to build a simple product with latest version (or version which you want). and add a component from your existing application gradually.

Run Server in MERN application

I am learning MERN application development. I got a incomplete MERN application and trying to run the application. My package.json file is like below.
package.json
{
"name": "machine-shop",
"version": "1.0.0",
"private": true,
"type": "module",
"scripts": {
"build": "node ace build --production",
"start": "node server.js",
"dev": "node ace serve --watch",
"lint": "eslint . --ext=.ts",
"format": "prettier --write ."
},
"devDependencies": {
"#adonisjs/assembler": "^5.0.0",
"#babel/core": "^7.14.3",
"#babel/preset-react": "^7.13.13",
"#symfony/webpack-encore": "^1.4.0",
"#types/node": "^16.3.3",
"adonis-preset-ts": "^2.1.0",
"autoprefixer": "^10.2.6",
"eslint": "^7.27.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-adonis": "^1.3.1",
"eslint-plugin-prettier": "^3.4.0",
"node-pre-gyp": "^0.17.0",
"pino-pretty": "^5.0.1",
"postcss": "^8.3.0",
"postcss-loader": "^5.3.0",
"prettier": "^2.3.0",
"sass": "^1.34.0",
"sass-loader": "^11.1.1",
"tailwindcss": "^2.1.2",
"typescript": "~4.2",
"youch": "^2.2.2",
"youch-terminal": "^1.1.1"
},
"dependencies": {
"-": "^0.0.1",
"#adonisjs/auth": "^8.0.4",
"#adonisjs/core": "^5.1.0",
"#adonisjs/lucid": "^14.1.0",
"#adonisjs/repl": "^3.0.0",
"#adonisjs/session": "^6.0.0",
"#adonisjs/shield": "^7.0.0",
"#adonisjs/view": "^6.0.0",
"#ckeditor/ckeditor5-build-decoupled-document": "^28.0.0",
"#ckeditor/ckeditor5-react": "^3.0.2",
"#date-io/date-fns": "2.6.1",
"#formatjs/intl-pluralrules": "1.3.5",
"#fortawesome/fontawesome-free": "5.13.0",
"#manaflair/redux-batch": "1.0.0",
"#material-ui/core": "4.9.14",
"#material-ui/icons": "4.9.1",
"#material-ui/lab": "4.0.0-alpha.53",
"#material-ui/pickers": "3.2.10",
"#material-ui/styles": "4.9.14",
"#reduxjs/toolkit": "^1.6.1",
"#tanem/svg-injector": "8.0.50",
"apexcharts": "^3.27.2",
"axios": "^0.21.1",
"axios-mock-adapter": "1.18.1",
"bootstrap": "4.6.0",
"camelcase": "^5.2.0",
"clipboard-copy": "3.1.0",
"clsx": "1.1.0",
"cp-cli": "2.0.0",
"css-mediaquery": "^0.1.2",
"date-fns": "2.8.1",
"dotenv": "^10.0.0",
"dotenv-expand": "5.1.0",
"downshift": "3.4.2",
"fg-loadcss": "^3.1.0",
"force": "^0.0.3",
"formik": "2.1.4",
"holderjs": "^2.9.9",
"json2mq": "^0.2.0",
"luxon": "^1.27.0",
"material-ui-popup-state": "^1.8.3",
"mysql": "^2.18.1",
"object-path": "^0.11.5",
"phc-argon2": "^1.1.1",
"phc-bcrypt": "^1.0.7",
"prop-types": "^15.7.2",
"proxy-addr": "^2.0.7",
"react": "^17.0.2",
"react-app-polyfill": "^1.0.4",
"react-bootstrap": "1.0.1",
"react-bootstrap-table-next": "4.0.2",
"react-bootstrap-table2-paginator": "2.1.2",
"react-datepicker": "2.16.0",
"react-dev-utils": "^9.1.0",
"react-dom": "^17.0.2",
"react-draggable": "4.4.2",
"react-dropzone": "^11.3.4",
"react-inlinesvg": "1.2.0",
"react-intl": "3.6.2",
"react-is": "16.13.1",
"react-perfect-scrollbar": "1.5.8",
"react-portal": "4.2.0",
"react-redux": "7.1.3",
"react-router-dom": "^5.2.0",
"react-select": "3.1.0",
"react-slick": "^0.28.1",
"react-swipeable-views": "0.13.9",
"react-syntax-highlighter": "12.2.1",
"react-tinder-card": "^1.4.0",
"react-window": "1.8.5",
"redux": "4.0.5",
"redux-persist": "6.0.0",
"redux-saga": "1.1.3",
"reflect-metadata": "^0.1.13",
"socicon": "3.0.5",
"source-map-support": "^0.5.19",
"sweetalert2": "^11.0.11",
"yup": "^0.32.9"
}
}
My server.js file is like below
server.js
import 'reflect-metadata';
import sourceMapSupport from 'source-map-support';
import { Ignitor } from '#adonisjs/core/build/standalone';
sourceMapSupport.install({ handleUncaughtExceptions: false })
new Ignitor(__dirname).httpServer().start()
I am trying to run the application using npm start command. But I am getting below error.
file:///home/foysal/Music/machineshop/server.js:20
new Ignitor(__dirname).httpServer().start()
^
ReferenceError: __dirname is not defined in ES module scope
This file is being treated as an ES module because it has a '.js' file extension and '/home/foysal/Music/machineshop/package.json' contains "type": "module". To treat it as a CommonJS script, rename it to use the '.cjs' file extension.
at file:///home/foysal/Music/machineshop/server.js:20:13
What is the meaning of this code new Ignitor(__dirname).httpServer().start() ? Is it correct code ?
Previously I worked in another MERN application. server.js file of that project is not similar like server.js file of this project.
Am I doing anything wrong ?
Could any one help me to run the application ?
You have mixed up client and server. Usually you keep them separated when you work on stacks like that - in separate repositories or at least in separate directories. You have 2 ways as I see:
Separate client and server dependencies
Use Adonis to serve the React app
I would take the first path for better maintainability. If that seems too complicated, you can take the later one for now and keep working on separation down the road. For that you may wanna look into this document.

BabelJs over Heroku: Couldn't find preset "env" relative to directory "/app"

I have an application with SailsJs over NodeJs on Heroku and I can't run babeljs on. It runs ok on my localhost, but I always get the error:
Error: Couldn't find preset "env" relative to directory "/app"
The Heroku persists in look for itens at /app folder. This project does not have one /app folder
My app folders structure is:
app_name
- api
- assets
- config
- tasks
- views
I follow the documentation of http://babeljs.io to my .babelrc
.babelrc
now:
{
"presets": ["react", "env", "stage-1"],
"plugins": ["transform-class-properties"]
}
Already tried:
{
"presets": ["react", "es2015", "stage-1"],
"plugins": ["transform-class-properties"]
}
When I set the .babelrc to use es2015 I get the error:
Invalid:
`{ presets: [{option: value}] }`
Valid:
`{ presets: [['presetName', {option: value}]] }`
I already installed the dependencies
npm install babel-preset-es2015
npm install babel-preset-react
npm install babel --save-dev
My package.json
{
"name": "redux-cardeck",
"private": true,
"version": "0.0.1",
"engines": {
"node": "6.11.4"
},
"description": "a Sails-Redux application for multi-player online card game",
"keywords": [
"sailsjs",
"redux",
"es2015",
"webpack"
],
"dependencies": {
"axios": "^0.13.1",
"babel-cli": "^6.26.0",
"babel-plugin-transform-class-properties": "^6.11.5",
"babel-plugin-transform-object-rest-spread": "^6.6.5",
"babel-polyfill": "^6.7.2",
"babel-preset-stage-1": "^6.13.0",
"connect-mongo": "0.8.2",
"css-loader": "^0.23.1",
"ejs": "2.3.4",
"file-loader": "^0.8.5",
"grunt": "0.4.5",
"grunt-babel": "^6.0.0",
"grunt-contrib-clean": "0.6.0",
"grunt-contrib-coffee": "0.13.0",
"grunt-contrib-concat": "0.5.1",
"grunt-contrib-copy": "0.5.0",
"grunt-contrib-cssmin": "0.9.0",
"grunt-contrib-jst": "0.6.0",
"grunt-contrib-less": "1.1.0",
"grunt-contrib-uglify": "0.7.0",
"grunt-contrib-watch": "0.5.3",
"grunt-sails-linker": "~0.10.1",
"grunt-sync": "0.2.4",
"include-all": "~0.1.6",
"node-sass": "^3.8.0",
"postcss-modules-extract-imports": "^1.0.0",
"postcss-modules-scope": "^1.0.0",
"rc": "1.0.1",
"react": "^0.14.9",
"react-dom": "^0.14.9",
"react-redux": "^4.4.8",
"react-router": "^2.6.1",
"react-tap-event-plugin": "^0.2.2",
"redux": "^3.7.2",
"redux-form": "^5.3.2",
"redux-optimist": "0.0.2",
"redux-optimistic-ui": "^0.3.2",
"redux-promise": "^0.5.3",
"redux-thunk": "^2.1.0",
"redux-undo": "^0.6.1",
"sails": "~0.12.1",
"sails-disk": "~0.10.9",
"sails-hook-babel": "^6.0.1",
"sails-mongo": "^0.12.2",
"sails-postgresql": "^0.11.4",
"sails-service-mailer": "^3.2.1",
"sails-webpack": "^1.0.13",
"sass": "^0.5.0",
"sass-loader": "^3.2.3",
"style-loader": "^0.13.1",
"unexpected-react": "^1.0.0",
"updeep": "^0.16.1",
"url-loader": "^0.5.7"
},
"scripts": {
"debug": "node debug app.js",
"start": "./node_modules/.bin/babel-node app.js"
},
"main": "app.js",
"repository": {
"type": "git",
"url": "git://github.com/vanphuong12a2/redux-cardeck.git"
},
"author": "phuong",
"license": "",
"devDependencies": {
"axios-mock-adapter": "^1.6.1",
"babel-cli": "^6.26.0",
"babel-core": "^6.7.2",
"babel-loader": "^6.4.1",
"babel-preset-env": "^1.6.1",
"babel-preset-es2015": "^6.24.1",
"babel-preset-react": "^6.24.1",
"babel-preset-stage-0": "^6.24.1",
"css-modules-require-hook": "^4.0.0",
"jsdom": "^8.1.0",
"react-tools": "^0.13.3",
"redux-devtools": "^3.4.0",
"redux-logger": "^2.6.1",
"source-map": "^0.5.3",
"unexpected": "^10.10.8",
"webpack-dev-server": "^1.14.1"
}
}
Someone already used BabelJs on Heroku before? I can't understand why it cant find babeljs at the package.json. I set the local of babel on heroku as
"scripts": {
"debug": "node debug app.js",
"start": "./node_modules/.bin/babel-node app.js"
},
I think it could be a problem with the relative structure of heroku or the fact I do not have a folder with name app
Thanks if someone can help me with this.
By default Heroku doesn't install the dependencies listed on "devDependencies" in your package.json.
You can either move your presets to "dependencies" or follow the steps here to alter this behavior.

Angular2 bundle.js:2 Uncaught ReferenceError: google is not defined

I use the 2.0.0-rc.4 version of Angular. I have always "google is not defined" problem in my console
console error
bundle.js:2 Uncaught ReferenceError: google is not defined
With Angular Beta without gulp, I have not had the problem.
typings folder content
my ** gulpfile.js** file
var gulp = require('gulp');
gulp.task('bundle', function() {
var SystemBuilder = require('systemjs-builder');
var builder = new SystemBuilder();
builder.loadConfig('./system.config.js')
.then(function(){
var outputFile = 'dist/bundle.js';
return builder.buildStatic('app', outputFile, {
minify: true,
mangle: true,
rollup: true
});
})
.then(function(){
console.log('bundle built successfully!');
});
});
package.json
{
"name": "angular2-poc",
"scripts": {
"clean": "gulp clean",
"compile": "gulp compile",
"build": "gulp build",
"postinstall": "typings install",
"test": "tsc && karma start",
"tsc": "tsc",
"tsc:w": "tsc -w",
"lite": "lite-server",
"start": "concurrent \"npm run tsc:w\" \"npm run lite\" ",
"typings": "typings"
},
"devDependencies": {
"concurrently": "^1.0.0",
"gulp": "^3.9.1",
"gulp-concat": "^2.6.0",
"gulp-jshint": "^2.0.1",
"gulp-minify": "0.0.11",
"gulp-rename": "^1.2.2",
"gulp-sass": "^2.3.1",
"gulp-uglify": "^1.5.3",
"gulp-util": "^3.0.7",
"jasmine-core": "~2.3.4",
"jshint": "^2.9.2",
"karma": "~0.13.15",
"karma-jasmine": "~0.3.6",
"karma-phantomjs2-launcher": "^0.3.2",
"lite-server": "2.0.1",
"path": "^0.12.7",
"systemjs-builder": "^0.15.16",
"traceur": "^0.0.91",
"typescript": "^1.7.3",
"yargs": "^4.7.0"
},
"dependencies": {
"#angular/common": "2.0.0-rc.4",
"#angular/compiler": "2.0.0-rc.4",
"#angular/core": "2.0.0-rc.4",
"#angular/http": "2.0.0-rc.4",
"#angular/platform-browser": "2.0.0-rc.4",
"#angular/platform-browser-dynamic": "2.0.0-rc.4",
"#angular/router": "3.0.0-beta.1",
"#angular/upgrade": "2.0.0-rc.4",
"#angular/forms": "0.2.0",
"es6-shim": "^0.35.0",
"events": "^1.0.2",
"fbjs": "^0.3.1",
"flux": "^2.1.1",
"reflect-metadata": "^0.1.3",
"rxjs": "5.0.0-beta.6",
"systemjs": "0.19.27",
"zone.js": "^0.6.12"
}
}
My tsd.json file
{
"version": "v4",
"repo": "borisyankov/DefinitelyTyped",
"ref": "master",
"path": "typings",
"bundle": "typings/tsd.d.ts",
"installed": {
"googlemaps/google.maps.d.ts": {
"commit": "de82425735f84a10b43921ae4b1d085b3752a626"
}
}
}
Thanks you
Try loading these 2 files from your index.html
<script src="https://www.gstatic.com/charts/loader.js"></script>
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
For more details, refer this - https://developers.google.com/chart/interactive/docs/basic_load_libs
See if this helps.

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"
}
}
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.
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.