mirror of
https://github.com/SomboChea/ui
synced 2024-11-24 06:54:27 +07:00
feat(eslint-config): add order rule in import
* refactor: added eslint-plugin-import * refactor: disable some rules for muiComponents * fix: fixed import
This commit is contained in:
parent
950f6defca
commit
ae73772a37
@ -3,6 +3,7 @@ coverage/
|
|||||||
static/
|
static/
|
||||||
.github/
|
.github/
|
||||||
.circleci/
|
.circleci/
|
||||||
|
build
|
||||||
*.md
|
*.md
|
||||||
*.lock
|
*.lock
|
||||||
*.yaml
|
*.yaml
|
||||||
|
@ -5,7 +5,8 @@
|
|||||||
"plugin:jest/recommended",
|
"plugin:jest/recommended",
|
||||||
"plugin:prettier/recommended",
|
"plugin:prettier/recommended",
|
||||||
"plugin:verdaccio/recommended",
|
"plugin:verdaccio/recommended",
|
||||||
"plugin:jsx-a11y/recommended"
|
"plugin:jsx-a11y/recommended",
|
||||||
|
"plugin:import/typescript"
|
||||||
],
|
],
|
||||||
"plugins": [
|
"plugins": [
|
||||||
"react",
|
"react",
|
||||||
@ -14,7 +15,8 @@
|
|||||||
"verdaccio",
|
"verdaccio",
|
||||||
"jsx-a11y",
|
"jsx-a11y",
|
||||||
"codeceptjs",
|
"codeceptjs",
|
||||||
"react-hooks"
|
"react-hooks",
|
||||||
|
"import"
|
||||||
],
|
],
|
||||||
"settings": {
|
"settings": {
|
||||||
"react": {
|
"react": {
|
||||||
@ -28,6 +30,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"rules": {
|
"rules": {
|
||||||
|
"import/order": ["error", {"newlines-between": "always"}],
|
||||||
"babel/no-invalid-this": 0,
|
"babel/no-invalid-this": 0,
|
||||||
"no-invalid-this": 0,
|
"no-invalid-this": 0,
|
||||||
"no-console": ["error", { "allow": ["warn", "error"] }],
|
"no-console": ["error", { "allow": ["warn", "error"] }],
|
||||||
|
@ -49,6 +49,7 @@
|
|||||||
"enzyme-to-json": "3.4.0",
|
"enzyme-to-json": "3.4.0",
|
||||||
"eslint": "6.5.1",
|
"eslint": "6.5.1",
|
||||||
"eslint-plugin-codeceptjs": "1.1.0",
|
"eslint-plugin-codeceptjs": "1.1.0",
|
||||||
|
"eslint-plugin-import": "2.18.2",
|
||||||
"eslint-plugin-jsx-a11y": "6.2.3",
|
"eslint-plugin-jsx-a11y": "6.2.3",
|
||||||
"eslint-plugin-prettier": "3.1.0",
|
"eslint-plugin-prettier": "3.1.0",
|
||||||
"eslint-plugin-react": "7.14.3",
|
"eslint-plugin-react": "7.14.3",
|
||||||
@ -148,7 +149,7 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"type-check": "tsc --noEmit",
|
"type-check": "tsc --noEmit --pretty",
|
||||||
"type-check:watch": "npm run type-check -- --watch",
|
"type-check:watch": "npm run type-check -- --watch",
|
||||||
"release": "standard-version -a",
|
"release": "standard-version -a",
|
||||||
"test:clean": "npx jest --clearCache",
|
"test:clean": "npx jest --clearCache",
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { mount } from 'enzyme';
|
import { mount } from 'enzyme';
|
||||||
import storage from '../utils/storage';
|
|
||||||
import App from './App';
|
|
||||||
|
|
||||||
|
import storage from '../utils/storage';
|
||||||
import { generateTokenWithTimeRange } from '../../jest/unit/components/__mocks__/token';
|
import { generateTokenWithTimeRange } from '../../jest/unit/components/__mocks__/token';
|
||||||
|
|
||||||
|
import App from './App';
|
||||||
|
|
||||||
jest.mock('../utils/storage', () => {
|
jest.mock('../utils/storage', () => {
|
||||||
class LocalStorageMock {
|
class LocalStorageMock {
|
||||||
private store: object;
|
private store: object;
|
||||||
|
@ -3,7 +3,6 @@ import isNil from 'lodash/isNil';
|
|||||||
|
|
||||||
import storage from '../utils/storage';
|
import storage from '../utils/storage';
|
||||||
import { makeLogin, isTokenExpire } from '../utils/login';
|
import { makeLogin, isTokenExpire } from '../utils/login';
|
||||||
|
|
||||||
import Loading from '../components/Loading';
|
import Loading from '../components/Loading';
|
||||||
import LoginModal from '../components/Login';
|
import LoginModal from '../components/Login';
|
||||||
import Header from '../components/Header';
|
import Header from '../components/Header';
|
||||||
@ -14,7 +13,7 @@ import 'typeface-roboto/index.css';
|
|||||||
import '../utils/styles/global';
|
import '../utils/styles/global';
|
||||||
import 'normalize.css';
|
import 'normalize.css';
|
||||||
import Footer from '../components/Footer';
|
import Footer from '../components/Footer';
|
||||||
import { FormError } from 'src/components/Login/Login';
|
import { FormError } from '../components/Login/Login';
|
||||||
|
|
||||||
export const AppContext = React.createContext<{}>({});
|
export const AppContext = React.createContext<{}>({});
|
||||||
export const AppContextProvider = AppContext.Provider;
|
export const AppContextProvider = AppContext.Provider;
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { css } from 'emotion';
|
import { css } from 'emotion';
|
||||||
|
|
||||||
import colors from '../utils/styles/colors';
|
import colors from '../utils/styles/colors';
|
||||||
|
|
||||||
export const alertError = css({
|
export const alertError = css({
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { mount } from 'enzyme';
|
import { mount } from 'enzyme';
|
||||||
|
|
||||||
import { ActionBar } from './ActionBar';
|
import { ActionBar } from './ActionBar';
|
||||||
|
|
||||||
const mockPackageMeta: jest.Mock = jest.fn(() => ({
|
const mockPackageMeta: jest.Mock = jest.fn(() => ({
|
||||||
|
@ -1,16 +1,16 @@
|
|||||||
import React, { Component, ReactElement } from 'react';
|
import React, { Component, ReactElement } from 'react';
|
||||||
|
|
||||||
import BugReportIcon from '@material-ui/icons/BugReport';
|
import BugReportIcon from '@material-ui/icons/BugReport';
|
||||||
import DownloadIcon from '@material-ui/icons/CloudDownload';
|
import DownloadIcon from '@material-ui/icons/CloudDownload';
|
||||||
import HomeIcon from '@material-ui/icons/Home';
|
import HomeIcon from '@material-ui/icons/Home';
|
||||||
import List from '@material-ui/core/List';
|
import List from '@material-ui/core/List';
|
||||||
|
|
||||||
import { DetailContextConsumer, VersionPageConsumerProps } from '../../pages/Version';
|
import { DetailContextConsumer, VersionPageConsumerProps } from '../../pages/Version';
|
||||||
import { Fab, ActionListItem } from './styles';
|
|
||||||
import { isURL, extractFileName, downloadFile } from '../../utils/url';
|
import { isURL, extractFileName, downloadFile } from '../../utils/url';
|
||||||
import api from '../../utils/api';
|
import api from '../../utils/api';
|
||||||
import Tooltip from '../../muiComponents/Tooltip';
|
import Tooltip from '../../muiComponents/Tooltip';
|
||||||
|
|
||||||
|
import { Fab, ActionListItem } from './styles';
|
||||||
|
|
||||||
export interface Action {
|
export interface Action {
|
||||||
icon: string;
|
icon: string;
|
||||||
title: string;
|
title: string;
|
||||||
|
@ -1,13 +1,12 @@
|
|||||||
import React, { FC, useContext } from 'react';
|
import React, { FC, useContext } from 'react';
|
||||||
|
|
||||||
import List from '@material-ui/core/List';
|
import List from '@material-ui/core/List';
|
||||||
|
|
||||||
import { DetailContext } from '../../pages/Version';
|
import { DetailContext } from '../../pages/Version';
|
||||||
import { Heading, AuthorListItem, AuthorListItemText } from './styles';
|
|
||||||
import { isEmail } from '../../utils/url';
|
import { isEmail } from '../../utils/url';
|
||||||
|
|
||||||
import Avatar from '../../muiComponents/Avatar';
|
import Avatar from '../../muiComponents/Avatar';
|
||||||
|
|
||||||
|
import { Heading, AuthorListItem, AuthorListItemText } from './styles';
|
||||||
|
|
||||||
const Author: FC = () => {
|
const Author: FC = () => {
|
||||||
const { packageMeta } = useContext(DetailContext);
|
const { packageMeta } = useContext(DetailContext);
|
||||||
|
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
import styled from 'react-emotion';
|
import styled from 'react-emotion';
|
||||||
import ListItem from '@material-ui/core/ListItem';
|
import ListItem from '@material-ui/core/ListItem';
|
||||||
import Typography from '@material-ui/core/Typography';
|
import Typography from '@material-ui/core/Typography';
|
||||||
import { fontWeight } from '../../utils/styles/sizes';
|
|
||||||
import ListItemText from '@material-ui/core/ListItemText';
|
import ListItemText from '@material-ui/core/ListItemText';
|
||||||
|
|
||||||
|
import { fontWeight } from '../../utils/styles/sizes';
|
||||||
|
|
||||||
export const Heading = styled(Typography)({
|
export const Heading = styled(Typography)({
|
||||||
'&&': {
|
'&&': {
|
||||||
fontWeight: fontWeight.bold,
|
fontWeight: fontWeight.bold,
|
||||||
|
@ -6,6 +6,7 @@ import parse from 'autosuggest-highlight/parse';
|
|||||||
import MenuItem from '@material-ui/core/MenuItem';
|
import MenuItem from '@material-ui/core/MenuItem';
|
||||||
|
|
||||||
import { fontWeight } from '../../utils/styles/sizes';
|
import { fontWeight } from '../../utils/styles/sizes';
|
||||||
|
|
||||||
import { Wrapper, InputField, SuggestionContainer } from './styles';
|
import { Wrapper, InputField, SuggestionContainer } from './styles';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
@ -27,10 +28,13 @@ interface Props {
|
|||||||
onBlur?: (event: KeyboardEvent<HTMLInputElement>) => void;
|
onBlur?: (event: KeyboardEvent<HTMLInputElement>) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* eslint-disable react/jsx-sort-props */
|
||||||
|
/* eslint-disable verdaccio/jsx-spread */
|
||||||
const renderInputComponent = (inputProps): JSX.Element => {
|
const renderInputComponent = (inputProps): JSX.Element => {
|
||||||
const { ref, startAdornment, disableUnderline, onKeyDown, ...others } = inputProps;
|
const { ref, startAdornment, disableUnderline, onKeyDown, ...others } = inputProps;
|
||||||
return (
|
return (
|
||||||
<InputField
|
<InputField
|
||||||
|
fullWidth={true}
|
||||||
InputProps={{
|
InputProps={{
|
||||||
inputRef: node => {
|
inputRef: node => {
|
||||||
ref(node);
|
ref(node);
|
||||||
@ -39,7 +43,6 @@ const renderInputComponent = (inputProps): JSX.Element => {
|
|||||||
disableUnderline,
|
disableUnderline,
|
||||||
onKeyDown,
|
onKeyDown,
|
||||||
}}
|
}}
|
||||||
fullWidth={true}
|
|
||||||
{...others}
|
{...others}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
import React, { FC } from 'react';
|
import React, { FC } from 'react';
|
||||||
|
|
||||||
import { isEmail } from '../../utils/url';
|
import { isEmail } from '../../utils/url';
|
||||||
|
|
||||||
import Tooltip from '../../muiComponents/Tooltip';
|
import Tooltip from '../../muiComponents/Tooltip';
|
||||||
import Avatar from '../../muiComponents/Avatar';
|
import Avatar from '../../muiComponents/Avatar';
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import IconButton from '../../muiComponents/IconButton';
|
|
||||||
import styled from 'react-emotion';
|
import styled from 'react-emotion';
|
||||||
|
|
||||||
|
import IconButton from '../../muiComponents/IconButton';
|
||||||
|
|
||||||
export const ClipBoardCopy = styled('div')({
|
export const ClipBoardCopy = styled('div')({
|
||||||
'&&': {
|
'&&': {
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
|
@ -3,9 +3,9 @@ import { withRouter, RouteComponentProps } from 'react-router-dom';
|
|||||||
import CardContent from '@material-ui/core/CardContent';
|
import CardContent from '@material-ui/core/CardContent';
|
||||||
|
|
||||||
import { DetailContextConsumer, VersionPageConsumerProps } from '../../pages/Version';
|
import { DetailContextConsumer, VersionPageConsumerProps } from '../../pages/Version';
|
||||||
|
import NoItems from '../NoItems';
|
||||||
|
|
||||||
import { CardWrap, Heading, Tags, Tag } from './styles';
|
import { CardWrap, Heading, Tags, Tag } from './styles';
|
||||||
import NoItems from '../NoItems';
|
|
||||||
|
|
||||||
type DepDetailProps = {
|
type DepDetailProps = {
|
||||||
name: string;
|
name: string;
|
||||||
|
@ -2,6 +2,7 @@ import styled from 'react-emotion';
|
|||||||
import Card from '@material-ui/core/Card';
|
import Card from '@material-ui/core/Card';
|
||||||
import Typography from '@material-ui/core/Typography';
|
import Typography from '@material-ui/core/Typography';
|
||||||
import Chip from '@material-ui/core/Chip';
|
import Chip from '@material-ui/core/Chip';
|
||||||
|
|
||||||
import { fontWeight } from '../../utils/styles/sizes';
|
import { fontWeight } from '../../utils/styles/sizes';
|
||||||
|
|
||||||
export const CardWrap = styled(Card)({
|
export const CardWrap = styled(Card)({
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
import { render } from '@testing-library/react';
|
import { render } from '@testing-library/react';
|
||||||
|
|
||||||
import DetailContainer from './DetailContainer';
|
import DetailContainer from './DetailContainer';
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
import { preventXSS } from '../../utils/sec-utils';
|
import { preventXSS } from '../../utils/sec-utils';
|
||||||
|
|
||||||
import Readme from '../Readme';
|
import Readme from '../Readme';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import React, { ReactElement } from 'react';
|
import React, { ReactElement } from 'react';
|
||||||
|
|
||||||
import Card from '@material-ui/core/Card';
|
import Card from '@material-ui/core/Card';
|
||||||
import CardContent from '@material-ui/core/CardContent';
|
import CardContent from '@material-ui/core/CardContent';
|
||||||
import List from '@material-ui/core/List';
|
import List from '@material-ui/core/List';
|
||||||
@ -11,7 +10,6 @@ import Dist from '../Dist/Dist';
|
|||||||
import Engine from '../Engines/Engines';
|
import Engine from '../Engines/Engines';
|
||||||
import Install from '../Install';
|
import Install from '../Install';
|
||||||
import Repository from '../Repository/Repository';
|
import Repository from '../Repository/Repository';
|
||||||
|
|
||||||
import { DetailContext } from '../../pages/Version';
|
import { DetailContext } from '../../pages/Version';
|
||||||
|
|
||||||
import { TitleListItem, TitleListItemText, PackageDescription, PackageVersion } from './styles';
|
import { TitleListItem, TitleListItemText, PackageDescription, PackageVersion } from './styles';
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { mount } from 'enzyme';
|
import { mount } from 'enzyme';
|
||||||
|
|
||||||
|
import { DetailContextProvider } from '../../pages/Version';
|
||||||
|
|
||||||
import Developers, { DevelopersType } from './Developers';
|
import Developers, { DevelopersType } from './Developers';
|
||||||
import { Fab } from './styles';
|
import { Fab } from './styles';
|
||||||
import { DetailContextProvider } from '../../pages/Version';
|
|
||||||
|
|
||||||
describe('test Developers', () => {
|
describe('test Developers', () => {
|
||||||
const packageMeta = {
|
const packageMeta = {
|
||||||
|
@ -3,6 +3,7 @@ import Add from '@material-ui/icons/Add';
|
|||||||
|
|
||||||
import { DetailContext } from '../../pages/Version';
|
import { DetailContext } from '../../pages/Version';
|
||||||
import { AvatarTooltip } from '../AvatarTooltip';
|
import { AvatarTooltip } from '../AvatarTooltip';
|
||||||
|
|
||||||
import { Details, Heading, Content, Fab } from './styles';
|
import { Details, Heading, Content, Fab } from './styles';
|
||||||
|
|
||||||
export type DevelopersType = 'contributors' | 'maintainers';
|
export type DevelopersType = 'contributors' | 'maintainers';
|
||||||
|
@ -2,6 +2,7 @@ import React from 'react';
|
|||||||
import { mount } from 'enzyme';
|
import { mount } from 'enzyme';
|
||||||
|
|
||||||
import { DetailContext } from '../../pages/Version';
|
import { DetailContext } from '../../pages/Version';
|
||||||
|
|
||||||
import Dist from './Dist';
|
import Dist from './Dist';
|
||||||
|
|
||||||
const withDistComponent = (packageMeta: React.ContextType<typeof DetailContext>['packageMeta']): JSX.Element => (
|
const withDistComponent = (packageMeta: React.ContextType<typeof DetailContext>['packageMeta']): JSX.Element => (
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
import React, { FC, useContext } from 'react';
|
import React, { FC, useContext } from 'react';
|
||||||
|
|
||||||
import List from '@material-ui/core/List';
|
import List from '@material-ui/core/List';
|
||||||
|
|
||||||
import { DetailContext } from '../../pages/Version';
|
import { DetailContext } from '../../pages/Version';
|
||||||
import { Heading, DistListItem, DistChips } from './styles';
|
|
||||||
import fileSizeSI from '../../utils/file-size';
|
import fileSizeSI from '../../utils/file-size';
|
||||||
import { formatLicense } from '../../utils/package';
|
import { formatLicense } from '../../utils/package';
|
||||||
|
|
||||||
|
import { Heading, DistListItem, DistChips } from './styles';
|
||||||
|
|
||||||
const DistChip: FC<{ name: string }> = ({ name, children }) =>
|
const DistChip: FC<{ name: string }> = ({ name, children }) =>
|
||||||
children ? (
|
children ? (
|
||||||
<DistChips
|
<DistChips
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { mount } from 'enzyme';
|
import { mount } from 'enzyme';
|
||||||
|
|
||||||
import Engine from './Engines';
|
import Engine from './Engines';
|
||||||
|
|
||||||
jest.mock('./img/node.png', () => '');
|
jest.mock('./img/node.png', () => '');
|
||||||
|
@ -1,17 +1,15 @@
|
|||||||
import React, { Component, ReactElement } from 'react';
|
import React, { Component, ReactElement } from 'react';
|
||||||
|
|
||||||
import Grid from '@material-ui/core/Grid';
|
import Grid from '@material-ui/core/Grid';
|
||||||
import List from '@material-ui/core/List';
|
import List from '@material-ui/core/List';
|
||||||
import ListItemText from '@material-ui/core/ListItemText';
|
import ListItemText from '@material-ui/core/ListItemText';
|
||||||
|
|
||||||
import { VersionPageConsumerProps, DetailContextConsumer } from '../../pages/Version';
|
import { VersionPageConsumerProps, DetailContextConsumer } from '../../pages/Version';
|
||||||
import { Heading, EngineListItem } from './styles';
|
|
||||||
|
|
||||||
import Avatar from '../../muiComponents/Avatar';
|
import Avatar from '../../muiComponents/Avatar';
|
||||||
|
import npm from '../Install/img/npm.svg';
|
||||||
|
|
||||||
|
import { Heading, EngineListItem } from './styles';
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import node from './img/node.png';
|
import node from './img/node.png';
|
||||||
import npm from '../Install/img/npm.svg';
|
|
||||||
|
|
||||||
const ICONS = {
|
const ICONS = {
|
||||||
'node-JS': <Avatar src={node} />,
|
'node-JS': <Avatar src={node} />,
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import styled from 'react-emotion';
|
import styled from 'react-emotion';
|
||||||
import ListItem from '@material-ui/core/ListItem';
|
import ListItem from '@material-ui/core/ListItem';
|
||||||
import Typography from '@material-ui/core/Typography';
|
import Typography from '@material-ui/core/Typography';
|
||||||
|
|
||||||
import { fontWeight } from '../../utils/styles/sizes';
|
import { fontWeight } from '../../utils/styles/sizes';
|
||||||
|
|
||||||
export const Heading = styled(Typography)({
|
export const Heading = styled(Typography)({
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
import { Wrapper, Left, Right, Earth, Flags, Love, Flag, Logo, Inner, ToolTip } from './styles';
|
|
||||||
import { goToVerdaccioWebsite } from '../../utils/windows';
|
import { goToVerdaccioWebsite } from '../../utils/windows';
|
||||||
|
|
||||||
|
import { Wrapper, Left, Right, Earth, Flags, Love, Flag, Logo, Inner, ToolTip } from './styles';
|
||||||
|
|
||||||
const renderTooltip = (): JSX.Element => (
|
const renderTooltip = (): JSX.Element => (
|
||||||
<ToolTip>
|
<ToolTip>
|
||||||
<Earth name="earth" size="md" />
|
<Earth name="earth" size="md" />
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import styled, { css } from 'react-emotion';
|
import styled, { css } from 'react-emotion';
|
||||||
|
|
||||||
import mq from '../../utils/styles/media';
|
import mq from '../../utils/styles/media';
|
||||||
import Icon from '../Icon/Icon';
|
import Icon from '../Icon/Icon';
|
||||||
import colors from '../../utils/styles/colors';
|
import colors from '../../utils/styles/colors';
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { BrowserRouter as Router } from 'react-router-dom';
|
import { BrowserRouter as Router } from 'react-router-dom';
|
||||||
import { shallow } from 'enzyme';
|
import { shallow } from 'enzyme';
|
||||||
|
|
||||||
import Header from './Header';
|
import Header from './Header';
|
||||||
|
|
||||||
describe('<Header /> component with logged in state', () => {
|
describe('<Header /> component with logged in state', () => {
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
import React, { SyntheticEvent, Component, Fragment, ReactElement } from 'react';
|
import React, { SyntheticEvent, Component, Fragment, ReactElement } from 'react';
|
||||||
import { Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
import { css } from 'emotion';
|
import { css } from 'emotion';
|
||||||
|
|
||||||
import MenuItem from '@material-ui/core/MenuItem';
|
import MenuItem from '@material-ui/core/MenuItem';
|
||||||
import Menu from '@material-ui/core/Menu';
|
import Menu from '@material-ui/core/Menu';
|
||||||
import Info from '@material-ui/icons/Info';
|
import Info from '@material-ui/icons/Info';
|
||||||
@ -15,7 +14,6 @@ import RegistryInfoDialog from '../RegistryInfoDialog/RegistryInfoDialog';
|
|||||||
import Label from '../Label/Label';
|
import Label from '../Label/Label';
|
||||||
import Search from '../Search/Search';
|
import Search from '../Search/Search';
|
||||||
import RegistryInfoContent from '../RegistryInfoContent/RegistryInfoContent';
|
import RegistryInfoContent from '../RegistryInfoContent/RegistryInfoContent';
|
||||||
|
|
||||||
import IconButton from '../../muiComponents/IconButton';
|
import IconButton from '../../muiComponents/IconButton';
|
||||||
import Tooltip from '../../muiComponents/Tooltip';
|
import Tooltip from '../../muiComponents/Tooltip';
|
||||||
import Button from '../../muiComponents/Button';
|
import Button from '../../muiComponents/Button';
|
||||||
|
@ -4,7 +4,6 @@ import Toolbar from '@material-ui/core/Toolbar';
|
|||||||
|
|
||||||
import colors from '../../utils/styles/colors';
|
import colors from '../../utils/styles/colors';
|
||||||
import mq from '../../utils/styles/media';
|
import mq from '../../utils/styles/media';
|
||||||
|
|
||||||
import IconButton from '../../muiComponents/IconButton';
|
import IconButton from '../../muiComponents/IconButton';
|
||||||
import ExternalLink from '../Link';
|
import ExternalLink from '../Link';
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { mount } from 'enzyme';
|
import { mount } from 'enzyme';
|
||||||
|
|
||||||
import Help from './Help';
|
import Help from './Help';
|
||||||
|
|
||||||
describe('<Help /> component', () => {
|
describe('<Help /> component', () => {
|
||||||
|
@ -3,7 +3,6 @@ import capitalize from 'lodash/capitalize';
|
|||||||
import { Breakpoint } from '@material-ui/core/styles/createBreakpoints';
|
import { Breakpoint } from '@material-ui/core/styles/createBreakpoints';
|
||||||
|
|
||||||
import { Svg, Img, ImgWrapper } from './styles';
|
import { Svg, Img, ImgWrapper } from './styles';
|
||||||
|
|
||||||
import brazil from './img/brazil.svg';
|
import brazil from './img/brazil.svg';
|
||||||
import china from './img/china.svg';
|
import china from './img/china.svg';
|
||||||
import india from './img/india.svg';
|
import india from './img/india.svg';
|
||||||
|
@ -2,8 +2,8 @@ import React from 'react';
|
|||||||
import { render } from '@testing-library/react';
|
import { render } from '@testing-library/react';
|
||||||
|
|
||||||
import { DetailContext, DetailContextProps } from '../../pages/Version';
|
import { DetailContext, DetailContextProps } from '../../pages/Version';
|
||||||
import data from './__partials__/data.json';
|
|
||||||
|
|
||||||
|
import data from './__partials__/data.json';
|
||||||
import Install from './Install';
|
import Install from './Install';
|
||||||
|
|
||||||
const detailContextValue: Partial<DetailContextProps> = {
|
const detailContextValue: Partial<DetailContextProps> = {
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import styled from 'react-emotion';
|
import styled from 'react-emotion';
|
||||||
|
|
||||||
import { fontWeight } from '../../utils/styles/sizes';
|
import { fontWeight } from '../../utils/styles/sizes';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import styled, { css } from 'react-emotion';
|
import styled, { css } from 'react-emotion';
|
||||||
|
|
||||||
import colors from '../../utils/styles/colors';
|
import colors from '../../utils/styles/colors';
|
||||||
|
|
||||||
export const Content = styled('div')({
|
export const Content = styled('div')({
|
||||||
|
@ -11,9 +11,10 @@ import FormControl from '@material-ui/core/FormControl';
|
|||||||
import FormHelperText from '@material-ui/core/FormHelperText';
|
import FormHelperText from '@material-ui/core/FormHelperText';
|
||||||
import { css } from 'emotion';
|
import { css } from 'emotion';
|
||||||
|
|
||||||
import * as classes from './styles';
|
|
||||||
import Button from '../../muiComponents/Button';
|
import Button from '../../muiComponents/Button';
|
||||||
|
|
||||||
|
import * as classes from './styles';
|
||||||
|
|
||||||
interface FormFields {
|
interface FormFields {
|
||||||
required: boolean;
|
required: boolean;
|
||||||
pristine: boolean;
|
pristine: boolean;
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { css } from 'emotion';
|
import { css } from 'emotion';
|
||||||
|
|
||||||
import colors from '../../utils/styles/colors';
|
import colors from '../../utils/styles/colors';
|
||||||
|
|
||||||
export const loginDialog = css({
|
export const loginDialog = css({
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
import styled from 'react-emotion';
|
import styled from 'react-emotion';
|
||||||
|
|
||||||
import logo from './img/logo.svg';
|
import logo from './img/logo.svg';
|
||||||
|
|
||||||
export enum Size {
|
export enum Size {
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { shallow, mount } from 'enzyme';
|
import { shallow, mount } from 'enzyme';
|
||||||
|
|
||||||
import NoItems from './NoItems';
|
import NoItems from './NoItems';
|
||||||
|
|
||||||
console.error = jest.fn();
|
console.error = jest.fn();
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { BrowserRouter as Router } from 'react-router-dom';
|
import { BrowserRouter as Router } from 'react-router-dom';
|
||||||
import { shallow } from 'enzyme';
|
import { shallow } from 'enzyme';
|
||||||
|
|
||||||
import NotFound from './NotFound';
|
import NotFound from './NotFound';
|
||||||
|
|
||||||
console.error = jest.fn();
|
console.error = jest.fn();
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { shallow } from 'enzyme';
|
import { shallow } from 'enzyme';
|
||||||
import Package from './Package';
|
|
||||||
import Tag from '../Tag';
|
import Tag from '../Tag';
|
||||||
|
|
||||||
|
import Package from './Package';
|
||||||
import { WrapperLink, Description, OverviewItem } from './styles';
|
import { WrapperLink, Description, OverviewItem } from './styles';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,15 +1,16 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
import BugReport from '@material-ui/icons/BugReport';
|
import BugReport from '@material-ui/icons/BugReport';
|
||||||
import Grid from '@material-ui/core/Grid';
|
import Grid from '@material-ui/core/Grid';
|
||||||
import HomeIcon from '@material-ui/icons/Home';
|
import HomeIcon from '@material-ui/icons/Home';
|
||||||
import ListItem from '@material-ui/core/ListItem';
|
import ListItem from '@material-ui/core/ListItem';
|
||||||
|
|
||||||
import { PackageMetaInterface, Author as PackageAuthor } from 'types/packageMeta';
|
import { PackageMetaInterface, Author as PackageAuthor } from 'types/packageMeta';
|
||||||
|
|
||||||
import Tag from '../Tag';
|
import Tag from '../Tag';
|
||||||
import fileSizeSI from '../../utils/file-size';
|
import fileSizeSI from '../../utils/file-size';
|
||||||
import { formatDate, formatDateDistance } from '../../utils/package';
|
import { formatDate, formatDateDistance } from '../../utils/package';
|
||||||
import Tooltip from '../../muiComponents/Tooltip';
|
import Tooltip from '../../muiComponents/Tooltip';
|
||||||
|
import { isURL } from '../../utils/url';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
Author,
|
Author,
|
||||||
Avatar,
|
Avatar,
|
||||||
@ -27,7 +28,6 @@ import {
|
|||||||
Text,
|
Text,
|
||||||
WrapperLink,
|
WrapperLink,
|
||||||
} from './styles';
|
} from './styles';
|
||||||
import { isURL } from '../../utils/url';
|
|
||||||
|
|
||||||
interface Bugs {
|
interface Bugs {
|
||||||
url: string;
|
url: string;
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
import styled from 'react-emotion';
|
import styled from 'react-emotion';
|
||||||
import { Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
|
|
||||||
import Grid from '@material-ui/core/Grid';
|
import Grid from '@material-ui/core/Grid';
|
||||||
import List from '@material-ui/core/List';
|
import List from '@material-ui/core/List';
|
||||||
import ListItemText from '@material-ui/core/ListItemText';
|
import ListItemText from '@material-ui/core/ListItemText';
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import React, { Fragment, ReactElement } from 'react';
|
import React, { Fragment, ReactElement } from 'react';
|
||||||
|
|
||||||
import Divider from '@material-ui/core/Divider';
|
import Divider from '@material-ui/core/Divider';
|
||||||
|
|
||||||
import Package from '../Package';
|
import Package from '../Package';
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { mount } from 'enzyme';
|
import { mount } from 'enzyme';
|
||||||
import PackageList from './PackageList';
|
|
||||||
import Help from '../Help';
|
|
||||||
import { BrowserRouter } from 'react-router-dom';
|
import { BrowserRouter } from 'react-router-dom';
|
||||||
|
|
||||||
|
import Help from '../Help';
|
||||||
|
|
||||||
|
import PackageList from './PackageList';
|
||||||
|
|
||||||
describe('<PackageList /> component', () => {
|
describe('<PackageList /> component', () => {
|
||||||
test('should load the component with no packages', () => {
|
test('should load the component with no packages', () => {
|
||||||
const props = {
|
const props = {
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { css } from 'emotion';
|
import { css } from 'emotion';
|
||||||
|
|
||||||
import { fontWeight, fontSize } from '../../utils/styles/sizes';
|
import { fontWeight, fontSize } from '../../utils/styles/sizes';
|
||||||
|
|
||||||
export const listTitle = css({
|
export const listTitle = css({
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { mount } from 'enzyme';
|
import { mount } from 'enzyme';
|
||||||
|
|
||||||
import Readme from './Readme';
|
import Readme from './Readme';
|
||||||
|
|
||||||
describe('<Readme /> component', () => {
|
describe('<Readme /> component', () => {
|
||||||
|
@ -1,16 +1,16 @@
|
|||||||
import React, { Component } from 'react';
|
import React, { Component } from 'react';
|
||||||
import { css } from 'emotion';
|
import { css } from 'emotion';
|
||||||
|
|
||||||
import { Props, State } from './types';
|
|
||||||
import { CommandContainer } from './styles';
|
|
||||||
import CopyToClipBoard from '../CopyToClipBoard';
|
|
||||||
import Tabs from '@material-ui/core/Tabs';
|
import Tabs from '@material-ui/core/Tabs';
|
||||||
import Tab from '@material-ui/core/Tab';
|
import Tab from '@material-ui/core/Tab';
|
||||||
import Typography from '@material-ui/core/Typography';
|
import Typography from '@material-ui/core/Typography';
|
||||||
|
|
||||||
|
import CopyToClipBoard from '../CopyToClipBoard';
|
||||||
import { getCLISetRegistry, getCLIChangePassword, getCLISetConfigRegistry } from '../../utils/cli-utils';
|
import { getCLISetRegistry, getCLIChangePassword, getCLISetConfigRegistry } from '../../utils/cli-utils';
|
||||||
import { NODE_MANAGER } from '../../utils/constants';
|
import { NODE_MANAGER } from '../../utils/constants';
|
||||||
|
|
||||||
|
import { CommandContainer } from './styles';
|
||||||
|
import { Props, State } from './types';
|
||||||
|
|
||||||
/* eslint react/prop-types:0 */
|
/* eslint react/prop-types:0 */
|
||||||
function TabContainer({ children }): JSX.Element {
|
function TabContainer({ children }): JSX.Element {
|
||||||
return (
|
return (
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import Dialog from '@material-ui/core/Dialog';
|
import Dialog from '@material-ui/core/Dialog';
|
||||||
import DialogActions from '@material-ui/core/DialogActions';
|
import DialogActions from '@material-ui/core/DialogActions';
|
||||||
import { Title, Content } from './styles';
|
|
||||||
|
|
||||||
import { Props } from './types';
|
|
||||||
import Button from '../../muiComponents/Button';
|
import Button from '../../muiComponents/Button';
|
||||||
|
|
||||||
|
import { Title, Content } from './styles';
|
||||||
|
import { Props } from './types';
|
||||||
|
|
||||||
const LABEL = 'CLOSE';
|
const LABEL = 'CLOSE';
|
||||||
|
|
||||||
const RegistryInfoDialog: React.FC<Props> = ({ open = false, children, onClose }) => (
|
const RegistryInfoDialog: React.FC<Props> = ({ open = false, children, onClose }) => (
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import styled from 'react-emotion';
|
import styled from 'react-emotion';
|
||||||
import DialogTitle from '@material-ui/core/DialogTitle';
|
import DialogTitle from '@material-ui/core/DialogTitle';
|
||||||
import DialogContent from '@material-ui/core/DialogContent';
|
import DialogContent from '@material-ui/core/DialogContent';
|
||||||
|
|
||||||
import colors from '../../utils/styles/colors';
|
import colors from '../../utils/styles/colors';
|
||||||
import { fontSize } from '../../utils/styles/sizes';
|
import { fontSize } from '../../utils/styles/sizes';
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { mount } from 'enzyme';
|
import { mount } from 'enzyme';
|
||||||
|
|
||||||
import Repository from './Repository';
|
import Repository from './Repository';
|
||||||
|
|
||||||
jest.mock('./img/git.png', () => '');
|
jest.mock('./img/git.png', () => '');
|
||||||
|
@ -1,17 +1,15 @@
|
|||||||
/* eslint react/jsx-max-depth: 0 */
|
/* eslint react/jsx-max-depth: 0 */
|
||||||
|
|
||||||
import React, { Component, Fragment, ReactElement } from 'react';
|
|
||||||
import List from '@material-ui/core/List';
|
import List from '@material-ui/core/List';
|
||||||
|
import React, { Component, Fragment, ReactElement } from 'react';
|
||||||
import { DetailContextConsumer } from '../../pages/Version';
|
|
||||||
import CopyToClipBoard from '../CopyToClipBoard';
|
|
||||||
|
|
||||||
import { Heading, GithubLink, RepositoryListItem, RepositoryListItemText } from './styles';
|
|
||||||
|
|
||||||
import git from './img/git.png';
|
|
||||||
import { isURL } from '../../utils/url';
|
|
||||||
|
|
||||||
import Avatar from '../../muiComponents/Avatar';
|
import Avatar from '../../muiComponents/Avatar';
|
||||||
|
import { DetailContextConsumer } from '../../pages/Version';
|
||||||
|
import { isURL } from '../../utils/url';
|
||||||
|
import CopyToClipBoard from '../CopyToClipBoard';
|
||||||
|
|
||||||
|
import git from './img/git.png';
|
||||||
|
import { GithubLink, Heading, RepositoryListItem, RepositoryListItemText } from './styles';
|
||||||
|
|
||||||
class Repository extends Component {
|
class Repository extends Component {
|
||||||
public render(): ReactElement<HTMLElement> {
|
public render(): ReactElement<HTMLElement> {
|
||||||
|
@ -2,11 +2,11 @@ import styled from 'react-emotion';
|
|||||||
import Grid from '@material-ui/core/Grid';
|
import Grid from '@material-ui/core/Grid';
|
||||||
import ListItem from '@material-ui/core/ListItem';
|
import ListItem from '@material-ui/core/ListItem';
|
||||||
import Typography from '@material-ui/core/Typography';
|
import Typography from '@material-ui/core/Typography';
|
||||||
|
import ListItemText from '@material-ui/core/ListItemText';
|
||||||
|
|
||||||
import Github from '../../icons/GitHub';
|
import Github from '../../icons/GitHub';
|
||||||
import colors from '../../utils/styles/colors';
|
import colors from '../../utils/styles/colors';
|
||||||
import { fontWeight } from '../../utils/styles/sizes';
|
import { fontWeight } from '../../utils/styles/sizes';
|
||||||
import ListItemText from '@material-ui/core/ListItemText';
|
|
||||||
|
|
||||||
export const Heading = styled(Typography)({
|
export const Heading = styled(Typography)({
|
||||||
'&&': {
|
'&&': {
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
import React, { KeyboardEvent, Component, ReactElement } from 'react';
|
import React, { KeyboardEvent, Component, ReactElement } from 'react';
|
||||||
import { withRouter, RouteComponentProps } from 'react-router-dom';
|
import { withRouter, RouteComponentProps } from 'react-router-dom';
|
||||||
import { css } from 'emotion';
|
import { css } from 'emotion';
|
||||||
|
|
||||||
import { default as IconSearch } from '@material-ui/icons/Search';
|
import { default as IconSearch } from '@material-ui/icons/Search';
|
||||||
import InputAdornment from '@material-ui/core/InputAdornment';
|
import InputAdornment from '@material-ui/core/InputAdornment';
|
||||||
import debounce from 'lodash/debounce';
|
import debounce from 'lodash/debounce';
|
||||||
|
@ -2,6 +2,7 @@ import React from 'react';
|
|||||||
import { shallow, mount } from 'enzyme';
|
import { shallow, mount } from 'enzyme';
|
||||||
|
|
||||||
import { DetailContext } from '../../pages/Version';
|
import { DetailContext } from '../../pages/Version';
|
||||||
|
|
||||||
import UpLinks from './UpLinks';
|
import UpLinks from './UpLinks';
|
||||||
|
|
||||||
describe('<UpLinks /> component', () => {
|
describe('<UpLinks /> component', () => {
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import styled from 'react-emotion';
|
import styled from 'react-emotion';
|
||||||
import Typography from '@material-ui/core/Typography';
|
import Typography from '@material-ui/core/Typography';
|
||||||
import { default as MuiListItemText } from '@material-ui/core/ListItemText';
|
import { default as MuiListItemText } from '@material-ui/core/ListItemText';
|
||||||
|
|
||||||
import { fontWeight } from '../../utils/styles/sizes';
|
import { fontWeight } from '../../utils/styles/sizes';
|
||||||
|
|
||||||
export const Heading = styled(Typography)({
|
export const Heading = styled(Typography)({
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { mount } from 'enzyme';
|
import { mount } from 'enzyme';
|
||||||
import { MemoryRouter } from 'react-router';
|
import { MemoryRouter } from 'react-router';
|
||||||
|
import { render, cleanup } from '@testing-library/react';
|
||||||
|
|
||||||
import { DetailContext, DetailContextProps } from '../../pages/Version';
|
import { DetailContext, DetailContextProps } from '../../pages/Version';
|
||||||
|
|
||||||
import Versions, { LABEL_CURRENT_TAGS, LABEL_VERSION_HISTORY } from './Versions';
|
import Versions, { LABEL_CURRENT_TAGS, LABEL_VERSION_HISTORY } from './Versions';
|
||||||
import data from './__partials__/data.json';
|
import data from './__partials__/data.json';
|
||||||
|
|
||||||
import { render, cleanup } from '@testing-library/react';
|
|
||||||
|
|
||||||
const detailContextValue: Partial<DetailContextProps> = {
|
const detailContextValue: Partial<DetailContextProps> = {
|
||||||
packageName: 'foo',
|
packageName: 'foo',
|
||||||
packageMeta: data,
|
packageMeta: data,
|
||||||
|
@ -1,14 +1,12 @@
|
|||||||
import React, { useContext } from 'react';
|
import React, { useContext } from 'react';
|
||||||
|
|
||||||
import { DetailContext } from '../../pages/Version';
|
import { DetailContext } from '../../pages/Version';
|
||||||
|
import { DIST_TAGS } from '../../../lib/constants';
|
||||||
|
|
||||||
import { Heading } from './styles';
|
import { Heading } from './styles';
|
||||||
|
|
||||||
import VersionsTagList from './VersionsTagList';
|
import VersionsTagList from './VersionsTagList';
|
||||||
import VersionsHistoryList from './VersionsHistoryList';
|
import VersionsHistoryList from './VersionsHistoryList';
|
||||||
|
|
||||||
import { DIST_TAGS } from '../../../lib/constants';
|
|
||||||
|
|
||||||
export const NOT_AVAILABLE = 'Not available';
|
export const NOT_AVAILABLE = 'Not available';
|
||||||
export const LABEL_CURRENT_TAGS = 'Current Tags';
|
export const LABEL_CURRENT_TAGS = 'Current Tags';
|
||||||
export const LABEL_VERSION_HISTORY = 'Version History';
|
export const LABEL_VERSION_HISTORY = 'Version History';
|
||||||
|
@ -3,11 +3,12 @@ import List from '@material-ui/core/List';
|
|||||||
import Link from '@material-ui/core/Link';
|
import Link from '@material-ui/core/Link';
|
||||||
import ListItem from '@material-ui/core/ListItem';
|
import ListItem from '@material-ui/core/ListItem';
|
||||||
import { Link as RouterLink } from 'react-router-dom';
|
import { Link as RouterLink } from 'react-router-dom';
|
||||||
import { Spacer, ListItemText } from './styles';
|
|
||||||
|
|
||||||
import { Versions, Time } from '../../../types/packageMeta';
|
import { Versions, Time } from '../../../types/packageMeta';
|
||||||
import { formatDateDistance } from '../../utils/package';
|
import { formatDateDistance } from '../../utils/package';
|
||||||
|
|
||||||
|
import { Spacer, ListItemText } from './styles';
|
||||||
|
|
||||||
export const NOT_AVAILABLE = 'Not available';
|
export const NOT_AVAILABLE = 'Not available';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import List from '@material-ui/core/List';
|
import List from '@material-ui/core/List';
|
||||||
import ListItem from '@material-ui/core/ListItem';
|
import ListItem from '@material-ui/core/ListItem';
|
||||||
import { Spacer, ListItemText } from './styles';
|
|
||||||
|
|
||||||
import { DistTags } from '../../../types/packageMeta';
|
import { DistTags } from '../../../types/packageMeta';
|
||||||
|
|
||||||
|
import { Spacer, ListItemText } from './styles';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
tags: DistTags;
|
tags: DistTags;
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import styled from 'react-emotion';
|
import styled from 'react-emotion';
|
||||||
import Typography from '@material-ui/core/Typography';
|
import Typography from '@material-ui/core/Typography';
|
||||||
import { default as MuiListItemText } from '@material-ui/core/ListItemText';
|
import { default as MuiListItemText } from '@material-ui/core/ListItemText';
|
||||||
|
|
||||||
import { fontWeight } from '../../utils/styles/sizes';
|
import { fontWeight } from '../../utils/styles/sizes';
|
||||||
|
|
||||||
export const Heading = styled(Typography)({
|
export const Heading = styled(Typography)({
|
||||||
|
8
src/muiComponents/.eslintrc
Normal file
8
src/muiComponents/.eslintrc
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"rules": {
|
||||||
|
"verdaccio/jsx-spread": 0,
|
||||||
|
"react/display-name": 0,
|
||||||
|
"react/jsx-sort-props": 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -4,8 +4,6 @@ import { default as MaterialUIAvatar, AvatarProps } from '@material-ui/core/Avat
|
|||||||
// The default element type of MUI's Avatar is 'div' and we don't allow the change of this prop
|
// The default element type of MUI's Avatar is 'div' and we don't allow the change of this prop
|
||||||
type AvatarRef = HTMLElementTagNameMap['div'];
|
type AvatarRef = HTMLElementTagNameMap['div'];
|
||||||
|
|
||||||
/* eslint-disable verdaccio/jsx-spread */
|
|
||||||
// eslint-disable-next-line react/display-name
|
|
||||||
const Avatar = forwardRef<AvatarRef, AvatarProps>(function Avatar(props, ref) {
|
const Avatar = forwardRef<AvatarRef, AvatarProps>(function Avatar(props, ref) {
|
||||||
return <MaterialUIAvatar {...props} ref={ref} />;
|
return <MaterialUIAvatar {...props} ref={ref} />;
|
||||||
});
|
});
|
||||||
|
@ -3,8 +3,6 @@ import { default as MaterialUIButton, ButtonProps } from '@material-ui/core/Butt
|
|||||||
|
|
||||||
type ButtonRef = HTMLElementTagNameMap['button'];
|
type ButtonRef = HTMLElementTagNameMap['button'];
|
||||||
|
|
||||||
/* eslint-disable verdaccio/jsx-spread */
|
|
||||||
// eslint-disable-next-line react/display-name
|
|
||||||
const Button = forwardRef<ButtonRef, ButtonProps>(function Button(props, ref) {
|
const Button = forwardRef<ButtonRef, ButtonProps>(function Button(props, ref) {
|
||||||
return <MaterialUIButton {...props} ref={ref} />;
|
return <MaterialUIButton {...props} ref={ref} />;
|
||||||
});
|
});
|
||||||
|
@ -3,8 +3,6 @@ import { default as MaterialUIIconButton, IconButtonProps } from '@material-ui/c
|
|||||||
|
|
||||||
type IconButtonRef = HTMLElementTagNameMap['button'];
|
type IconButtonRef = HTMLElementTagNameMap['button'];
|
||||||
|
|
||||||
/* eslint-disable verdaccio/jsx-spread */
|
|
||||||
// eslint-disable-next-line react/display-name
|
|
||||||
const IconButton = forwardRef<IconButtonRef, IconButtonProps>(function IconButton(props, ref) {
|
const IconButton = forwardRef<IconButtonRef, IconButtonProps>(function IconButton(props, ref) {
|
||||||
return <MaterialUIIconButton {...props} ref={ref} />;
|
return <MaterialUIIconButton {...props} ref={ref} />;
|
||||||
});
|
});
|
||||||
|
@ -4,17 +4,15 @@ import { default as MaterialUITextField, TextFieldProps } from '@material-ui/cor
|
|||||||
// The default element type of MUI's TextField is 'div'
|
// The default element type of MUI's TextField is 'div'
|
||||||
type TextFieldRef = HTMLElementTagNameMap['div'];
|
type TextFieldRef = HTMLElementTagNameMap['div'];
|
||||||
|
|
||||||
/* eslint-disable verdaccio/jsx-spread */
|
|
||||||
// eslint-disable-next-line react/display-name
|
|
||||||
const TextField = forwardRef<TextFieldRef, TextFieldProps>(function ToolTip({ InputProps, classes, ...props }, ref) {
|
const TextField = forwardRef<TextFieldRef, TextFieldProps>(function ToolTip({ InputProps, classes, ...props }, ref) {
|
||||||
return (
|
return (
|
||||||
<MaterialUITextField
|
<MaterialUITextField
|
||||||
{...props}
|
{...props}
|
||||||
|
innerRef={ref}
|
||||||
InputProps={{
|
InputProps={{
|
||||||
...InputProps,
|
...InputProps,
|
||||||
classes,
|
classes,
|
||||||
}}
|
}}
|
||||||
innerRef={ref}
|
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
@ -4,8 +4,6 @@ import { default as MaterialUITooltip, TooltipProps } from '@material-ui/core/To
|
|||||||
// The default element type of MUI's Tooltip is 'div' and the change of this prop is not allowed
|
// The default element type of MUI's Tooltip is 'div' and the change of this prop is not allowed
|
||||||
type TooltipRef = HTMLElementTagNameMap['div'];
|
type TooltipRef = HTMLElementTagNameMap['div'];
|
||||||
|
|
||||||
/* eslint-disable verdaccio/jsx-spread */
|
|
||||||
// eslint-disable-next-line react/display-name
|
|
||||||
const Tooltip = forwardRef<TooltipRef, TooltipProps>(function ToolTip(props, ref) {
|
const Tooltip = forwardRef<TooltipRef, TooltipProps>(function ToolTip(props, ref) {
|
||||||
return <MaterialUITooltip {...props} innerRef={ref} />;
|
return <MaterialUITooltip {...props} innerRef={ref} />;
|
||||||
});
|
});
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import React, { FC, ReactElement } from 'react';
|
import React, { FC, ReactElement } from 'react';
|
||||||
import Grid from '@material-ui/core/Grid';
|
import Grid from '@material-ui/core/Grid';
|
||||||
|
|
||||||
import DetailContainer from '../../components/DetailContainer';
|
import DetailContainer from '../../components/DetailContainer';
|
||||||
import DetailSidebar from '../../components/DetailSidebar';
|
import DetailSidebar from '../../components/DetailSidebar';
|
||||||
|
|
||||||
|
@ -1,13 +1,12 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { render, cleanup } from '@testing-library/react';
|
import { render, cleanup } from '@testing-library/react';
|
||||||
|
|
||||||
import { MemoryRouter } from 'react-router';
|
import { MemoryRouter } from 'react-router';
|
||||||
|
import { waitForElement } from '@testing-library/dom';
|
||||||
|
|
||||||
import vueMetadata from '../../../test/fixtures/metadata/vue.json';
|
import vueMetadata from '../../../test/fixtures/metadata/vue.json';
|
||||||
|
import ErrorBoundary from '../../App/AppError';
|
||||||
|
|
||||||
import Version from './Version';
|
import Version from './Version';
|
||||||
import { waitForElement } from '@testing-library/dom';
|
|
||||||
import ErrorBoundary from '../../App/AppError';
|
|
||||||
|
|
||||||
// :-) we mock this otherways fails on render, some weird issue on material-ui
|
// :-) we mock this otherways fails on render, some weird issue on material-ui
|
||||||
jest.mock('../../muiComponents/Avatar');
|
jest.mock('../../muiComponents/Avatar');
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import React, { Consumer, Provider } from 'react';
|
import React, { Consumer, Provider } from 'react';
|
||||||
|
|
||||||
import { DetailContextProps, VersionPageConsumerProps } from './types';
|
import { DetailContextProps, VersionPageConsumerProps } from './types';
|
||||||
|
|
||||||
export const DetailContext = React.createContext<Partial<DetailContextProps>>({});
|
export const DetailContext = React.createContext<Partial<DetailContextProps>>({});
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import styled from 'react-emotion';
|
import styled from 'react-emotion';
|
||||||
import DialogTitle from '@material-ui/core/DialogTitle';
|
import DialogTitle from '@material-ui/core/DialogTitle';
|
||||||
|
|
||||||
import colors from '../../utils/styles/colors';
|
import colors from '../../utils/styles/colors';
|
||||||
import { fontSize } from '../../utils/styles/sizes';
|
import { fontSize } from '../../utils/styles/sizes';
|
||||||
|
|
||||||
|
@ -3,8 +3,8 @@
|
|||||||
import React, { Component, ReactElement } from 'react';
|
import React, { Component, ReactElement } from 'react';
|
||||||
import { Router, Route, Switch } from 'react-router-dom';
|
import { Router, Route, Switch } from 'react-router-dom';
|
||||||
import { createBrowserHistory } from 'history';
|
import { createBrowserHistory } from 'history';
|
||||||
import { AppContextConsumer, AppStateInterface } from './App/App';
|
|
||||||
|
|
||||||
|
import { AppContextConsumer, AppStateInterface } from './App/App';
|
||||||
import Header from './components/Header';
|
import Header from './components/Header';
|
||||||
|
|
||||||
const history = createBrowserHistory({
|
const history = createBrowserHistory({
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import API from './api';
|
|
||||||
import { PackageMetaInterface } from 'types/packageMeta';
|
import { PackageMetaInterface } from 'types/packageMeta';
|
||||||
|
|
||||||
|
import API from './api';
|
||||||
|
|
||||||
export async function callReadme(packageName, packageVersion?: string): Promise<string | {}> {
|
export async function callReadme(packageName, packageVersion?: string): Promise<string | {}> {
|
||||||
return await API.request<string | {}>(`package/readme/${packageName}${packageVersion ? `?v=${packageVersion}` : ''}`, 'GET');
|
return await API.request<string | {}>(`package/readme/${packageName}${packageVersion ? `?v=${packageVersion}` : ''}`, 'GET');
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
import { isTokenExpire, makeLogin } from './login';
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
generateTokenWithTimeRange,
|
generateTokenWithTimeRange,
|
||||||
generateTokenWithExpirationAsString,
|
generateTokenWithExpirationAsString,
|
||||||
generateTokenWithOutExpiration,
|
generateTokenWithOutExpiration,
|
||||||
generateInvalidToken,
|
generateInvalidToken,
|
||||||
} from '../../jest/unit/components/__mocks__/token';
|
} from '../../jest/unit/components/__mocks__/token';
|
||||||
|
|
||||||
|
import { isTokenExpire, makeLogin } from './login';
|
||||||
|
|
||||||
/* eslint-disable no-console */
|
/* eslint-disable no-console */
|
||||||
console.error = jest.fn();
|
console.error = jest.fn();
|
||||||
|
|
||||||
|
@ -2,9 +2,11 @@ import isString from 'lodash/isString';
|
|||||||
import isNumber from 'lodash/isNumber';
|
import isNumber from 'lodash/isNumber';
|
||||||
import isEmpty from 'lodash/isEmpty';
|
import isEmpty from 'lodash/isEmpty';
|
||||||
import { Base64 } from 'js-base64';
|
import { Base64 } from 'js-base64';
|
||||||
import API from './api';
|
|
||||||
import { HEADERS } from '../../lib/constants';
|
import { HEADERS } from '../../lib/constants';
|
||||||
|
|
||||||
|
import API from './api';
|
||||||
|
|
||||||
interface PayloadInterface {
|
interface PayloadInterface {
|
||||||
exp: number;
|
exp: number;
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { formatLicense, formatRepository, formatDate, formatDateDistance, getLastUpdatedPackageTime, getRecentReleases } from './package';
|
|
||||||
|
|
||||||
import { packageMeta } from '../../jest/unit/components/store/packageMeta';
|
import { packageMeta } from '../../jest/unit/components/store/packageMeta';
|
||||||
|
|
||||||
|
import { formatLicense, formatRepository, formatDate, formatDateDistance, getLastUpdatedPackageTime, getRecentReleases } from './package';
|
||||||
|
|
||||||
describe('formatLicense', (): void => {
|
describe('formatLicense', (): void => {
|
||||||
test('should check license field different values', (): void => {
|
test('should check license field different values', (): void => {
|
||||||
expect(formatLicense('MIT')).toEqual('MIT');
|
expect(formatLicense('MIT')).toEqual('MIT');
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
|
import { isObject } from 'util';
|
||||||
|
|
||||||
import { UpLinks } from '@verdaccio/types';
|
import { UpLinks } from '@verdaccio/types';
|
||||||
import isString from 'lodash/isString';
|
import isString from 'lodash/isString';
|
||||||
import format from 'date-fns/format';
|
import format from 'date-fns/format';
|
||||||
import distanceInWordsToNow from 'date-fns/distance_in_words_to_now';
|
import distanceInWordsToNow from 'date-fns/distance_in_words_to_now';
|
||||||
import { isObject } from 'util';
|
|
||||||
|
|
||||||
export const TIMEFORMAT = 'DD.MM.YYYY, HH:mm:ss';
|
export const TIMEFORMAT = 'DD.MM.YYYY, HH:mm:ss';
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { injectGlobal } from 'emotion';
|
import { injectGlobal } from 'emotion';
|
||||||
|
|
||||||
import { fontSize, fontWeight } from './sizes';
|
import { fontSize, fontWeight } from './sizes';
|
||||||
import colors from './colors';
|
import colors from './colors';
|
||||||
import { breakpoints } from './media';
|
import { breakpoints } from './media';
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
import webpack from 'webpack';
|
import webpack from 'webpack';
|
||||||
import WebpackDevServer from 'webpack-dev-server';
|
import WebpackDevServer from 'webpack-dev-server';
|
||||||
import config from './webpack.dev.config.babel';
|
|
||||||
import ora from 'ora';
|
import ora from 'ora';
|
||||||
|
|
||||||
import env from '../config/env';
|
import env from '../config/env';
|
||||||
|
|
||||||
|
import config from './webpack.dev.config.babel';
|
||||||
|
|
||||||
const compiler = webpack(config);
|
const compiler = webpack(config);
|
||||||
const spinner = ora('Compiler is running...').start();
|
const spinner = ora('Compiler is running...').start();
|
||||||
compiler.hooks.done.tap('Verdaccio Dev Server', () => {
|
compiler.hooks.done.tap('Verdaccio Dev Server', () => {
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
|
const path = require('path');
|
||||||
|
|
||||||
const startServer = require('verdaccio').default;
|
const startServer = require('verdaccio').default;
|
||||||
const yalm = require('js-yaml');
|
const yalm = require('js-yaml');
|
||||||
const path = require('path');
|
|
||||||
|
|
||||||
const storageLocation = path.join(__dirname, '../partials/storage');
|
const storageLocation = path.join(__dirname, '../partials/storage');
|
||||||
const pluginsLocation = path.join(__dirname, '../partials/plugins');
|
const pluginsLocation = path.join(__dirname, '../partials/plugins');
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
const env = require('../config/env');
|
|
||||||
const StyleLintPlugin = require('stylelint-webpack-plugin');
|
const StyleLintPlugin = require('stylelint-webpack-plugin');
|
||||||
|
|
||||||
|
const env = require('../config/env');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
entry: `${env.SRC_ROOT}/index.tsx`,
|
entry: `${env.SRC_ROOT}/index.tsx`,
|
||||||
|
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
import webpack from 'webpack';
|
import webpack from 'webpack';
|
||||||
import HTMLWebpackPlugin from 'html-webpack-plugin';
|
import HTMLWebpackPlugin from 'html-webpack-plugin';
|
||||||
import FriendlyErrorsPlugin from 'friendly-errors-webpack-plugin';
|
import FriendlyErrorsPlugin from 'friendly-errors-webpack-plugin';
|
||||||
import baseConfig from './webpack.config';
|
|
||||||
import env from '../config/env';
|
|
||||||
import StyleLintPlugin from 'stylelint-webpack-plugin';
|
import StyleLintPlugin from 'stylelint-webpack-plugin';
|
||||||
|
|
||||||
|
import env from '../config/env';
|
||||||
|
|
||||||
|
import baseConfig from './webpack.config';
|
||||||
import getPackageJson from './getPackageJson';
|
import getPackageJson from './getPackageJson';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
@ -3,10 +3,12 @@ const HTMLWebpackPlugin = require('html-webpack-plugin');
|
|||||||
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
||||||
const UglifyJsWebpackPlugin = require('uglifyjs-webpack-plugin');
|
const UglifyJsWebpackPlugin = require('uglifyjs-webpack-plugin');
|
||||||
const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin');
|
const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin');
|
||||||
const baseConfig = require('./webpack.config');
|
|
||||||
const env = require('../config/env');
|
|
||||||
const _ = require('lodash');
|
const _ = require('lodash');
|
||||||
const merge = require('webpack-merge');
|
const merge = require('webpack-merge');
|
||||||
|
|
||||||
|
const env = require('../config/env');
|
||||||
|
|
||||||
|
const baseConfig = require('./webpack.config');
|
||||||
const getPackageJson = require('./getPackageJson');
|
const getPackageJson = require('./getPackageJson');
|
||||||
|
|
||||||
const { version, name, license } = getPackageJson('version', 'name', 'license');
|
const { version, name, license } = getPackageJson('version', 'name', 'license');
|
||||||
|
17
yarn.lock
17
yarn.lock
@ -5176,6 +5176,23 @@ eslint-plugin-import@2.18.0:
|
|||||||
read-pkg-up "^2.0.0"
|
read-pkg-up "^2.0.0"
|
||||||
resolve "^1.11.0"
|
resolve "^1.11.0"
|
||||||
|
|
||||||
|
eslint-plugin-import@2.18.2:
|
||||||
|
version "2.18.2"
|
||||||
|
resolved "https://registry.verdaccio.org/eslint-plugin-import/-/eslint-plugin-import-2.18.2.tgz#02f1180b90b077b33d447a17a2326ceb400aceb6"
|
||||||
|
integrity sha512-5ohpsHAiUBRNaBWAF08izwUGlbrJoJJ+W9/TBwsGoR1MnlgfwMIKrFeSjWbt6moabiXW9xNvtFz+97KHRfI4HQ==
|
||||||
|
dependencies:
|
||||||
|
array-includes "^3.0.3"
|
||||||
|
contains-path "^0.1.0"
|
||||||
|
debug "^2.6.9"
|
||||||
|
doctrine "1.5.0"
|
||||||
|
eslint-import-resolver-node "^0.3.2"
|
||||||
|
eslint-module-utils "^2.4.0"
|
||||||
|
has "^1.0.3"
|
||||||
|
minimatch "^3.0.4"
|
||||||
|
object.values "^1.1.0"
|
||||||
|
read-pkg-up "^2.0.0"
|
||||||
|
resolve "^1.11.0"
|
||||||
|
|
||||||
eslint-plugin-jest@22.10.0:
|
eslint-plugin-jest@22.10.0:
|
||||||
version "22.10.0"
|
version "22.10.0"
|
||||||
resolved "https://registry.verdaccio.org/eslint-plugin-jest/-/eslint-plugin-jest-22.10.0.tgz#a22be77f4dc692808b88ead0059620bda299a97d"
|
resolved "https://registry.verdaccio.org/eslint-plugin-jest/-/eslint-plugin-jest-22.10.0.tgz#a22be77f4dc692808b88ead0059620bda299a97d"
|
||||||
|
Loading…
Reference in New Issue
Block a user