1
0
Fork 1
mirror of https://github.com/SomboChea/ui synced 2024-04-26 14:41:36 +07:00

chore: enable optional chaining and nullish (#306)

This commit is contained in:
Juan Picado @jotadeveloper 2019-11-23 20:15:14 +01:00 committed by Priscila Oliveira
parent 58cf730b98
commit 0a48906fc8
7 changed files with 613 additions and 476 deletions

View File

@ -1,4 +1,8 @@
{
"presets": [["@verdaccio"]],
"plugins": ["emotion"]
"plugins": [
"emotion",
"@babel/plugin-proposal-optional-chaining",
"@babel/plugin-proposal-nullish-coalescing-operator"
]
}

View File

@ -1 +1,2 @@
save-prefix ""
registry "https://registry.verdaccio.org"

View File

@ -13,6 +13,8 @@
"homepage": "https://verdaccio.org",
"main": "index.js",
"devDependencies": {
"@babel/plugin-proposal-nullish-coalescing-operator": "7.7.4",
"@babel/plugin-proposal-optional-chaining": "7.7.4",
"@commitlint/cli": "8.2.0",
"@commitlint/config-conventional": "8.2.0",
"@emotion/core": "10.0.22",
@ -35,10 +37,10 @@
"@types/validator": "12.0.0",
"@types/webpack-env": "1.14.1",
"@typescript-eslint/parser": "2.8.0",
"@verdaccio/babel-preset": "8.2.0",
"@verdaccio/commons-api": "8.3.0",
"@verdaccio/eslint-config": "8.2.0",
"@verdaccio/types": "8.3.0",
"@verdaccio/babel-preset": "8.4.2",
"@verdaccio/commons-api": "8.4.2",
"@verdaccio/eslint-config": "8.4.2",
"@verdaccio/types": "8.4.2",
"autosuggest-highlight": "3.1.1",
"babel-loader": "8.0.6",
"bundlesize": "0.18.0",
@ -54,14 +56,14 @@
"enzyme": "3.10.0",
"enzyme-adapter-react-16": "1.15.1",
"enzyme-to-json": "3.4.3",
"eslint": "6.6.0",
"eslint": "6.7.0",
"eslint-plugin-codeceptjs": "1.2.0",
"eslint-plugin-import": "2.18.2",
"eslint-plugin-jsx-a11y": "6.2.3",
"eslint-plugin-prettier": "3.1.1",
"eslint-plugin-react": "7.16.0",
"eslint-plugin-react-hooks": "2.3.0",
"eslint-plugin-verdaccio": "8.2.0",
"eslint-plugin-verdaccio": "8.4.2",
"file-loader": "4.3.0",
"friendly-errors-webpack-plugin": "1.7.0",
"get-stdin": "7.0.0",
@ -113,8 +115,8 @@
"url-loader": "2.3.0",
"validator": "12.1.0",
"verdaccio": "4.3.5",
"verdaccio-auth-memory": "8.3.0",
"verdaccio-memory": "8.3.0",
"verdaccio-auth-memory": "8.4.2",
"verdaccio-memory": "8.4.2",
"wait-on": "3.3.0",
"webpack": "4.41.2",
"webpack-bundle-analyzer": "3.6.0",

View File

@ -3,6 +3,7 @@ import { ReactWrapper } from 'enzyme';
import { mount } from '../utils/test-enzyme';
import storage from '../utils/storage';
// eslint-disable-next-line jest/no-mocks-import
import { generateTokenWithTimeRange } from '../../jest/unit/components/__mocks__/token';
import App from './App';
@ -31,6 +32,7 @@ jest.mock('../utils/storage', () => {
});
jest.mock('../utils/api', () => ({
// eslint-disable-next-line jest/no-mocks-import
request: require('../../jest/unit/components/__mocks__/api').default.request,
}));

View File

@ -13,7 +13,7 @@ import node from './img/node.png';
const Engine: React.FC = () => {
const { packageMeta } = useContext(DetailContext);
const engines = packageMeta && packageMeta.latest && packageMeta.latest.engines;
const engines = packageMeta?.latest?.engines;
if (!engines || (!engines.node && !engines.npm)) {
return null;

View File

@ -1,3 +1,4 @@
// eslint-disable-next-line jest/no-mocks-import
import {
generateTokenWithTimeRange,
generateTokenWithExpirationAsString,
@ -11,6 +12,7 @@ import { isTokenExpire, makeLogin } from './login';
console.error = jest.fn();
jest.mock('./api', () => ({
// eslint-disable-next-line jest/no-mocks-import
request: require('../../jest/unit/components/__mocks__/api').default.request,
}));
@ -40,11 +42,8 @@ describe('isTokenExpire', (): void => {
test('isTokenExpire - token is not a valid json token', (): void => {
const token = generateInvalidToken();
const result = [
'Invalid token:',
new SyntaxError('Unexpected token i in JSON at position 0'),
'xxxxxx.aW52YWxpZHRva2Vu.xxxxxx',
];
const errorToken = new SyntaxError('Unexpected token i in JSON at position 0');
const result = ['Invalid token:', errorToken, 'xxxxxx.aW52YWxpZHRva2Vu.xxxxxx'];
expect(isTokenExpire(token)).toBeTruthy();
expect(console.error).toHaveBeenCalledWith(...result);
});

1051
yarn.lock

File diff suppressed because it is too large Load Diff