Updated babel packages and extracted babel config

This commit is contained in:
Alejandro Celaya 2022-03-07 14:21:09 +01:00
parent fc71c0f5c8
commit 31f1d5b530
5 changed files with 681 additions and 359 deletions

15
babel.config.js Normal file
View file

@ -0,0 +1,15 @@
module.exports = {
presets: [
[
'react-app',
{
runtime: 'automatic',
typescript: true,
},
],
],
plugins: [
'@babel/plugin-proposal-optional-chaining',
'@babel/plugin-proposal-nullish-coalescing-operator',
],
};

993
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -66,9 +66,9 @@
"workbox-strategies": "^6.1.5" "workbox-strategies": "^6.1.5"
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.13.8", "@babel/core": "^7.17.5",
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.13.8", "@babel/plugin-proposal-nullish-coalescing-operator": "^7.16.7",
"@babel/plugin-proposal-optional-chaining": "^7.13.8", "@babel/plugin-proposal-optional-chaining": "^7.16.7",
"@shlinkio/eslint-config-js-coding-standard": "~1.2.2", "@shlinkio/eslint-config-js-coding-standard": "~1.2.2",
"@stryker-mutator/core": "^5.4.1", "@stryker-mutator/core": "^5.4.1",
"@stryker-mutator/jest-runner": "^5.4.1", "@stryker-mutator/jest-runner": "^5.4.1",
@ -92,9 +92,8 @@
"@wojtekmaj/enzyme-adapter-react-17": "^0.6.5", "@wojtekmaj/enzyme-adapter-react-17": "^0.6.5",
"adm-zip": "^0.4.16", "adm-zip": "^0.4.16",
"autoprefixer": "^10.0.2", "autoprefixer": "^10.0.2",
"babel-core": "7.0.0-bridge.0",
"babel-jest": "^27.5.1", "babel-jest": "^27.5.1",
"babel-loader": "^8.2.1", "babel-loader": "^8.2.3",
"babel-plugin-named-asset-import": "^0.3.7", "babel-plugin-named-asset-import": "^0.3.7",
"babel-preset-react-app": "^10.0.0", "babel-preset-react-app": "^10.0.0",
"babel-runtime": "^6.26.0", "babel-runtime": "^6.26.0",
@ -147,20 +146,6 @@
"whatwg-fetch": "^3.5.0", "whatwg-fetch": "^3.5.0",
"workbox-webpack-plugin": "^6.1.5" "workbox-webpack-plugin": "^6.1.5"
}, },
"babel": {
"presets": [
[
"react-app",
{
"runtime": "automatic"
}
]
],
"plugins": [
"@babel/plugin-proposal-optional-chaining",
"@babel/plugin-proposal-nullish-coalescing-operator"
]
},
"browserslist": [ "browserslist": [
">0.2%", ">0.2%",
"not dead", "not dead",

View file

@ -1,6 +1,6 @@
import { shallow, ShallowWrapper } from 'enzyme'; import { shallow, ShallowWrapper } from 'enzyme';
import { Mock } from 'ts-mockery'; import { Mock } from 'ts-mockery';
import { Button, ModalHeader } from 'reactstrap'; import { Button, FormGroup, ModalHeader } from 'reactstrap';
import { ShlinkDomain } from '../../../src/api/types'; import { ShlinkDomain } from '../../../src/api/types';
import { EditDomainRedirectsModal } from '../../../src/domains/helpers/EditDomainRedirectsModal'; import { EditDomainRedirectsModal } from '../../../src/domains/helpers/EditDomainRedirectsModal';
import { InfoTooltip } from '../../../src/utils/InfoTooltip'; import { InfoTooltip } from '../../../src/utils/InfoTooltip';
@ -32,7 +32,7 @@ describe('<EditDomainRedirectsModal />', () => {
}); });
it('expected amount of form groups and tooltips', () => { it('expected amount of form groups and tooltips', () => {
const formGroups = wrapper.find('FormGroup'); const formGroups = wrapper.find(FormGroup);
const tooltips = wrapper.find(InfoTooltip); const tooltips = wrapper.find(InfoTooltip);
expect(formGroups).toHaveLength(3); expect(formGroups).toHaveLength(3);
@ -50,7 +50,7 @@ describe('<EditDomainRedirectsModal />', () => {
}); });
it('saves expected values when form is submitted', () => { it('saves expected values when form is submitted', () => {
const formGroups = wrapper.find('FormGroup'); const formGroups = wrapper.find(FormGroup);
expect(editDomainRedirects).not.toHaveBeenCalled(); expect(editDomainRedirects).not.toHaveBeenCalled();

View file

@ -1,4 +1,5 @@
import { shallow, ShallowWrapper } from 'enzyme'; import { shallow, ShallowWrapper } from 'enzyme';
import { FormGroup } from 'reactstrap';
import { ServerForm } from '../../../src/servers/helpers/ServerForm'; import { ServerForm } from '../../../src/servers/helpers/ServerForm';
describe('<ServerForm />', () => { describe('<ServerForm />', () => {
@ -13,7 +14,7 @@ describe('<ServerForm />', () => {
afterEach(jest.resetAllMocks); afterEach(jest.resetAllMocks);
it('renders components', () => { it('renders components', () => {
expect(wrapper.find('FormGroup')).toHaveLength(3); expect(wrapper.find(FormGroup)).toHaveLength(3);
expect(wrapper.find('span')).toHaveLength(1); expect(wrapper.find('span')).toHaveLength(1);
}); });