#nrwl/nx + VS Code + ESLint - Errors highlighting doesn't work - eslint

Linting shows errors in terminal but won't highlight the code in VS Code. ESLint extension is installed.
Running nx lint:
yarn run v1.22.10
$ nx lint
> nx run public:lint [existing outputs match the cache, left as is]
Linting "public"...
/Users/honzachalupa/Projects Repositories/- BrightWorks/darek-na-svatbu/packages/public/src/components/organisms/content-blocks/About.tsx
11:8 warning React Hook useEffect has a missing dependency: 'setNavigationRef'. Either include it or remove the dependency array react-hooks/exhaustive-deps
/Users/honzachalupa/Projects Repositories/- BrightWorks/darek-na-svatbu/packages/public/src/components/organisms/content-blocks/FAQ.tsx
11:8 warning React Hook useEffect has a missing dependency: 'setNavigationRef'. Either include it or remove the dependency array react-hooks/exhaustive-deps
/Users/honzachalupa/Projects Repositories/- BrightWorks/darek-na-svatbu/packages/public/src/components/organisms/content-blocks/HowItWorks.tsx
11:8 warning React Hook useEffect has a missing dependency: 'setNavigationRef'. Either include it or remove the dependency array react-hooks/exhaustive-deps
/Users/honzachalupa/Projects Repositories/- BrightWorks/darek-na-svatbu/packages/public/src/components/organisms/forms/EventCreate_Step1.tsx
52:20 warning Forbidden non-null assertion #typescript-eslint/no-non-null-assertion
/Users/honzachalupa/Projects Repositories/- BrightWorks/darek-na-svatbu/packages/public/src/components/organisms/forms/EventCreate_Step2.tsx
53:17 warning Forbidden non-null assertion #typescript-eslint/no-non-null-assertion
/Users/honzachalupa/Projects Repositories/- BrightWorks/darek-na-svatbu/packages/public/src/helpers/firebase.ts
41:5 warning Forbidden non-null assertion #typescript-eslint/no-non-null-assertion
/Users/honzachalupa/Projects Repositories/- BrightWorks/darek-na-svatbu/packages/public/src/pages/Event/Checkout/Checkout.tsx
106:43 warning Forbidden non-null assertion #typescript-eslint/no-non-null-assertion
110:50 warning Forbidden non-null assertion #typescript-eslint/no-non-null-assertion
/Users/honzachalupa/Projects Repositories/- BrightWorks/darek-na-svatbu/packages/public/src/pages/Event/Detail/Detail.tsx
64:30 warning Forbidden non-null assertion #typescript-eslint/no-non-null-assertion
/Users/honzachalupa/Projects Repositories/- BrightWorks/darek-na-svatbu/packages/public/src/pages/Event/Detail/components/Catalog/Catalog.tsx
134:35 warning Forbidden non-null assertion #typescript-eslint/no-non-null-assertion
265:49 warning Forbidden non-null assertion #typescript-eslint/no-non-null-assertion
/Users/honzachalupa/Projects Repositories/- BrightWorks/darek-na-svatbu/packages/public/src/pages/Event/Edit/Edit.tsx
28:32 warning Forbidden non-null assertion #typescript-eslint/no-non-null-assertion
✖ 12 problems (0 errors, 12 warnings)
———————————————————————————————————————————————
> NX SUCCESS Running target "lint" succeeded
Nx read the output from cache instead of running the command for 1 out of 1 tasks.
> NX CLOUD See run details at https://nx.app/runs/jfvJdo71MxA
✨ Done in 1.27s.
package.json dependencies:
...,
"dependencies": {
"#firebase/firestore": "^3.4.1",
"#react-pdf/renderer": "^2.0.21",
"core-js": "^3.20.0",
"firebase": "^9.6.1",
"firebase-admin": "^10.0.1",
"firebase-functions": "^3.16.0",
"logrocket": "^2.1.2",
"moment": "^2.29.1",
"polished": "^4.1.3",
"react": "17.0.2",
"react-day-picker": "^7.4.10",
"react-dom": "17.0.2",
"react-hook-form": "^7.22.2",
"react-icons": "^4.3.1",
"react-is": "17.0.2",
"react-qr-code": "^2.0.3",
"react-responsive-carousel": "^3.2.22",
"regenerator-runtime": "0.13.9",
"styled-components": "5.3.3",
"tslib": "^2.3.1",
"usehooks-ts": "^2.1.1"
},
"devDependencies": {
"#angular-devkit/schematics": "^13.1.2",
"#babel/core": "7.16.5",
"#babel/preset-typescript": "7.16.5",
"#nrwl/cli": "13.3.9",
"#nrwl/cypress": "13.3.9",
"#nrwl/eslint-plugin-nx": "13.3.9",
"#nrwl/jest": "13.3.9",
"#nrwl/linter": "13.3.9",
"#nrwl/node": "^13.3.9",
"#nrwl/nx-cloud": "latest",
"#nrwl/react": "13.3.9",
"#nrwl/storybook": "13.3.9",
"#nrwl/tao": "13.3.9",
"#nrwl/web": "13.3.9",
"#nrwl/workspace": "13.3.9",
"#storybook/addon-essentials": "~6.4.9",
"#storybook/addon-storyshots": "^6.4.9",
"#storybook/builder-webpack5": "~6.4.9",
"#storybook/manager-webpack5": "~6.4.9",
"#storybook/react": "~6.4.9",
"#svgr/webpack": "^6.1.2",
"#testing-library/react": "12.1.2",
"#testing-library/react-hooks": "7.0.2",
"#types/jest": "27.0.3",
"#types/node": "17.0.0",
"#types/react": "17.0.37",
"#types/react-dom": "17.0.11",
"#types/react-is": "17.0.3",
"#types/styled-components": "5.1.18",
"#typescript-eslint/eslint-plugin": "~5.7.0",
"#typescript-eslint/parser": "~5.7.0",
"assert": "^2.0.0",
"babel-jest": "27.4.5",
"babel-loader": "8.2.3",
"babel-plugin-styled-components": "2.0.2",
"browserify-zlib": "^0.2.0",
"buffer": "^6.0.3",
"cypress": "^9.1.1",
"eslint": "8.5.0",
"eslint-config-prettier": "8.3.0",
"eslint-plugin-cypress": "^2.12.1",
"eslint-plugin-import": "2.25.3",
"eslint-plugin-jsx-a11y": "6.5.1",
"eslint-plugin-react": "7.27.1",
"eslint-plugin-react-hooks": "^4.3.0",
"jest": "27.4.5",
"jest-styled-components": "^7.0.8",
"prettier": "^2.5.1",
"react-test-renderer": "17.0.2",
"stream-browserify": "^3.0.0",
"ts-jest": "27.1.2",
"typescript": "~4.5.4",
"url-loader": "^4.1.1",
"workbox-webpack-plugin": "^6.4.2"
}
}
Workspace's .eslintrc.json:
"root": true,
"ignorePatterns": ["**/*"],
"plugins": ["#nrwl/nx"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {
"#nrwl/nx/enforce-module-boundaries": [
"error",
{
"enforceBuildableLibDependency": true,
"allow": [],
"depConstraints": [
{
"sourceTag": "*",
"onlyDependOnLibsWithTags": ["*"]
}
]
}
],
"react/jsx-pascal-case": 0
}
},
{
"files": ["*.ts", "*.tsx"],
"extends": ["plugin:#nrwl/nx/typescript"],
"rules": {
"#typescript-eslint/ban-ts-comment": 0,
"#typescript-eslint/no-explicit-any": 0,
"#typescript-eslint/no-empty-function": 0
}
},
{
"files": ["*.js", "*.jsx"],
"extends": ["plugin:#nrwl/nx/javascript"],
"rules": {}
}
]
}
Project's .eslintrc.json:
"extends": ["plugin:#nrwl/nx/react", "../../.eslintrc.json"],
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"parserOptions": {
"project": ["apps/public/tsconfig.*?.json"]
},
"rules": {}
},
{
"files": ["*.ts", "*.tsx"],
"rules": {}
},
{
"files": ["*.js", "*.jsx"],
"rules": {}
}
]
}

Not sure if it's the same problem, but I managed to at least format the code on save, even if it's not showing the errors.
I changed my settings.json on VSCode to add editor.defaultFormatter, and my typescript settings looks like this:
"[typescript]": {
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.codeActionsOnSave": {
"source.fixAll": true,
}
},

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.

ESLint: Definition for rule 'jest/valid-describe' was not found. (jest/valid-describe)

After upgrading eslint to 8, I got the following error on every test module:
error Definition for rule 'jest/valid-describe' was not found jest/valid-describe
part of the eslintrc.json :
{
"extends": [
"eslint:recommended",
"plugin:#typescript-eslint/recommended",
"plugin:import/errors",
"plugin:import/warnings",
"plugin:import/typescript",
"plugin:jest/recommended"
],
"plugins": ["#typescript-eslint", "import", "jest"],
"env": {
"jest/globals": true
},
"parser": "#typescript-eslint/parser",
// ...
}
and the packages versions are:
"#types/jest": "^27.0.3",
"#typescript-eslint/eslint-plugin": "^5.4.0",
"#typescript-eslint/experimental-utils": "^4.28.4",
"#typescript-eslint/parser": "^5.4.0",
"eslint": "^8.3.0",
"eslint-config-react-app": "^6.0.0",
"eslint-plugin-flowtype": "^8.0.3",
"eslint-plugin-import": "^2.25.3",
"eslint-plugin-jest": "^25.3.0",
"eslint-plugin-jsx-a11y": "^6.4.1",
"eslint-plugin-react": "^7.24.0",
"eslint-plugin-react-hooks": "^4.3.0",
"eslint-plugin-testing-library": "^5.0.0",
"jest": "^27.0.6",
"ts-jest": "^27.0.4",
any ideas ?
The rule was renamed to valid-describe-callback in eslint-plugin-jest#25.0.0, which you updated past. You will need to rename any config which references the old rule.
See
valid-describe: rename to valid-describe-callback (f3e9e9a)
https://github.com/jest-community/eslint-plugin-jest/releases/tag/v25.0.0

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.

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

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

Unknown plugin "Relay" - React, GraphQL and Relay

I'm a beginner in GraphQL. I just started to follow the tutorial in Here But I'm getting this compilation problem:
Unknown plugin "Relay"
This is my package.json
{
"name": "hackernews-react-relay",
"version": "0.1.0",
"private": true,
"dependencies": {
"autoprefixer": "7.1.2",
"babel-core": "^6.5.2",
"babel-eslint": "7.2.3",
"babel-jest": "20.0.3",
"babel-loader": "7.1.1",
"babel-preset-react-app": "^3.0.2",
"babel-runtime": "6.26.0",
"case-sensitive-paths-webpack-plugin": "2.1.1",
"chalk": "1.1.3",
"css-loader": "0.28.4",
"dotenv": "4.0.0",
"eslint": "4.4.1",
"eslint-config-react-app": "^2.0.0",
"eslint-loader": "1.9.0",
"eslint-plugin-flowtype": "2.35.0",
"eslint-plugin-import": "2.7.0",
"eslint-plugin-jsx-a11y": "5.1.1",
"eslint-plugin-react": "7.1.0",
"extract-text-webpack-plugin": "3.0.0",
"file-loader": "0.11.2",
"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.6",
"promise": "8.0.1",
"react": "^15.6.1",
"react-dev-utils": "^4.0.1",
"react-dom": "^15.6.1",
"react-relay": "^1.3.0",
"style-loader": "0.18.2",
"sw-precache-webpack-plugin": "0.11.4",
"url-loader": "0.5.9",
"webpack": "3.5.1",
"webpack-dev-server": "2.7.1",
"webpack-manifest-plugin": "1.2.1",
"whatwg-fetch": "2.0.3"
},
"scripts": {
"start": "node scripts/start.js",
"build": "node scripts/build.js",
"test": "node scripts/test.js --env=jsdom"
},
"devDependencies": {
"babel-plugin-relay": "^1.3.0",
"relay-compiler": "^1.3.0"
},
"jest": {
"collectCoverageFrom": [
"src/**/*.{js,jsx}"
],
"setupFiles": [
"<rootDir>/config/polyfills.js"
],
"testMatch": [
"<rootDir>/src/**/__tests__/**/*.js?(x)",
"<rootDir>/src/**/?(*.)(spec|test).js?(x)"
],
"testEnvironment": "node",
"testURL": "http://localhost",
"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",
"node"
]
},
"babel": {
"presets": [
"react-app"
],
"plugins": [
"relay"
]
},
"eslintConfig": {
"extends": "react-app"
}
}
I'm following step by step the tutorial mentioned above.
OS: Ubuntu 17.04
Node 8.0.0
npm 5.0.0
I've already trying to solve this problem by adding this to babel-presets
"es2015",
"stage-0",
"react"
and this to babel plugins
"babel-relay-plugin-loader"
But nothing works.
Instead of providing a relay option in your plugins definition, you can create a file called for example babelRelayPlugin.js and put the plugin definition there since the plugin needs to load the schema before used.
There you can import the getBabelRelayPlugin pass in the schema and export it back.
import getbabelRelayPlugin from 'babel-relay-plugin';
import schema from '../schema/schema.json';
export default getbabelRelayPlugin(schema.data);
Then use this file in your plugins definition instead.
"babel": {
"presets": [
"react-app"
],
"plugins": [
"./babelRelayPlugin"
]
},
"eslintConfig": {
"extends": "react-app"
}
}
note: I am assuming that both the package.json and the babelRelayPlugin.js files live in the same directory

Resources