diff --git a/.eslintrc.json b/.eslintrc.json index 056f0bce..b3fa82b2 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -14,5 +14,6 @@ "plugins": ["react"], "rules": { "react/forbid-prop-types": 0 - } + }, + "ignorePatterns": ["**/*.test.js"] } diff --git a/.prettierrc b/.prettierrc index 1592ecf9..cb7cea7f 100644 --- a/.prettierrc +++ b/.prettierrc @@ -2,7 +2,7 @@ "singleQuote": true, "jsxSingleQuote": false, "tabWidth": 2, - "printWidth": 480, + "printWidth": 120, "trailingComma": "all", "semi": true, "exclude": ["node_modules", "codepipeline"] diff --git a/CODE_STYLE_GUIDE.md b/CODE_STYLE_GUIDE.md index 0df15381..9dd3c881 100644 --- a/CODE_STYLE_GUIDE.md +++ b/CODE_STYLE_GUIDE.md @@ -16,9 +16,11 @@ ## Spacing 1. **JS:** + - Use a space after `if`, `for`, `while`, `switch`. - Do not use a space after the opening `(` and before the closing `)`. - Use a space before and after destructuring objects. + ```js //good const { apple, mangoes } = fruits; diff --git a/__mocks__/gatsby.js b/__mocks__/gatsby.js index 07bc11f4..2e53287c 100644 --- a/__mocks__/gatsby.js +++ b/__mocks__/gatsby.js @@ -1,4 +1,6 @@ +/* eslint-disable no-undef */ const React = require('react'); + const gatsby = jest.requireActual('gatsby'); module.exports = { @@ -10,7 +12,7 @@ module.exports = { React.createElement('a', { ...rest, href: to, - }) + }), ), StaticQuery: jest.fn(), useStaticQuery: jest.fn(), diff --git a/src/components/__tests__/addons.test.js b/src/components/__tests__/addons.test.js index 063bd306..917e3cd1 100644 --- a/src/components/__tests__/addons.test.js +++ b/src/components/__tests__/addons.test.js @@ -91,7 +91,7 @@ describe('Addons', () => { social={socialInput} handleCheckChange={mockHandleCheckChange} handleDataChange={mockHandleDataChange} - /> + />, ); expect(toJson(addOnComponent)).toMatchSnapshot(); @@ -113,7 +113,7 @@ describe('Addons', () => { social={newSocialInput} handleCheckChange={mockHandleCheckChange} handleDataChange={mockHandleDataChange} - /> + />, ); addOnComponent.find('#visitors-count-open-btn').simulate('click', {}); @@ -147,7 +147,7 @@ describe('Addons', () => { social={newSocialInput} handleCheckChange={mockHandleCheckChange} handleDataChange={mockHandleDataChange} - /> + />, ); addOnComponent.find('#visitors-count-open-btn').simulate('click', {}); @@ -176,7 +176,7 @@ describe('Addons', () => { social={newSocialInput} handleCheckChange={mockHandleCheckChange} handleDataChange={mockHandleDataChange} - /> + />, ); addOnComponent.find('#visitors-count-open-btn').simulate('click', {}); @@ -205,7 +205,7 @@ describe('Addons', () => { social={newSocialInput} handleCheckChange={mockHandleCheckChange} handleDataChange={mockHandleDataChange} - /> + />, ); addOnComponent.find('#visitors-count-open-btn').simulate('click', {}); @@ -233,7 +233,7 @@ describe('Addons', () => { social={newSocialInput} handleCheckChange={mockHandleCheckChange} handleDataChange={mockHandleDataChange} - /> + />, ); addOnComponent.find('#github-stats-open-btn').simulate('click', {}); @@ -267,7 +267,7 @@ describe('Addons', () => { social={newSocialInput} handleCheckChange={mockHandleCheckChange} handleDataChange={mockHandleDataChange} - /> + />, ); addOnComponent.find('#github-stats-open-btn').simulate('click', {}); @@ -318,7 +318,7 @@ describe('Addons', () => { social={newSocialInput} handleCheckChange={mockHandleCheckChange} handleDataChange={mockHandleDataChange} - /> + />, ); addOnComponent.find('#github-stats-open-btn').simulate('click', {}); @@ -369,7 +369,7 @@ describe('Addons', () => { social={newSocialInput} handleCheckChange={mockHandleCheckChange} handleDataChange={mockHandleDataChange} - /> + />, ); addOnComponent.find('#github-stats-open-btn').simulate('click', {}); @@ -421,7 +421,7 @@ describe('Addons', () => { social={newSocialInput} handleCheckChange={mockHandleCheckChange} handleDataChange={mockHandleDataChange} - /> + />, ); addOnComponent.find('#github-stats-open-btn').simulate('click', {}); @@ -472,7 +472,7 @@ describe('Addons', () => { social={newSocialInput} handleCheckChange={mockHandleCheckChange} handleDataChange={mockHandleDataChange} - /> + />, ); addOnComponent.find('#github-stats-open-btn').simulate('click', {}); @@ -524,7 +524,7 @@ describe('Addons', () => { social={newSocialInput} handleCheckChange={mockHandleCheckChange} handleDataChange={mockHandleDataChange} - /> + />, ); addOnComponent.find('#github-stats-open-btn').simulate('click', {}); @@ -576,7 +576,7 @@ describe('Addons', () => { social={newSocialInput} handleCheckChange={mockHandleCheckChange} handleDataChange={mockHandleDataChange} - /> + />, ); addOnComponent.find('#github-stats-open-btn').simulate('click', {}); @@ -617,7 +617,7 @@ describe('Addons', () => { social={newSocialInput} handleCheckChange={mockHandleCheckChange} handleDataChange={mockHandleDataChange} - /> + />, ); addOnComponent.find('#top-languages-open-btn').simulate('click', {}); @@ -652,7 +652,7 @@ describe('Addons', () => { social={newSocialInput} handleCheckChange={mockHandleCheckChange} handleDataChange={mockHandleDataChange} - /> + />, ); addOnComponent.find('#top-languages-open-btn').simulate('click', {}); @@ -686,7 +686,7 @@ describe('Addons', () => { social={socialInput} handleCheckChange={mockHandleCheckChange} handleDataChange={mockHandleDataChange} - /> + />, ); addOnComponent.find('#visitors-count').simulate('change', mockEvent); @@ -725,7 +725,7 @@ describe('Addons', () => { social={newSocialInput} handleCheckChange={mockHandleCheckChange} handleDataChange={mockHandleDataChange} - /> + />, ); const workflowElement = addOnComponent.find('.workflow'); @@ -748,7 +748,7 @@ describe('Addons', () => { social={newSocialInput} handleCheckChange={mockHandleCheckChange} handleDataChange={mockHandleDataChange} - /> + />, ); const workflowElement = addOnComponent.find('.workflow'); @@ -771,7 +771,7 @@ describe('Addons', () => { social={newSocialInput} handleCheckChange={mockHandleCheckChange} handleDataChange={mockHandleDataChange} - /> + />, ); const workflowElement = addOnComponent.find('.workflow'); @@ -797,7 +797,7 @@ describe('Addons', () => { social={newSocialInput} handleCheckChange={mockHandleCheckChange} handleDataChange={mockHandleDataChange} - /> + />, ); addOnComponent.find('#blog-post-worklow-span').simulate('click', {}); diff --git a/src/components/__tests__/donate.test.js b/src/components/__tests__/donate.test.js index d0aef31c..a8af15e8 100644 --- a/src/components/__tests__/donate.test.js +++ b/src/components/__tests__/donate.test.js @@ -1,7 +1,6 @@ import React from 'react'; import toJson from 'enzyme-to-json'; import { shallow } from 'enzyme'; - import Donate from '../donate'; describe('Donate', () => { diff --git a/src/components/__tests__/markdown.test.js b/src/components/__tests__/markdown.test.js index ae97a20d..acb37f4f 100644 --- a/src/components/__tests__/markdown.test.js +++ b/src/components/__tests__/markdown.test.js @@ -85,7 +85,7 @@ describe('Markdown', () => { ...props.data, subtitle: '', }} - /> + />, ); expect(toJson(component)).toMatchSnapshot(); }); @@ -102,7 +102,7 @@ describe('Markdown', () => { ...props.prefix, title: '', }} - /> + />, ); expect(toJson(component)).toMatchSnapshot(); }); @@ -115,7 +115,7 @@ describe('Markdown', () => { ...props.data, topLanguages: true, }} - /> + />, ); expect(toJson(component)).toMatchSnapshot(); }); @@ -129,7 +129,7 @@ describe('Markdown', () => { topLanguages: true, githubStats: true, }} - /> + />, ); expect(toJson(component)).toMatchSnapshot(); }); @@ -142,7 +142,7 @@ describe('Markdown', () => { ...props.data, devDynamicBlogs: true, }} - /> + />, ); expect(toJson(component)).toMatchSnapshot(); }); @@ -155,7 +155,7 @@ describe('Markdown', () => { ...props.data, currentWork: '', }} - /> + />, ); expect(toJson(component)).toMatchSnapshot(); }); @@ -168,7 +168,7 @@ describe('Markdown', () => { ...props.data, visitorsBadge: true, }} - /> + />, ); expect(toJson(component)).toMatchSnapshot(); }); @@ -181,7 +181,7 @@ describe('Markdown', () => { ...props.data, twitterBadge: true, }} - /> + />, ); expect(toJson(component)).toMatchSnapshot(); }); @@ -194,7 +194,7 @@ describe('Markdown', () => { ...props.data, githubProfileTrophy: true, }} - /> + />, ); expect(toJson(component)).toMatchSnapshot(); }); @@ -207,7 +207,7 @@ describe('Markdown', () => { ...props.data, githubProfileTrophy: true, }} - /> + />, ); expect(toJson(component)).toMatchSnapshot(); }); diff --git a/src/components/__tests__/markdownPreview.test.js b/src/components/__tests__/markdownPreview.test.js index 9478f093..2f526634 100644 --- a/src/components/__tests__/markdownPreview.test.js +++ b/src/components/__tests__/markdownPreview.test.js @@ -248,7 +248,7 @@ describe('DisplaySocial Preview', () => { base="https://codepen.io" icon="https://cdn.jsdelivr.net/npm/simple-icons@3.0.1/icons/codepen.svg" username={social.codepen} - /> + />, ); expect(tree).toMatchSnapshot(); @@ -259,7 +259,7 @@ describe('DisplaySocial Preview', () => { base="https://codepen.io" icon="https://cdn.jsdelivr.net/npm/simple-icons@3.0.1/icons/codepen.svg" username={''} - /> + />, ); expect(tree).toMatchSnapshot(); @@ -278,7 +278,7 @@ describe('VisitorsBadge Preview', () => { badgeColor: data.badgeColor, badgeStyle: data.badgeStyle, }} - /> + />, ); expect(tree).toMatchSnapshot(); @@ -295,7 +295,7 @@ describe('VisitorsBadge Preview', () => { badgeColor: data.badgeColor, badgeStyle: data.badgeStyle, }} - /> + />, ); expect(tree).toMatchSnapshot(); @@ -371,7 +371,7 @@ describe('TopLanguages Preview', () => { let data = DEFAULT_DATA; let social = DEFAULT_SOCIAL; const tree = shallow( - + , ); expect(tree).toMatchSnapshot(); @@ -389,7 +389,7 @@ describe('GitHubStats Preview', () => { let data = DEFAULT_DATA; let social = DEFAULT_SOCIAL; const tree = shallow( - + , ); expect(tree).toMatchSnapshot(); diff --git a/src/components/addons.jsx b/src/components/addons.jsx index 15cb1e4e..d21a06fc 100644 --- a/src/components/addons.jsx +++ b/src/components/addons.jsx @@ -15,12 +15,24 @@ const AddonsItem = (props) => { <>
{Options && ( - )} @@ -53,7 +65,11 @@ const CustomizeBadge = ({ githubName, badgeOptions, onBadgeUpdate }) => ( <>