Eslint: "jsx-a11y/label-has-for" is invalid - eslint

In WebStorm, I cannot get rid of this error:
Error: /Users/kamiranoff/dev/myApp/node_modules/eslint-config-rallycoding/rules/react-a11y.js:
Configuration for rule "jsx-a11y/label-has-for" is invalid:
Value ["label"] should be object.
Referenced from: /Users/kamiranoff/dev/myApp/node_modules/eslint-config-rallycoding/index.js
Referenced from: /Users/kamiranoff/dev/myApp/.eslintrc
Error: /Users/kamiranoff/dev/myApp/node_modules/eslint-config-rallycoding/rules/react-a11y.js:
Configuration for rule "jsx-a11y/label-has-for" is invalid:
Value ["label"] should be object.
Referenced from: /Users/kamiranoff/dev/myApp/node_modules/eslint-config-rallycoding/index.js
Referenced from: /Users/kamiranoff/dev/myApp/.eslintrc
at validateRuleOptions (/Users/kamiranoff/dev/myApp/node_modules/eslint/lib/config/config-validator.js:115:15)
at Object.keys.forEach.id (/Users/kamiranoff/dev/myApp/node_modules/eslint/lib/config/config-validator.js:155:9)
at Array.forEach (<anonymous>)
at validateRules (/Users/kamiranoff/dev/myApp/node_modules/eslint/lib/config/config-validator.js:154:30)
at Object.validate (/Users/kamiranoff/dev/myApp/node_modules/eslint/lib/config/config-validator.js:232:5)
at loadFromDisk (/Users/kamiranoff/dev/myApp/node_modules/eslint/lib/config/config-file.js:507:19)
at load (/Users/kamiranoff/dev/myApp/node_modules/eslint/lib/config/config-file.js:550:20)
at configExtends.reduceRight (/Users/kamiranoff/dev/myApp/node_modules/eslint/lib/config/config-file.js:421:36)
at Array.reduceRight (<anonymous>)
at applyExtends (/Users/kamiranoff/dev/myApp/node_modules/eslint/lib/config/config-file.js:403:28)
I did try to override the local .eslintrc with:
{
"extends": "rallycoding",
"rules": {
"arrow-body-style": 0,
"quote-props": 0,
"global-require": 0,
"max-len": [
"error",
120
],
"react/require-extension": "off",
"jsx-a11y/label-has-for": 0
},
"globals": {
"__DEV__": true,
"fetch": true,
"Headers": true,
"Request": true
}
}
And setting up the WebStorm config (I just change the folder name for privacy):
And on my package.json
"dependencies": {
"as": "0.4.1",
"axios": "0.16.2",
"babel-plugin-transform-remove-console": "6.8.5",
"contentful": "4.6.4",
"eil-cid": "~1.0.0",
"eslint-config-rallycoding": "3.2.0",
"eslint-plugin-import": "^2.13.0",
"eslint-plugin-jsx-a11y": "6.0.3",
"eslint-plugin-react": "^7.10.0",
"listify": "1.0.0",
"localytics-react-native": "2.1.1",
"lodash": "4.17.5",
"lottie-react-native": "2.2.7",
"moment": "2.19.3",
"moment-timezone": "0.5.14",
"prop-types": "15.6.0",
"react": "16.0.0",
"react-dom": "16.2.0",
"react-native": "0.51.0",
"react-native-add-calendar-event": "0.3.0",
"react-native-calendars": "1.9.3",
"react-native-collapsible": "0.9.0",
"react-native-config": "0.8.1",
"react-native-dash": "^0.0.8",
"react-native-fabric": "0.5.1",
"react-native-firebase": "2.2.3",
"react-native-i18n": "2.0.9",
"react-native-iphone-x-helper": "1.0.1",
"react-native-keyboard-aware-scroll-view": "0.5.0",
"react-native-navigation": "1.1.462",
"react-native-picker": "4.3.5",
"react-native-showmedia": "file:packages/react-native-showmedia",
"react-native-swiper": "1.5.13",
"react-native-timeline-listview": "0.2.2",
"react-native-triangle": "0.0.8",
"react-native-webview-bridge": "github:EurostarDigital/react-native-webview-bridge",
"react-native-wkwebview-reborn": "1.10.0",
"react-redux": "5.0.6",
"redux": "3.7.2",
"redux-logger": "3.0.6",
"redux-persist": "4.10.2",
"redux-thunk": "2.2.0",
"tai-password-strength": "1.1.1"
},
"devDependencies": {
"babel-jest": "20.0.3",
"babel-preset-react-native": "1.9.2",
"codecov": "3.0.0",
"dotenv": "4.0.0",
"eil-content": "~2.2.2",
"enzyme": "3.3.0",
"enzyme-adapter-react-16": "1.1.1",
"eslint": "4.11.0",
"google-spreadsheet": "2.0.4",
"husky": "0.14.1",
"jest": "20.0.4",
"lint-staged": "4.0.0",
"prettier": "~1.8.2",
"react-native-mock": "0.3.1",
"react-test-renderer": "16.0.0-alpha.12",
"redux-logger": "3.0.6",
"redux-mock-store": "^1.5.1"
},
"jest": {
"preset": "react-native",
"transformIgnorePatterns": [
"node_modules/(?!react-native|react-navigation)/"
],
"setupFiles": [
"./config/testEnvironment.js"
],
"collectCoverageFrom": [
"src/**/*.js"
]
},
"lint-staged": {
"gitDir": "./",
"*.js": [
"prettier --single-quote --print-width 120 --tab-width 2 --write",
"./node_modules/eslint-config-rallycoding/node_modules/eslint/bin/eslint.js",
"git add"
]
}
How can I get rid of the error?

This issue is not specific to Webstorm, you will see the same errors when running EsLint in terminal. The problem is that "eslint-config-rallycoding" doesn't yet support v6.x of "jsx-a11y/label-has-for" plugin. You should probably file an issue to https://github.com/StephenGrider/ESLint-Rallycoding/issues on this.
The only way to get rid of the issue is downgrading both "eslint-plugin-jsx-a11y" and "eslint", like:
"eslint-plugin-jsx-a11y": "^2.2.3",
...
"eslint": "^3.19.0",
see https://github.com/sweth/react-native-udemy/commit/2dd74ca887e8b32b82ee1e37e5a290edaa657b82

Related

React + NPM Material UI: Npm install error Unable to resolve dependency tree

After installing materialUI I'm having issues when trying to run an npm install on my application that was created with create-react-app.
I've tried deleting node_modules & package_lock.json multiple times - issue persists.
I can continue to install npm packages using --force however, not ideal. I'd like to understand what the issue is here.
Error:
package.json:
{
"name": "video-upload",
"version": "0.1.0",
"private": true,
"dependencies": {
"#babel/core": "7.1.6",
"#material-ui/core": "^4.12.4",
"#mui/material": "^5.11.0",
"#svgr/webpack": "2.4.1",
"#testing-library/jest-dom": "^5.16.5",
"#testing-library/react": "^13.4.0",
"#testing-library/user-event": "^13.5.0",
"#types/jest": "^27.5.2",
"#types/node": "^16.18.4",
"#types/react": "^18.0.26",
"#types/react-dom": "^18.0.9",
"babel-core": "7.0.0-bridge.0",
"babel-eslint": "9.0.0",
"babel-jest": "23.6.0",
"babel-loader": "8.0.4",
"babel-plugin-named-asset-import": "^0.3.0",
"babel-preset-react-app": "^7.0.0",
"bfj": "6.1.1",
"case-sensitive-paths-webpack-plugin": "2.1.2",
"chalk": "2.4.1",
"css-loader": "1.0.0",
"dotenv": "6.0.0",
"dotenv-expand": "4.2.0",
"eslint": "5.6.0",
"eslint-config-react-app": "^3.0.6",
"eslint-loader": "2.1.1",
"eslint-plugin-flowtype": "2.50.1",
"eslint-plugin-import": "2.14.0",
"eslint-plugin-jsx-a11y": "6.1.2",
"eslint-plugin-react": "7.11.1",
"file-loader": "2.0.0",
"fork-ts-checker-webpack-plugin-alt": "0.4.14",
"fs-extra": "7.0.0",
"html-webpack-plugin": "4.0.0-alpha.2",
"identity-obj-proxy": "3.0.0",
"jest": "23.6.0",
"jest-pnp-resolver": "1.0.1",
"jest-resolve": "23.6.0",
"mini-css-extract-plugin": "0.4.3",
"optimize-css-assets-webpack-plugin": "5.0.1",
"pnp-webpack-plugin": "1.1.0",
"postcss-flexbugs-fixes": "4.1.0",
"postcss-loader": "3.0.0",
"postcss-preset-env": "6.3.1",
"postcss-safe-parser": "4.0.1",
"react": "^18.2.0",
"react-app-polyfill": "^0.2.0",
"react-dev-utils": "^7.0.1",
"react-dom": "^18.2.0",
"react-router-dom": "^6.4.4",
"react-scripts": "5.0.0",
"resolve": "1.8.1",
"sass-loader": "7.1.0",
"style-loader": "0.23.0",
"styled-components": "^5.3.6",
"terser-webpack-plugin": "1.1.0",
"typescript": "^4.9.3",
"url-loader": "1.1.1",
"web-vitals": "^2.1.4",
"webpack": "4.19.1",
"webpack-dev-server": "3.1.14",
"webpack-manifest-plugin": "2.0.4",
"workbox-webpack-plugin": "3.6.3"
},
"scripts": {
"start": "node scripts/start.js",
"build": "node scripts/build.js",
"test": "node scripts/test.js"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"#types/styled-components": "^5.1.26"
},
"jest": {
"collectCoverageFrom": [
"src/**/*.{js,jsx,ts,tsx}",
"!src/**/*.d.ts"
],
"resolver": "jest-pnp-resolver",
"setupFiles": [
"react-app-polyfill/jsdom"
],
"setupTestFrameworkScriptFile": "<rootDir>/src/setupTests.ts",
"testMatch": [
"<rootDir>/src/**/__tests__/**/*.{js,jsx,ts,tsx}",
"<rootDir>/src/**/?(*.)(spec|test).{js,jsx,ts,tsx}"
],
"testEnvironment": "jsdom",
"testURL": "http://localhost",
"transform": {
"^.+\\.(js|jsx|ts|tsx)$": "<rootDir>/node_modules/babel-jest",
"^.+\\.css$": "<rootDir>/config/jest/cssTransform.js",
"^(?!.*\\.(js|jsx|ts|tsx|css|json)$)": "<rootDir>/config/jest/fileTransform.js"
},
"transformIgnorePatterns": [
"[/\\\\]node_modules[/\\\\].+\\.(js|jsx|ts|tsx)$",
"^.+\\.module\\.(css|sass|scss)$"
],
"moduleNameMapper": {
"^react-native$": "react-native-web",
"^.+\\.module\\.(css|sass|scss)$": "identity-obj-proxy"
},
"moduleFileExtensions": [
"web.js",
"js",
"web.ts",
"ts",
"web.tsx",
"tsx",
"json",
"web.jsx",
"jsx",
"node"
]
},
"babel": {
"presets": [
"react-app"
]
}
}
Your package 'fe-react-app-video-upload' has a dependency on react#18.2.0
It could not match that, given you are installing an old version of MUI. As I see it, you are trying to install MUI with the old method.
The updated version of Material-UI for React, is available at the #mui/xxx org.
Now, if you really do want v4 of MUI, for some reason, you have to force install. That's because v4 has a dependency on old React, while the first package I mentioned, has a dependency on React 18.2.0; any lower version won't do, only higher versions given the ^ symbol in front.

Unable to add typescript to a react project

I'm trying to add typescript to a existing react project but I'm getting an error when re-starting the server with npm start.
I'm following the steps from this documentation but I'm getting an error message:
The only thing I might not have right is the react.scripts versions. Here is a copy of the results thrown by npm outdated:
Also, I checked my dependencies and everything seems to be normal.
Things I have done:
run npm update to update all react related packages
I have deleted the node files and re install them with npm install
I have renamed other files to .tsx including the index.js file but I get another error:
Really keen to move this project to the next level with typescript but I have been stack trying to get it to work. By the way, here are my dependencies too:
{
"name": "world-budget-react-v",
"version": "0.1.0",
"private": true,
"dependencies": {
"#fortawesome/fontawesome-svg-core": "^1.2.34",
"#fortawesome/free-brands-svg-icons": "^5.15.2",
"#fortawesome/free-solid-svg-icons": "^5.15.2",
"#fortawesome/react-fontawesome": "^0.1.14",
"#types/jest": "^26.0.23",
"#types/node": "^15.0.2",
"#types/react": "^17.0.5",
"#types/react-dom": "^17.0.3",
"#types/react-redux": "^7.1.16",
"autoprefixer": "7.1.6",
"axios": "^0.21.1",
"babel-core": "6.26.0",
"babel-eslint": "7.2.3",
"babel-jest": "20.0.3",
"babel-loader": "7.1.2",
"babel-preset-react-app": "^3.1.2",
"babel-runtime": "6.26.0",
"case-sensitive-paths-webpack-plugin": "2.1.1",
"chalk": "1.1.3",
"css-loader": "0.28.7",
"dotenv": "4.0.0",
"dotenv-expand": "4.2.0",
"enzyme": "^3.11.0",
"enzyme-adapter-react-16": "^1.15.6",
"eslint": "4.10.0",
"eslint-config-react-app": "^2.1.0",
"eslint-loader": "1.9.0",
"eslint-plugin-flowtype": "2.39.1",
"eslint-plugin-import": "2.8.0",
"eslint-plugin-jsx-a11y": "5.1.1",
"eslint-plugin-react": "7.4.0",
"extract-text-webpack-plugin": "3.0.2",
"file-loader": "1.1.5",
"firebase": "^8.2.6",
"firebase-admin": "^9.4.2",
"firebase-functions": "^3.13.1",
"fs-extra": "3.0.1",
"html-webpack-plugin": "2.29.0",
"jest": "20.0.4",
"object-assign": "4.1.1",
"postcss-flexbugs-fixes": "3.2.0",
"postcss-loader": "2.0.8",
"promise": "8.0.1",
"raf": "3.4.0",
"react": "^17.0.2",
"react-dev-utils": "^5.0.2",
"react-dom": "^17.0.2",
"react-gtm-module": "^2.0.11",
"react-redux": "^7.2.2",
"react-router": "^5.2.0",
"react-router-dom": "^5.2.0",
"react-scroll-restoration": "^1.0.6",
"react-test-renderer": "^17.0.1",
"redux": "^4.1.0",
"redux-thunk": "^2.3.0",
"resolve": "1.6.0",
"style-loader": "0.19.0",
"sw-precache-webpack-plugin": "0.11.4",
"typescript": "^4.2.4",
"url-loader": "0.6.2",
"webpack": "3.8.1",
"webpack-dev-server": "2.11.3",
"webpack-manifest-plugin": "1.3.2",
"whatwg-fetch": "2.0.3"
},
"scripts": {
"start": "node scripts/start.js",
"build": "node scripts/build.js",
"test": "node scripts/test.js --env=jsdom"
},
"jest": {
"collectCoverageFrom": [
"src/**/*.{js,jsx,mjs}"
],
"setupFiles": [
"<rootDir>/config/polyfills.js"
],
"testMatch": [
"<rootDir>/src/**/__tests__/**/*.{js,jsx,mjs}",
"<rootDir>/src/**/?(*.)(spec|test).{js,jsx,mjs}"
],
"testEnvironment": "node",
"testURL": "http://localhost",
"transform": {
"^.+\\.(js|jsx|mjs)$": "<rootDir>/node_modules/babel-jest",
"^.+\\.css$": "<rootDir>/config/jest/cssTransform.js",
"^(?!.*\\.(js|jsx|mjs|css|json)$)": "<rootDir>/config/jest/fileTransform.js"
},
"transformIgnorePatterns": [
"[/\\\\]node_modules[/\\\\].+\\.(js|jsx|mjs)$"
],
"moduleNameMapper": {
"^react-native$": "react-native-web"
},
"moduleFileExtensions": [
"web.js",
"js",
"json",
"web.jsx",
"jsx",
"node",
"mjs"
]
},
"babel": {
"presets": [
"react-app"
]
},
"eslintConfig": {
"extends": "react-app"
}
}
Any recommendations? I hope I provided as much info as possible!
Lastly, I found this answer but not sure what they mean. Anyone keen to explain maybe Could not find a required file. - Adding TypeScript to React project
As per the react-scripts 2.10 you can add TypeScript to an existing project.
yarn add typescript #types/node #types/react #types/react-dom #types/jest --dev
Create a react-native app using : npx react-native init AwesomeProject
Once its up and running, follow this link to add typescript the right way.

Errors prevented bundling: While processing files with ecmascript (for target web.browser):

I tried to run the command meteor build --directory . to build a bundle directory for the meteor app then I got errors like as follows:
Errors prevented bundling:
While processing files with ecmascript (for target web.browser):
/home/takhi_abed/.meteor/packages/ecmascript/.0.10.2.113xul7.mfme++os+web.browser+web.cordova/plugin.compile-ecmascript.os/npm/node_modules/meteor/babel-compiler/node_modules/
#babel/core/lib/config/validation/option-assertions.js:146:13:
[BABEL] bundle/programs/web.browser/app/scripts/vendor/modernizr.js: .plugins[0] may only be a two-tuple or three-tuple
at assertPluginItem
(/home/takhi_abed/.meteor/packages/ecmascript/.0.10.2.113xul7.mfme++os+web.browser+web.cordova/plugin.compile-ecmascript.os/npm/node_modules/meteor/babel-compiler/node_modules
/#babel/core/lib/config/validation/option-assertions.js:146:13)
at
/home/takhi_abed/.meteor/packages/ecmascript/.0.10.2.113xul7.mfme++os+web.browser+web.cordova/plugin.compile-ecmascript.os/npm/node_modules/meteor/babel-compiler/node_modules/
#babel/core/lib/config/validation/option-assertions.js:132:14
at Array.forEach (<anonymous>)
at assertPluginList
(/home/takhi_abed/.meteor/packages/ecmascript/.0.10.2.113xul7.mfme++os+web.browser+web.cordova/plugin.compile-ecmascript.os/npm/node_modules/meteor/babel-compiler/node_modules
/#babel/core/lib/config/validation/option-assertions.js:131:9)
at
/home/takhi_abed/.meteor/packages/ecmascript/.0.10.2.113xul7.mfme++os+web.browser+web.cordova/plugin.compile-ecmascript.os/npm/node_modules/meteor/babel-compiler/node_modules/
#babel/core/lib/config/validation/options.js:83:20
at Array.forEach (<anonymous>)
at validate
(/home/takhi_abed/.meteor/packages/ecmascript/.0.10.2.113xul7.mfme++os+web.browser+web.cordova/plugin.compile-ecmascript.os/npm/node_modules/meteor/babel-compiler/node_modules
/#babel/core/lib/config/validation/options.js:61:21)
at
/home/takhi_abed/.meteor/packages/ecmascript/.0.10.2.113xul7.mfme++os+web.browser+web.cordova/plugin.compile-ecmascript.os/npm/node_modules/meteor/babel-compiler/node_modules/
#babel/core/lib/config/index.js:246:36
at cachedFunction
(/home/takhi_abed/.meteor/packages/ecmascript/.0.10.2.113xul7.mfme++os+web.browser+web.cordova/plugin.compile-ecmascript.os/npm/node_modules/meteor/babel-compiler/node_modules
/#babel/core/lib/config/caching.js:40:17)
at loadPresetDescriptor...and more lines like these. I looked into some issues on stackoverflow and github and found some commands like meteor npm install --save babel-runtime and tried them but still the same errors show up. It would be great if someone can help.
Here is the .babelrc file:
```
{
"presets": [
],
"plugins": [
[
"transform-class-properties",
"babel-plugin-inline-import",
"babel-plugin-inline-import-graphql-ast",
{
"extensions": [
".graphqls",
".graphql"
]
}
]
]
}```
and here is package.json file:
```{
"name": "enliven-frontend",
"version": "1.8.9",
"engines": {
"npm": "^3.0"
},
"scripts": {
"prestart": "sh prestart_vulcan.sh",
"start": "meteor --settings settings-development.json",
"start-the-show": "meteor --settings settings-production.json",
"lint": "eslint --cache --ext .jsx,js packages"
},
"dependencies": {
"#babel/runtime": "^7.0.0-beta.55",
"analytics-node": "^2.4.1",
"apollo-client": "^1.9.1",
"apollo-engine": "^0.5.4",
"apollo-errors": "^1.4.0",
"apollo-server-express": "^1.3.2",
"bcrypt": "^1.0.3",
"body-parser": "^1.18.2",
"chalk": "2.2.0",
"classnames": "^2.2.5",
"cloudflare": "^2.4.1",
"compression": "^1.7.1",
"cookie-parser": "^1.4.3",
"cross-fetch": "^0.0.8",
"crypto-js": "^3.1.9-1",
"dataloader": "^1.3.0",
"deepmerge": "^1.5.0",
"escape-string-regexp": "^1.0.5",
"express": "^4.15.4",
"flat": "^4.0.0",
"formsy-react": "^0.19.5",
"formsy-react-components": "^0.11.1",
"graphql": "^0.10.5",
"graphql-anywhere": "^3.0.1",
"graphql-date": "^1.0.2",
"graphql-tag": "^2.0.0",
"graphql-tools": "^2.19.0",
"graphql-type-json": "^0.1.4",
"handlebars": "^4.0.10",
"he": "^1.1.1",
"history": "^3.3.0",
"html-to-text": "^2.1.3",
"immutability-helper": "^2.3.1",
"import": "0.0.6",
"install": "^0.10.1",
"intl": "^1.2.5",
"intl-locales-supported": "^1.0.0",
"isomorphic-fetch": "^2.2.1",
"json-path": "^0.1.3",
"juice": "^1.11.0",
"lodash": "^4.17.5",
"mailchimp": "^1.2.0",
"marked": "^0.3.9",
"metascraper": "^1.0.7",
"meteor-node-stubs": "^0.3.2",
"mingo": "^0.8.1",
"moment": "^2.18.1",
"new-relic-agent-react": "^2.0.1",
"optics-agent": "^1.1.6",
"photoswipe": "^4.1.2",
"prop-types": "^15.5.10",
"rangy": "^1.3.0",
"react": "^16.2.0",
"react-addons-pure-render-mixin": "^15.6.0",
"react-apollo": "^1.4.15",
"react-bootstrap": "^0.32.0",
"react-bootstrap-datetimepicker": "0.0.22",
"react-cookie": "^0.4.9",
"react-country-region-selector": "^1.1.0",
"react-datetime": "^2.11.1",
"react-dfp": "^0.7.5",
"react-dom": "^16.2.0",
"react-dropzone": "^3.13.4",
"react-flexview": "^1.0.13",
"react-headroom": "^2.2.1",
"react-helmet": "^5.2.0",
"react-image-smooth-loading": "^2.0.0",
"react-intl": "^2.3.0",
"react-lazyload": "^2.3.0",
"react-load-script": "0.0.6",
"react-loadable": "^4.0.4",
"react-masonry-component": "^5.0.7",
"react-places-autocomplete": "^5.4.2",
"react-progressive-image-loading": "^3.0.2",
"react-redux": "^5.0.6",
"react-router": "^3.2.0",
"react-router-bootstrap": "^0.23.3",
"react-router-scroll": "^0.4.4",
"react-sidebar": "^2.3.2",
"react-stripe-checkout": "^2.4.0",
"react-swipeable": "^4.3.0",
"recompose": "^0.26.0",
"redux": "^3.7.2",
"rss": "^1.2.2",
"sanitize-html": "^1.16.3",
"sendy-api": "^0.1.0",
"simpl-schema": "^0.2.3",
"sitemap": "^1.13.0",
"speakingurl": "^9.0.0",
"stripe": "^4.24.0",
"styled-components": "^2.1.2",
"tracker-component": "^1.3.21",
"twit": "^2.2.9",
"underscore": "^1.8.3",
"url": "^0.11.0"
},
`` "private": true,
"devDependencies": {
"autoprefixer": "^7.1.2",
"babel-eslint": "^7.0.0",
"babel-plugin-inline-import": "^2.0.6",
"babel-plugin-inline-import-graphql-ast": "^2.0.0",
"babel-plugin-transform-class-properties": "^6.24.1",
"babel-preset-env": "^1.6.0",
"babel-preset-react": "^6.24.1",
"babel-preset-stage-3": "^6.24.1",
"compass-sass-mixins": "^0.12.7",
"eslint": "^3.10.1",
"eslint-config-airbnb": "^13.0.0",
"eslint-config-meteor": "0.0.9",
"eslint-import-resolver-meteor": "^0.3.3",
"eslint-plugin-babel": "^3.3.0",
"eslint-plugin-import": "^2.7.0",
"eslint-plugin-jsx-a11y": "^2.2.3",
"eslint-plugin-meteor": "^4.0.1",
"eslint-plugin-prettier": "^2.5.0",
"eslint-plugin-react": "^6.7.1"
},
"postcss": {
"plugins": {
"postcss-easy-import": {
"extensions": [
".css",
".scss",
".import.css"
],
"prefix": "_"
},
"postcss-simple-vars": {},
"postcss-sassy-mixins": {},
"postcss-nested": {},
"autoprefixer": {
"browsers": [
"last 2 versions"
]
}
},
"parser": "postcss-scss"
},
"cssModules": {
"ignorePaths": [
"node_modules",
"bower_components"
]
},
"description": "## Requirements",
"main": "mobile-config.js",
"repository": {
"type": "git",
"url": "git+ssh://git#gitlab.com/enliven/enliven-frontend.git"
},
"author": "",
"license": "ISC",
"bugs": {
"url": "https://gitlab.com/enliven/enliven-frontend/issues"
},
"homepage": "https://gitlab.com/enliven/enliven-frontend#README"
}```
I don’t think that you are able to create a bundle into the . folder.
You are meant to pass it the folder in which to store the bundled files which must be different. I would suggest that you create a .bundle folder and pass that to the bundle command. The dot is important because meteor will ignore folders and files beginning with a dot

How to get node packages up-to-date?

I've used a truffle react box to get an app working. npm install gives me lots of deprecation warnings, and alos that some packages need others that aren't installed. Is there a good way, or a place online, that can get my package.json file up to date? Since I'm really new to react, I think having missing packages is sure to cause a lot of lost time. Thank you.
package.json
{
"name": "someApp",
"version": "0.1.0",
"license": "MIT",
"private": true,
"repository": {
"type": "git",
"url": "some repo..."
},
"main": "src/index.js",
"scripts": {
"start": "node scripts/start.js",
"build": "node scripts/build.js",
"test": "node scripts/test.js --env=jsdom --watch"
},
"dependencies": {
"dotenv": "^2.0.0",
"react": "^15.4.2",
"react-dom": "^15.4.2",
"react-router-dom": "^4.3.1"
},
"devDependencies": {
"autoprefixer": "6.5.1",
"babel-core": "6.17.0",
"babel-eslint": "7.1.1",
"babel-jest": "17.0.2",
"babel-loader": "6.2.7",
"babel-preset-react-app": "^2.0.1",
"case-sensitive-paths-webpack-plugin": "1.1.4",
"chalk": "1.1.3",
"connect-history-api-fallback": "1.3.0",
"cross-spawn": "4.0.2",
"css-loader": "0.26.0",
"debug": "^3.1.0",
"detect-port": "1.0.1",
"eslint": "3.8.1",
"eslint-config-react-app": "^0.5.0",
"eslint-loader": "1.6.0",
"eslint-plugin-flowtype": "2.21.0",
"eslint-plugin-import": "^2.13.0",
"eslint-plugin-jsx-a11y": "2.2.3",
"eslint-plugin-react": "6.4.1",
"extract-text-webpack-plugin": "1.0.1",
"file-loader": "0.9.0",
"filesize": "3.3.0",
"fs-extra": "0.30.0",
"growl": "^1.10.2",
"gzip-size": "3.0.0",
"html-webpack-plugin": "2.24.0",
"http-proxy-middleware": "0.17.2",
"jest": "19.0.1",
"json-loader": "0.5.4",
"minimatch": "^3.0.2",
"object-assign": "4.1.0",
"openzeppelin-solidity": "1.11.0",
"path-exists": "2.1.0",
"postcss-loader": "1.0.0",
"promise": "7.1.1",
"react-dev-utils": "^0.4.2",
"recursive-readdir": "2.1.0",
"stmux": "^1.5.5",
"strip-ansi": "3.0.1",
"style-loader": "0.13.1",
"truffle": "^4.1.13",
"truffle-contract": "^1.1.8",
"truffle-hdwallet-provider": "0.0.6",
"truffle-solidity-loader": "0.0.8",
"url-loader": "^1.0.1",
"webpack": "^1.14.0",
"webpack-dev-server": "^1.16.2",
"webpack-manifest-plugin": "^1.1.0",
"whatwg-fetch": "^1.0.0"
},
"jest": {
"collectCoverageFrom": [
"src/**/*.{js,jsx}"
],
"setupFiles": [
"<rootDir>/config/polyfills.js"
],
"testMatch": [
"<rootDir>/src/**/__tests__/**/*.js?(x)",
"<rootDir>/coverage/**/?(*.)(spec|test).js?(x)"
],
"testEnvironment": "node",
"testURL": "http://127.0.0.1:7200",
"transform": {
"^.+\\.(js|jsx)$": "<rootDir>/node_modules/babel-jest",
"^.+\\.css$": "<rootDir>/config/jest/cssTransform.js",
"^(?!.*\\.(js|jsx|css|json)$)": "<rootDir>/config/jest/fileTransform.js"
},
"transformIgnorePatterns": [
"[/\\\\]node_modules[/\\\\].+\\.(js|jsx)$"
],
"moduleNameMapper": {
"^react-native$": "react-native-web"
},
"moduleFileExtensions": [
"web.js",
"js",
"json",
"web.jsx",
"jsx"
]
},
"babel": {
"presets": [
"react-app"
]
},
"eslintConfig": {
"extends": "react-app"
}
}
A really cool package i've used is npm-check
It provides a nice interface to tell you what packages are outdated.
interface image
to install the package, run in your terminal: npm install -g npm-check
To check packages, run: npm-check in the directory that contains the package.json you are checking.

unable to import THREE.js in es6

I'm trying to show a three.js scene inside a div using create react app. However, it throws an undefined THREE.
Tried
npm install --save three
import * as THREE from 'three'
But doesn't seem to work, it always throws THREE is not defined no-undef. Kindly have a look at my repo as well. https://github.com/priyakrishnadev/webglapp
Update:
{
"name": "my-app",
"version": "0.1.0",
"private": true,
"dependencies": {
"autoprefixer": "7.1.6",
"axios": "^0.16.2",
"babel-core": "6.26.0",
"babel-eslint": "7.2.3",
"babel-jest": "20.0.3",
"babel-loader": "7.1.2",
"babel-polyfill": "^6.26.0",
"babel-preset-react-app": "^3.1.0",
"babel-runtime": "6.26.0",
"case-sensitive-paths-webpack-plugin": "2.1.1",
"chalk": "1.1.3",
"classnames": "^2.2.5",
"css-loader": "0.28.7",
"dotenv": "4.0.0",
"eslint": "4.10.0",
"eslint-config-react-app": "^2.0.1",
"eslint-loader": "1.9.0",
"eslint-plugin-flowtype": "2.39.1",
"eslint-plugin-import": "2.8.0",
"eslint-plugin-jsx-a11y": "5.1.1",
"eslint-plugin-react": "7.4.0",
"extract-text-webpack-plugin": "3.0.2",
"file-loader": "1.1.5",
"fs-extra": "3.0.1",
"html-webpack-plugin": "2.29.0",
"jest": "20.0.4",
"lodash": "^4.17.4",
"object-assign": "4.1.1",
"postcss-flexbugs-fixes": "3.2.0",
"postcss-loader": "2.0.8",
"promise": "8.0.1",
"prop-types": "^15.6.0",
"raf": "3.4.0",
"react": "^16.1.0",
"react-dev-utils": "^4.2.1",
"react-dom": "^16.1.0",
"react-redux": "^5.0.6",
"react-router-dom": "^4.2.2",
"react-timeago": "3.4.3",
"redux": "^3.7.2",
"redux-devtools-extension": "^2.13.2",
"redux-form": "^7.0.4",
"redux-logger": "^3.0.6",
"redux-thunk": "^2.2.0",
"style-loader": "0.19.0",
"sw-precache-webpack-plugin": "0.11.4",
"three": "^0.88.0",
"timeago-react": "^2.0.0",
"url-loader": "0.6.2",
"uuid": "^3.1.0",
"webpack": "3.8.1",
"webpack-dev-server": "2.9.4",
"webpack-manifest-plugin": "1.3.2",
"whatwg-fetch": "2.0.3"
},
"scripts": {
"start": "node scripts/start.js",
"build": "node scripts/build.js",
"test": "node scripts/test.js --env=jsdom"
},
"jest": {
"collectCoverageFrom": [
"src/**/*.{js,jsx,mjs}"
],
"setupFiles": [
"<rootDir>/config/polyfills.js"
],
"testMatch": [
"<rootDir>/src/**/__tests__/**/*.{js,jsx,mjs}",
"<rootDir>/src/**/?(*.)(spec|test).{js,jsx,mjs}"
],
"testEnvironment": "node",
"testURL": "http://localhost",
"transform": {
"^.+\\.(js|jsx|mjs)$": "<rootDir>/node_modules/babel-jest",
"^.+\\.css$": "<rootDir>/config/jest/cssTransform.js",
"^(?!.*\\.(js|jsx|mjs|css|json)$)": "<rootDir>/config/jest/fileTransform.js"
},
"transformIgnorePatterns": [
"[/\\\\]node_modules[/\\\\].+\\.(js|jsx|mjs)$"
],
"moduleNameMapper": {
"^react-native$": "react-native-web"
},
"moduleFileExtensions": [
"web.js",
"mjs",
"js",
"json",
"web.jsx",
"jsx",
"node"
]
},
"babel": {
"presets": [
"react-app"
]
},
"eslintConfig": {
"extends": "react-app"
}
}
The problem is is that you are importing THREE as es6 modules, but then trying to include DDSLoader, MTLLoader and OBJLoader which are not in THREE and are not set up as modules (as they are in the /exmaples/js/ folder in three.js).
You need to use versions that are set up as modules. eg three-obj-loader.
There are a few of these, and some are set up differently from others, some even set up specifically for use with react, so you are going to have to look at how to implement the one you choose. Search for them on the npm site.
An example of using three-obj-loader can be seen as an answer on this stack question.

Resources