How does doing an "npm install" install git hooks? - npm

I am newly(ish) responsible for a git repository. When I clone it and look in the .git/hooks directory, there are only sample hooks.
We use NPM as our package manager for the front end UI. After I run an "npm install", I 'all of a sudden' have real git hooks in .git/hooks. How does this work? What am I looking for?
I figure it is some kind of hook, but I am not sure where to start looking to track it down. In my package.json file I see tslint-react-hooks (TSLint rule that enforces the Rules of Hooks) and react-hook-form (Performant, flexible and extensible forms with easy-to-use validation.), but I think these are red herrings.
I've seen this question Putting Git hooks into a repository which talks about getting hooks in place, but I don't see how it happens for this project.
Here is a copy of my package.json file. Thanks for any insights.
{
"name": "ram",
"version": "1.0.0",
"description": "RAM UI Build Tools",
"scripts": {
"test": "jest --coverage --watchAll",
"testOnce": "jest",
"build": "cross-env NODE_ENV=production node ./Config/prod.js",
"build:dev": "cross-env NODE_ENV=development node ./Config/dev-noserver.js",
"dev": "cross-env NODE_ENV=development nodemon -e js,ts,tsx,json,scss ./Config/dev-noserver.js",
"start": "cross-env NODE_ENV=development node ./Config/dev.js",
"start:full": "webpack-dev-server --progress --config ./Config/dev-noserver-hot.js",
"precommit": "lint-staged"
},
"lint-staged": {
"*.{js,ts,tsx,json,scss}": [
"prettier --write",
"git add"
],
"*.scss": [
"stylelint --fix",
"git add"
],
"*.{ts,tsx}": [
"tslint --fix",
"git add"
]
},
"prettier": {
"singleQuote": true,
"tabWidth": 4,
"printWidth": 120
},
"jest": {
"moduleFileExtensions": [
"ts",
"tsx",
"js"
],
"transform": {
"^.+\\.tsx?$": "ts-jest"
},
"testMatch": [
"**/?(*.)(spec|test).ts?(x)"
],
"modulePaths": [
"<rootDir>/Content"
],
"testPathIgnorePatterns": [
"/node_modules",
"./Config"
],
"collectCoverage": true,
"collectCoverageFrom": [
"**/*.*",
"!**/*.json",
"!**/index.ts"
],
"coveragePathIgnorePatterns": [
"/node_modules/",
"./Config",
"./coverage",
"./Types",
"__snapshots__",
"__tests__",
"index.tsx",
"./Content/Pages",
"./Content/Utils/constants.ts"
],
"coverageReporters": [
"html"
],
"setupFilesAfterEnv": [
"./Config/Test/testFramework.js"
],
"testURL": "http://localhost/"
},
"author": "xxxxxxxxxxxxx",
"license": "UNLICENSED",
"private": true,
"devDependencies": {
"#types/classnames": "2.2.3",
"#types/enzyme": "3.1.10",
"#types/history": "4.6.2",
"#types/jest": "22.2.3",
"#types/jquery": "3.3.1",
"#types/lodash": "4.14.110",
"#types/object-hash": "1.2.0",
"#types/query-string": "6.2.0",
"#types/react-beautiful-dnd": "12.1.2",
"#types/react-bootstrap": "0.32.21",
"#types/react-datepicker": "2.9.5",
"#types/react-dom": "18.0.0",
"#types/react-js-pagination": "3.0.3",
"#types/react-router": "4.0.23",
"#types/react-router-dom": "4.2.6",
"#types/react-test-renderer": "16.0.1",
"#types/react-toggle": "4.0.2",
"#types/styled-components": "5.1.25",
"#types/uuid": "3.4.3",
"#types/webpack-env": "1.13.6",
"#typescript-eslint/eslint-plugin": "5.35.1",
"#typescript-eslint/parser": "5.35.1",
"axios-mock-adapter": "1.15.0",
"cross-env": "5.1.4",
"css-hot-loader": "1.3.9",
"css-loader": "0.28.11",
"ejs-loader": "0.3.1",
"enzyme": "3.11.0",
"enzyme-adapter-react-16": "1.1.1",
"eslint": "8.22.0",
"eslint-config-standard-with-typescript": "22.0.0",
"eslint-plugin-import": "2.26.0",
"eslint-plugin-n": "15.2.5",
"eslint-plugin-promise": "6.0.1",
"eslint-plugin-react": "7.31.0",
"html-webpack-plugin": "3.2.0",
"husky": "0.14.3",
"jest": "26.4.2",
"lint-staged": "13.0.3",
"mini-css-extract-plugin": "0.4.0",
"node-sass": "4.14.0",
"nodemon": "1.17.3",
"postcss-flexbugs-fixes": "3.3.0",
"postcss-loader": "2.1.4",
"prettier": "1.19.1",
"react-test-renderer": "18.2.0",
"sass-loader": "7.0.1",
"style-loader": "0.20.3",
"stylelint": "9.2.0",
"stylelint-config-recommended-scss": "3.2.0",
"stylelint-declaration-strict-value": "1.0.4",
"stylelint-declaration-use-variable": "1.6.1",
"stylelint-formatter-pretty": "1.0.3",
"stylelint-scss": "3.0.0",
"stylelint-webpack-plugin": "0.10.4",
"ts-jest": "26.3.0",
"ts-loader": "8.0.3",
"ts-react": "1.2.1",
"tsconfig-paths-webpack-plugin": "3.0.4",
"tslint": "6.1.3",
"tslint-config-prettier": "1.18.0",
"tslint-loader": "3.5.4",
"tslint-react": "5.0.0",
"tslint-react-hooks": "2.2.2",
"typescript": "4.6.4",
"webpack": "4.46.0",
"webpack-cli": "2.0.14",
"webpack-dev-server": "3.10.3",
"xml2js": "0.4.19"
},
"dependencies": {
"#hapi/cryptiles": "*",
"#types/react-table": "6.7.12",
"axios": "0.27.2",
"babel-loader": "8.2.5",
"bootstrap": "3.3.5",
"chokidar": "3.5.3",
"classnames": "2.2.5",
"core-js": "3.24.1",
"ejs": "3.1.8",
"eslint-config-airbnb": "19.0.4",
"eslint-config-airbnb-base": "15.0.0",
"eslint-config-react-app": "7.0.1",
"eslint-plugin-jsx-a11y": "6.6.1",
"eslint-utils": "3.0.0",
"eventsource": "2.0.2",
"expose-loader": "0.7.5",
"file-loader": "1.1.11",
"font-awesome": "4.7.0",
"highcharts": "10.1.0",
"highcharts-react-official": "3.0.0",
"history": "4.7.2",
"jquery": "2.1.1",
"json-schema": "0.4.0",
"lodash": "4.17.21",
"object-hash": "1.3.1",
"popper": "1.0.1",
"powerbi-client": "2.18.6",
"powerbi-client-react": "1.3.3",
"prop-types": "15.6.1",
"querystring": "0.2.0",
"react": "18.2.0",
"react-beautiful-dnd": "13.0.0",
"react-bootstrap": "0.33.1",
"react-datepicker": "4.8.0",
"react-dev-utils": "12.0.1",
"react-dom": "18.2.0",
"react-filtered-multiselect": "0.5.1",
"react-hook-form": "6.5.3",
"react-input-switch": "2.2.2",
"react-js-pagination": "3.0.3",
"react-promise": "2.0.3",
"react-query": "3.39.0",
"react-router-dom": "4.2.2",
"react-socks": "2.2.0",
"react-string-replace": "0.4.1",
"react-super-select": "1.0.23",
"react-table": "6.8.6",
"react-table-hoc-fixed-columns": "1.0.0-beta.9",
"react-toastify": "5.5.0",
"react-toggle": "4.1.3",
"shell-quote": "1.7.3",
"string-replace-to-array": "1.0.3",
"styled-components": "5.3.5",
"sweetalert": "2.1.2",
"sync-request": "6.0.0",
"tar": "6.1.11",
"ts-node": "10.9.1",
"ts-node-dev": "2.0.0",
"uglify-js": "3.15.5",
"url-parse": "1.5.10",
"uuid": "8.3.2",
"webpack-dev-middleware": "5.3.3"
}
}

Installing devDependency "husky": "0.14.3" is the culprit.

Related

Why Jest coverage creates an .html file from every component?

I'm testing a React Native app.
I run jest --coverage and I get 233 files:
I still get the coverage file and I can see the coverage through index.html.
But why the other files.
Here is the package.json
{
"name": "entoutonika",
"version": "0.0.1",
"private": true,
"scripts": {
"8": "react-native run-ios --simulator=\"iPhone 8 Plus\" ",
"11": "react-native run-ios --simulator=\"iPhone 11 Pro Max\" ",
"ios": "react-native run-ios",
"and": "react-native run-android",
"se": "react-native run-ios --simulator=\"iPhone SE (2nd generation)\" ",
"ipad13": "react-native run-ios --simulator=\"iPad Pro (12.9-inch) (5th generation)\" ",
"air": "react-native run-ios --simulator=\"iPad Air (4th generation)\" ",
"start": "react-native start",
"test": "jest --runInBand --detectOpenHandles --forceExit",
"watch": "jest --watch",
"cov": "jest --coverage",
"lint": "eslint . --ext .js,.jsx,.ts,.tsx",
"typecheck": "npx tsc",
"checkformat": "prettier --check \"**/*.{js,jsx,ts,tsx,json}\"",
"format": "prettier --write \"**/*.{js,jsx,ts,tsx,json}\"",
"prepare": "npm run typecheck && lint-staged && husky install",
"postinstall": "npx typesync"
},
"dependencies": {
"#react-native-community/async-storage": "^1.12.1",
"#react-native-community/netinfo": "^7.1.9",
"#react-navigation/drawer": "^6.1.8",
"#react-navigation/elements": "^1.2.1",
"#react-navigation/native": "^6.0.6",
"#react-navigation/native-stack": "^6.2.5",
"firebase": "^9.4.1",
"formik": "^2.2.9",
"lottie-react-native": "^4.1.3",
"moment": "^2.29.1",
"react": "17.0.2",
"react-native": "0.66.1",
"react-native-bootsplash": "^4.0.2",
"react-native-code-push": "^7.0.4",
"react-native-gesture-handler": "^1.10.3",
"react-native-image-picker": "^4.3.0",
"react-native-reanimated": "^2.2.3",
"react-native-safe-area-context": "^3.3.2",
"react-native-screens": "^3.10.1",
"react-native-sound": "^0.11.1",
"react-native-vector-icons": "^9.0.0",
"react-redux": "^7.2.5",
"redux": "^4.1.1",
"redux-persist": "^6.0.0",
"redux-thunk": "^2.3.0",
"typescript": "^4.4.4",
"yup": "^0.32.11"
},
"devDependencies": {
"#babel/core": "^7.12.9",
"#babel/preset-typescript": "^7.16.7",
"#babel/runtime": "^7.12.5",
"#react-native-community/eslint-config": "^2.0.0",
"#testing-library/jest-native": "^4.0.4",
"#testing-library/react": "^12.1.2",
"#testing-library/react-native": "^9.0.0",
"#types/babel__core": "^7.1.16",
"#types/eslint": "^7.28.2",
"#types/jest": "^26.0.24",
"#types/mocha": "^9.0.0",
"#types/react": "17.0.2",
"#types/react-native": "^0.65.0",
"#types/react-native-vector-icons": "^6.4.9",
"#types/react-redux": "^7.1.20",
"#types/react-test-renderer": "^17.0.1",
"#typescript-eslint/eslint-plugin": "^5.1.0",
"#typescript-eslint/parser": "^5.1.0",
"babel-jest": "^26.6.3",
"eslint": "^7.32.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-react": "^7.26.1",
"eslint-plugin-testing-library": "^5.0.5",
"husky": "^7.0.0",
"jest": "^26.6.3",
"jest-fetch-mock": "^3.0.3",
"lint-staged": ">=10",
"metro-react-native-babel-preset": "^0.66.2",
"react-test-renderer": "^17.0.2",
"redux-devtools-extension": "^2.13.9"
},
"resolutions": {
"#types/react": "^17"
},
"jest": {
"verbose": true,
"preset": "react-native",
"moduleFileExtensions": [
"ts",
"tsx",
"js",
"jsx",
"json",
"node"
],
"setupFilesAfterEnv": [
"#testing-library/jest-native/extend-expect"
],
"moduleNameMapper": {
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/assetsTransformer.js",
"\\.(css|less)$": "<rootDir>/assetsTransformer.js"
},
"moduleDirectories": [
"node_modules",
"src"
],
"transform": {
"^.+\\.js$": "babel-jest"
},
"transformIgnorePatterns": [
"/node_modules/(?!native-base)/"
],
"setupFiles": [
"./setupJest.js"
]
},
"lint-staged": {
"*.{js,jsx,ts,tsx}": "eslint --cache --fix",
"*.{js,jsx,ts,tsx, json}": "prettier --write"
},
"rnpm": {
"assets": [
"./assets/fonts/"
]
}
}
What I do now is check the coverage, and then delete all the files.
I don't have this issue with React projects.
Is there something wrong with the configuration?
Those files are expected since are part of the repo itself so you can see lines of code covered by your tests etc.
You need to add the folder where those are generated into your .gitignore since the whole coverage shouldn't be tracked in your repo.

SyntaxError: Unexpected token typeof

When i perform yarn test getting this issue
SyntaxError: Unexpected token typeof
Not used typeof in the project but it's used in react-native package. Also gone through this SO question, accepted answer is not working and another answer (adding react-native-web package) is giving some other problems.
Do we have any solution to solve this problem
Edit
package.json
{
"name": "xxxx",
"version": "x.x.xx",
"description": "xxx",
"author": "xxx",
"main": "lib/index.js",
"scripts": {
"dev": "node scripts/dev-server.js",
"build": "bin/build",
"build:mobile": "bin/build-mobile",
"start": "npm run dev",
"start:mobile": "bin/start-mobile",
"android": "bin/android",
"ios": "bin/ios",
"lint": "eslint --ext .js,.jsx src",
"lint-fix": "eslint --fix --ext .js,.jsx src",
"test": "jest",
"validate": "yarn test",
"snapshot": "jest --updateSnapshot",
"test:mobile": "bin/test-mobile",
"eject:mobile": "bin/eject-mobile",
"prepublishOnly": "yarn build",
"configureConsumerRepo": "git submodule init && yarn pullConsumerRepo",
"pullConsumerRepo": "git submodule update --remote --merge",
"patch": "npm version patch -m \"Upgrade to %s\"",
"mobile": "yarn build:mobile && yarn start:mobile"
},
"husky": {
"hooks": {
"pre-push": "yarn validate"
}
},
"dependencies": {
"chroma-js": "^1.3.4",
"moment": "^2.19.3",
"react-native-parsed-text": "^0.0.20",
"scroll-into-view": "^1.9.1"
},
"devDependencies": {
"autoprefixer": "^7.1.2",
"babel-cli": "^6.26.0",
"babel-core": "^6.22.1",
"babel-eslint": "^8.0.1",
"babel-jest": "^21.2.0",
"babel-loader": "^7.1.1",
"babel-plugin-transform-runtime": "^6.22.0",
"babel-preset-env": "^1.3.2",
"babel-preset-react": "^6.24.1",
"babel-preset-stage-2": "^6.22.0",
"babel-register": "^6.22.0",
"chalk": "^2.0.1",
"connect-history-api-fallback": "^1.3.0",
"copy-webpack-plugin": "^4.0.1",
"css-loader": "^0.28.0",
"cssnano": "^3.10.0",
"enzyme": "^3.1.0",
"enzyme-adapter-react-16": "^1.0.1",
"enzyme-to-json": "^3.1.2",
"eslint": "^4.8.0",
"eslint-config-airbnb": "^16.0.0",
"eslint-friendly-formatter": "^3.0.0",
"eslint-import-resolver-webpack": "^0.8.3",
"eslint-loader": "^1.9.0",
"eslint-plugin-import": "^2.7.0",
"eslint-plugin-jsx-a11y": "^6.0.2",
"eslint-plugin-react": "^7.4.0",
"eventsource-polyfill": "^0.9.6",
"express": "^4.14.1",
"extract-text-webpack-plugin": "^2.0.0",
"file-loader": "^0.11.1",
"friendly-errors-webpack-plugin": "^1.1.3",
"html-webpack-plugin": "^2.28.0",
"http-proxy-middleware": "^0.17.3",
"husky": "^1.0.0-rc.1",
"jest-cli": "^21.2.1",
"jest-junit": "^3.3.0",
"jest-styled-components": "^4.9.0",
"normalize.css": "^7.0.0",
"opn": "^5.1.0",
"optimize-css-assets-webpack-plugin": "^2.0.0",
"ora": "^1.2.0",
"postcss-flexbugs-fixes": "^3.2.0",
"postcss-loader": "^2.0.6",
"prop-types": "^15.6.0",
"react": "^16.13.1",
"react-dom": "^16.0.0-rc.3",
"react-helmet": "^5.2.0",
"react-native": "0.63.4",
"react-native-mock-render": "^0.0.16",
"react-redux": "^5.0.6",
"react-router-dom": "^4.2.2",
"react-select": "^2.1.0",
"react-test-renderer": "^16.2.0",
"redux": "^3.7.2",
"rimraf": "^2.6.0",
"semver": "^5.3.0",
"shelljs": "^0.7.6",
"style-loader": "^0.19.0",
"styled-components": "^2.2.1",
"url-loader": "^0.5.8",
"wdio-mocha-framework": "^0.5.11",
"wdio-sauce-service": "^0.4.4",
"webdriverio": "^4.9.11",
"webpack": "^2.6.1",
"webpack-bundle-analyzer": "^2.2.1",
"webpack-dev-middleware": "^1.10.0",
"webpack-hot-middleware": "^2.18.0",
"webpack-merge": "^4.1.0"
},
"jest": {
"notify": true,
"setupFiles": [
"<rootDir>/src/components/__tests__/shim.js"
],
"moduleNameMapper": {
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/src/components/__tests__/assetsTransformer.js",
"\\.(css|less)$": "<rootDir>/src/components/__tests__/assetsTransformer.js"
},
"snapshotSerializers": [
"enzyme-to-json/serializer"
],
"testPathIgnorePatterns": [
"<rootDir>/src/components/__tests__/shim.js",
"<rootDir>/src/components/__tests__/utils.js",
"<rootDir>/src/components/__tests__/assetsTransformer.js",
"<rootDir>/webdriverio-test/"
]
},
"engines": {
"node": ">= 10.0.0",
"npm": ">= 6.0.0"
},
"browserslist": [
"> 1%",
"last 2 versions",
"not ie <= 8"
],
"peerDependencies": {
"react-native-fast-image": "^5.2.0"
}
}

.eslintrc.js file being ignored with create react app and craco

This has been working great for the last couple of years, but we just upgraded a slew of libraries and now eslint, when we run our app, is not referring to our eslintrc file. It's throwing errors for rules that we have either disabled or set to warning. I can type junk into the eslintrc file and nothing errors on build.
The ESLint extension in VSCode does recognize it and running eslint CLI works as expected. When running npm run start or npm run deploy-build, it seems to ignore the eslintrc file.
.eslintrc.js removed many rules for brevity
module.exports = {
"env": {
"browser": true,
"jest": true
},
"extends": "airbnb",
"globals": {
"_satellite": true
},
"parser": "babel-eslint",
"rules": {
"comma-dangle": 0,
"eol-last": 0,
...
"jsx-a11y/anchor-is-valid": [
2,
{
"components": [
"Link"
],
"specialLink": [
"to"
]
}
],
...
"react/jsx-curly-newline": 0, // this is one rule that I'm specifically chasing
...
},
"settings": {
"import/resolver": {
"node": {
"paths": [
"src"
]
}
}
}
}
craco-config.js
const path = require('path');
const { ESLINT_MODES } = require('#craco/craco');
const StyleLintPlugin = require('stylelint-webpack-plugin');
module.exports = {
jest: {
configure: {
setupFiles: [
'jest-localstorage-mock',
'<rootDir>/jest/global_mocks.js',
'<rootDir>/jest/global_variables.js'
],
testResultsProcessor: 'jest-sonar-reporter',
snapshotSerializers: [
'enzyme-to-json/serializer'
],
collectCoverageFrom: [
'src/**/*.js',
'!src/registerServiceWorker.js',
'!src/**/*.stories.js',
'!src/**/*.styles.js'
],
coverageThreshold: {
global: {
branches: 60,
functions: 70,
lines: 80,
statements: 1
}
},
clearMocks: true
}
},
eslint: {
mode: ESLINT_MODES.file
},
webpack: {
plugins: [
new StyleLintPlugin({
configBasedir: __dirname,
context: path.resolve(__dirname, 'src'),
files: ['**/*.scss']
})
]
}
};
local environment
EXTEND_ESLINT=true
REACT_APP_ENV=local
...
package.json
{
"name": "search",
"version": "1.0.0",
"private": true,
"dependencies": {
"#datadog/browser-rum": "^1.12.8",
"#okta/okta-react": "^3.0.4",
"axios": "^0.18.1",
"connected-react-router": "^6.7.0",
"core-js": "^3.6.5",
"debounce": "^1.2.0",
"eslint-plugin-react-hooks": "^4.1.0",
"fast-text-encoding": "^1.0.2",
"focus-within-polyfill": "^5.0.4",
"history": "^4.10.0",
"jshashes": "^1.0.7",
"lodash.groupby": "^4.6.0",
"lodash.sortby": "^4.7.0",
"moment": "^2.24.0",
"moment-timezone": "^0.5.28",
"prop-types": "^15.6.2",
"qs": "^6.5.2",
"react": "^16.13.0",
"react-app-polyfill": "^1.0.6",
"react-click-outside": "^3.0.1",
"react-cursor-position": "^3.0.3",
"react-dom": "^16.13.0",
"react-easy-swipe": "0.0.17",
"react-flexbox-grid": "^2.1.2",
"react-html-parser": "^2.0.2",
"react-inlinesvg": "^1.1.5",
"react-lazyload": "^2.6.2",
"react-number-format": "^4.0.5",
"react-redux": "^7.2.0",
"react-router": "^5.1.0",
"react-router-dom": "^5.1.0",
"react-scripts": "^3.4.1",
"react-slick": "^0.23.1",
"react-sticky-el": "^1.0.20",
"react-toastify": "^4.2.0",
"react-transition-group": "^4.4.0",
"reactjs-popup": "^1.5.0",
"redux": "^4.0.0",
"redux-devtools-extension": "^2.13.8",
"redux-logger": "^3.0.6",
"redux-thunk": "^2.3.0",
"rxjs": "^6.5.5",
"semantic-ui-css": "^2.4.1",
"semantic-ui-react": "^0.83.0",
"slick-carousel": "^1.8.1",
"smoothscroll-polyfill": "^0.4.3",
"styled-components": "^5.1.1",
"use-clipboard-copy": "^0.1.1",
"uuid": "^7.0.2"
},
"devDependencies": {
"#craco/craco": "^5.6.4",
"#storybook/addon-actions": "^5.0.5",
"#storybook/addon-knobs": "^5.0.6",
"#storybook/addon-links": "^5.0.5",
"#storybook/addons": "^5.0.5",
"#storybook/react": "^5.0.5",
"#testing-library/react": "^10.4.7",
"cross-env": "^7.0.2",
"env-cmd": "^10.1.0",
"enzyme": "^3.11.0",
"enzyme-adapter-react-16": "^1.15.2",
"enzyme-to-json": "^3.5.0",
"eslint-config-airbnb": "^18.2.0",
"eslint-plugin-import": "^2.22.0",
"eslint-plugin-jsx-a11y": "^6.3.1",
"eslint-plugin-react": "^7.20.6",
"jest-environment-jsdom": "^24.9.0",
"jest-environment-node": "^24.9.0",
"jest-localstorage-mock": "^2.4.0",
"jest-sonar-reporter": "^2.0.0",
"jest-styled-components": "^7.0.2",
"libxmljs": "^0.19.7",
"node-sass-chokidar": "^1.5.0",
"npm-link-shared": "^0.5.6",
"redux-mock-store": "^1.5.3",
"stylelint": "^9.10.1",
"stylelint-config-sass-guidelines": "^5.3.0",
"stylelint-webpack-plugin": "^0.10.5"
},
"scripts": {
"localxf": "cross-env NODE_PATH=src env-cmd -f ./env/localxf craco start",
"test": "cross-env NODE_PATH=src craco test --env=jsdom",
"test:debug": "cross-env NODE_PATH=src craco test --runInBand --no-cache --env=jsdom",
"storybook": "cross-env NODE_PATH=src env-cmd -f ./env/local start-storybook -p 6006",
"build-storybook": "build-storybook",
"deploy-build": "cross-env NODE_PATH=src env-cmd -f ./env/deploy-build craco build",
"start": "cross-env NODE_PATH=src env-cmd -f ./env/local craco start --no-cache"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"ie 11",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version",
"ie 11"
]
}
}
I suspect there's a library above I have to update but I'm not sure what else to update!
This seems to be a viable workaround:
eslint: {
mode: ESLINT_MODES.extends,
configure: () => {
// Workaround for broken ESLINT_MODES.file mode
return require('./.eslintrc')
}
},

Error: Plugin/Preset files are not allowed to export objects, only functions - Babel jest

I am setting up babel jest in my Vue project. Updating babel is giving me this error.
Error: Plugin/Preset files are not allowed to export objects, only functions - in babel-preset-stage2
Here is my package.json:
{
"name": "JOM",
"version": "0.1.0",
"private": true,
"scripts": {
"build": "node build/build.js",
"lint": "vue-cli-service lint",
"test:e2e": "node test/e2e/runner.js",
"test": "npm run unit",
"pa11y": "pa11y-ci --config pa11y-config.json -j > pa11y-results.json",
"unit": "jest --config jest.config.js",
"serve": "vue-cli-service serve"
},
"dependencies": {
"#sentry/browser": "^5.6.3",
"#sentry/integrations": "^5.6.1",
"#tinymce/tinymce-vue": "^2.0.0",
"axios": "^0.18.0",
"babel-preset-es2015": "^6.24.1",
"cookie": "^0.4.0",
"core-js": "^2.6.5",
"file-saver": "^2.0.2",
"lodash.debounce": "^4.0.8",
"moment": "^2.24.0",
"register-service-worker": "^1.6.2",
"serve": "^11.0.0",
"tinymce": "^5.0.15",
"vue": "^2.6.10",
"vue-fineuploader": "^2.0.0-rc.9",
"vue-router": "^3.1.3",
"vuetify": "^1.5.18",
"vuetify-loader": "^1.3.0",
"vuex": "^3.0.1"
},
"devDependencies": {
"#babel/core": "^7.1.6",
"#babel/preset-env": "^7.6.0",
"#babel/preset-react": "^7.0.0",
"#babel/preset-stage-2": "^7.0.0",
"#vue/cli-plugin-babel": "^3.7.0",
"#vue/cli-plugin-e2e-nightwatch": "^3.9.0",
"#vue/cli-plugin-eslint": "^3.7.0",
"#vue/cli-plugin-pwa": "^3.7.0",
"#vue/cli-plugin-unit-jest": "^3.9.0",
"#vue/cli-service": "^3.7.0",
"#vue/eslint-config-standard": "^4.0.0",
"#vue/test-utils": "^1.0.0-beta.29",
"autoprefixer": "^7.1.2",
"babel-core": "^6.22.1",
"babel-eslint": "^8.2.1",
"babel-helper-vue-jsx-merge-props": "^2.0.3",
"babel-jest": "^21.2.0",
"babel-loader": "^8.0.4",
"babel-plugin-dynamic-import-node": "^1.2.0",
"babel-plugin-syntax-jsx": "^6.18.0",
"babel-plugin-transform-es2015-modules-commonjs": "^6.26.2",
"babel-plugin-transform-runtime": "^6.23.0",
"babel-plugin-transform-vue-jsx": "^3.7.0",
"babel-preset-env": "^1.3.2",
"babel-preset-stage-2": "^6.24.1",
"babel-register": "^6.22.0",
"chalk": "^2.4.2",
"chromedriver": "^2.27.2",
"copy-webpack-plugin": "^4.0.1",
"cross-spawn": "^5.0.1",
"css-loader": "^0.28.0",
"eslint": "^4.15.0",
"eslint-config-standard": "^10.2.1",
"eslint-friendly-formatter": "^3.0.0",
"eslint-loader": "^1.7.1",
"eslint-plugin-import": "^2.18.2",
"eslint-plugin-node": "^5.2.0",
"eslint-plugin-promise": "^3.4.0",
"eslint-plugin-standard": "^3.0.1",
"eslint-plugin-vue": "^4.0.0",
"file-loader": "^1.1.4",
"jest": "^22.4.4",
"jest-serializer-vue": "^0.3.0",
"lint-staged": "^8.1.5",
"pa11y": "^5.2.0",
"pa11y-ci": "^2.3.0",
"sinon": "^7.4.2",
"stylus": "^0.54.7",
"stylus-loader": "^3.0.2",
"vue-jest": "^1.4.0",
"vue-loader": "^13.3.0",
"vue-style-loader": "^3.0.1",
"vue-template-compiler": "^2.5.2",
"webpack": "^4.25.1",
"webpack-bundle-analyzer": "^2.9.0",
"webpack-cli": "^3.1.2",
"webpack-dev-server": "^2.9.1",
"webpack-merge": "^4.2.2"
},
"gitHooks": {
"pre-commit": "lint-staged"
},
"lint-staged": {
"*.{js,vue}": [
"vue-cli-service lint",
"git add"
]
}
}
Babel configuration:.babelrc
{
"presets": [
["env", {
"modules": false,
"targets": {
"browsers": ["> 1%", "last 2 versions", "not ie <= 8"]
}
}],
"stage-2"
],
"plugins": ["transform-vue-jsx", "transform-runtime"],
"env": {
"test": {
"presets": ["env", "#babel/preset-stage-2"],
"plugins": ["transform-vue-jsx", "transform-es2015-modules-commonjs", "dynamic-import-node"]
}
}
}
jest.config.js
module.exports = {
moduleFileExtensions: [
'js',
'jsx',
'json',
'vue'
],
transform: {
'^.+\\.vue$': '<rootDir>/node_modules/vue-jest',
'^.+\\.jsx?$': 'babel-jest'
},
moduleNameMapper: {
'^#/(.*)$': '<rootDir>/src/$1'
},
snapshotSerializers: [
'jest-serializer-vue'
],
setupFiles: ['<rootDir>/tests/jest-setup'],
testMatch: [
'**/tests/unit/**/*.spec.(js|jsx|ts|tsx)|**/__tests__/*.(js|jsx|ts|tsx)'
],
mapCoverage: true,
testURL: 'http://localhost/'
}
Can someone please help me with a solution? It looks like an issue with babel version. This happens after i upgrade my babel jest

Errors in mean.js program after using grunt

I have a mean.js program, when i do npm install to this here:
{
"name": "footbos",
"description": "footbos",
"version": "0.0.1",
"author": "Footbos",
"engines": {
"node": "0.10.x",
"npm": "1.4.x"
},
"scripts": {
"start": "grunt",
"test": "grunt test",
"postinstall": "bower install --config.interactive=false"
},
"dependencies": {
"body-parser": "~1.2.0",
"bower": "~1.3.1",
"compression": "~1.0.1",
"connect-flash": "~0.1.1",
"connect-mongo": "~0.4.0",
"consolidate": "~0.10.0",
"cookie-parser": "~1.1.0",
"express": "~4.2.0",
"express-session": "~1.1.0",
"forever": "~0.11.0",
"glob": "~3.2.9",
"grunt-cli": "~0.1.13",
"helmet": "~0.2.1",
"lodash": "~2.4.1",
"method-override": "~1.0.0",
"mongoose": "~3.8.8",
"morgan": "~1.1.0",
"passport": "~0.2.0",
"passport-facebook": "~1.0.2",
"passport-google-oauth": "~0.1.5",
"passport-linkedin": "~0.1.3",
"passport-local": "~1.0.0",
"passport-twitter": "~1.0.2",
"q": "^1.1.2",
"swig": "~1.3.2"
},
"devDependencies": {
"supertest": "~0.12.1",
"should": "~3.3.1",
"grunt-env": "~0.4.1",
"grunt-node-inspector": "~0.1.3",
"grunt-contrib-watch": "~0.6.1",
"grunt-contrib-jshint": "~0.10.0",
"grunt-contrib-csslint": "^0.2.0",
"grunt-ngmin": "0.0.3",
"grunt-contrib-uglify": "~0.4.0",
"grunt-contrib-cssmin": "~0.9.0",
"grunt-nodemon": "~0.2.1",
"grunt-concurrent": "~0.5.0",
"grunt-mocha-test": "~0.10.0",
"grunt-karma": "~0.8.2",
"load-grunt-tasks": "~0.4.0",
"karma": "~0.12.0",
"karma-jasmine": "~0.2.1",
"karma-coverage": "~0.2.0",
"karma-chrome-launcher": "~0.1.2",
"karma-firefox-launcher": "~0.1.3",
"karma-phantomjs-launcher": "~0.1.2"
}
}
And then i run grunt, i get the errors marked in the pic, why? what are they talking about there? i have no lib/utils, never had this, and it all worked fine before (On my other computer, now burned :( ), What is the meaning of those erros and how do i fix this?