Skip to content

Commit 9172902

Browse files
authored
Merge pull request #10 from kammeows/processing-develop
Processing develop
2 parents c50566f + 88a9c65 commit 9172902

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+3962
-3792
lines changed

.eslintrc

Lines changed: 47 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,34 @@
1616
"import/no-unresolved": 0,
1717
"import/no-named-as-default": 0,
1818
"import/no-named-as-default-member": 0,
19+
"import/no-useless-path-segments": 1,
20+
"import/no-cycle":0, //temporarily off
21+
"import/no-import-module-exports": 0, //temporarily off
22+
"import/extensions": [ // override airbnb setting to allow imports of js, jsx, ts, and tsx files to auto-resolve instead of error
23+
"error",
24+
"ignorePackages",
25+
{
26+
"js": "never",
27+
"jsx": "never",
28+
"ts": "never",
29+
"tsx": "never"
30+
}
31+
],
32+
"react/jsx-filename-extension": [1, { "extensions": [".jsx", ".tsx"] }],
1933
"comma-dangle": 0, // not sure why airbnb turned this on. gross!
34+
"default-param-last": 0,
35+
"no-else-return" :0,
2036
"indent": 0,
2137
"no-console": 0,
2238
"no-alert": 0,
39+
"no-import-assign": 2,
40+
"no-promise-executor-return": 0, //temporarily off
41+
"no-restricted-exports": 1,
2342
"no-underscore-dangle": 0,
2443
"no-useless-catch": 2,
44+
"prefer-object-spread": 0,
2545
"max-len": [1, 120, 2, {"ignoreComments": true, "ignoreTemplateLiterals": true}],
46+
"max-classes-per-file": 0,
2647
"quote-props": [1, "as-needed"],
2748
"no-unused-vars": [1, {"vars": "local", "args": "none"}],
2849
"consistent-return": ["error", { "treatUndefinedAsUnspecified": true }],
@@ -36,7 +57,19 @@
3657
{ "ignorePureComponents": true
3758
}],
3859
"class-methods-use-this": 0,
39-
"react/jsx-no-bind": [2, {"allowBind": true, "allowArrowFunctions": true}],
60+
"react/button-has-type": 0,
61+
"react/destructuring-assignment":0,
62+
"react/function-component-definition": 0,
63+
"react/jsx-curly-newline":0,
64+
"react/jsx-fragments":0,
65+
"react/jsx-no-useless-fragment":0, // temporarily off
66+
"react/jsx-one-expression-per-line": 0,
67+
"react/jsx-props-no-spreading": 0,
68+
"react/jsx-wrap-multilines": 0,
69+
"react/jsx-no-bind": [2, {"allowBind": true, "allowArrowFunctions": true, "allowFunctions": true}],
70+
"react/no-deprecated": 0, //temporarily off
71+
"react/no-unused-class-component-methods": 1,
72+
"react/sort-comp": 0,
4073
"no-return-assign": [2, "except-parens"],
4174
"jsx-a11y/anchor-is-valid": [
4275
"error",
@@ -49,6 +82,8 @@
4982
]
5083
}
5184
],
85+
"jsx-a11y/control-has-associated-label": 0, //temporarily off
86+
"jsx-a11y/label-has-associated-control": 0, //temporarily off
5287
"jsx-a11y/label-has-for": [
5388
2,
5489
{
@@ -72,6 +107,11 @@
72107
],
73108
"settings": {
74109
"import/parser": "@babel/eslint-parser",
110+
"import/resolver": {
111+
"node": {
112+
"extensions": [".js", ".jsx", ".ts", ".tsx"]
113+
}
114+
},
75115
"import/resolve": {
76116
"moduleDirectory": ["node_modules"]
77117
}
@@ -87,7 +127,12 @@
87127
{
88128
"files": ["*.ts", "*.tsx"],
89129
"parser": "@typescript-eslint/parser",
90-
"plugins": ["@typescript-eslint"]
130+
"plugins": ["@typescript-eslint"],
131+
"rules": {
132+
"no-use-before-define": "off",
133+
"import/no-extraneous-dependencies": "off",
134+
"no-unused-vars": "off"
135+
}
91136
},
92137
{
93138
"files": ["*.stories.@(js|jsx|ts|tsx)"],

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
- name: Use Node.js
1212
uses: actions/setup-node@v1
1313
with:
14-
node-version: '16.14.x'
14+
node-version: '18.20.x'
1515
- run: npm install
1616
- run: npm run test
1717
- run: npm run lint

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
16.14.2
1+
18.20.8

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
sudo: required
22
language: node_js
33
node_js:
4-
- "16.14.2"
4+
- "18.20.8"
55

66
cache:
77
directories:

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM node:16.14.2 AS base
1+
FROM node:18.20.8 AS base
22
ENV APP_HOME=/usr/src/app \
33
TERM=xterm
44
RUN mkdir -p $APP_HOME

client/common/useKeyDownHandlers.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,3 +66,7 @@ export const DocumentKeyDown = ({ handlers }) => {
6666
DocumentKeyDown.propTypes = {
6767
handlers: PropTypes.objectOf(PropTypes.func)
6868
};
69+
70+
DocumentKeyDown.defaultProps = {
71+
handlers: {}
72+
};

client/components/RootPage.jsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,19 @@ import styled from 'styled-components';
22
import { prop } from '../theme';
33

44
const RootPage = styled.div`
5-
min-height: 100%;
5+
min-height: 100vh;
6+
height: ${({ fixedHeight }) => fixedHeight || '100vh'};
67
display: flex;
7-
justify-content: start;
8+
justify-content: flex-start;
89
flex-direction: column;
910
color: ${prop('primaryTextColor')};
1011
background-color: ${prop('backgroundColor')};
11-
height: ${({ fixedHeight }) => fixedHeight || 'initial'};
1212
1313
@media (max-width: 770px) {
1414
height: 100%;
1515
overflow: hidden;
1616
}
17+
1718
@media print {
1819
@page {
1920
page-orientation: landscape;

client/components/SkipLink.test.tsx

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import { render, screen, fireEvent } from '@testing-library/react';
2+
import React from 'react';
3+
import { useTranslation } from 'react-i18next';
4+
import '@testing-library/jest-dom';
5+
import SkipLink from './SkipLink';
6+
7+
jest.mock('react-i18next', () => ({
8+
useTranslation: () => ({
9+
t: (key: string) => key
10+
})
11+
}));
12+
13+
describe('SkipLink', () => {
14+
const defaultProps = {
15+
targetId: 'main-content',
16+
text: 'goToMain'
17+
};
18+
19+
test('renders with correct href and text', () => {
20+
render(<SkipLink {...defaultProps} />);
21+
const link = screen.getByRole('link');
22+
23+
expect(link).toBeInTheDocument();
24+
expect(link).toHaveAttribute('href', '#main-content');
25+
expect(link).toHaveTextContent('SkipLink.goToMain');
26+
});
27+
28+
test('adds "focus" class on focus and removes it on blur', () => {
29+
render(<SkipLink {...defaultProps} />);
30+
const link = screen.getByRole('link');
31+
32+
expect(link.className).toBe('skip_link');
33+
34+
fireEvent.focus(link);
35+
expect(link.className).toContain('focus');
36+
37+
fireEvent.blur(link);
38+
expect(link.className).toBe('skip_link');
39+
});
40+
});

client/components/SkipLink.jsx renamed to client/components/SkipLink.tsx

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
import React, { useState } from 'react';
22
import classNames from 'classnames';
3-
import PropTypes from 'prop-types';
43
import { useTranslation } from 'react-i18next';
54

6-
const SkipLink = ({ targetId, text }) => {
5+
type SkipLinkProps = {
6+
targetId: string,
7+
text: string
8+
};
9+
10+
const SkipLink = ({ targetId, text }: SkipLinkProps) => {
711
const [focus, setFocus] = useState(false);
812
const { t } = useTranslation();
913
const handleFocus = () => {
@@ -27,9 +31,4 @@ const SkipLink = ({ targetId, text }) => {
2731
);
2832
};
2933

30-
SkipLink.propTypes = {
31-
targetId: PropTypes.string.isRequired,
32-
text: PropTypes.string.isRequired
33-
};
34-
3534
export default SkipLink;

client/index.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,12 @@ script.src = 'https://foundation-donate-banner.netlify.app/static/js/main.js';
3535
document.body.appendChild(script);
3636

3737
const App = () => (
38-
<>
38+
<div>
3939
<Router history={browserHistory}>
4040
<SkipLink targetId="play-sketch" text="PlaySketch" />
4141
<Routing />
4242
</Router>
43-
</>
43+
</div>
4444
);
4545

4646
render(

0 commit comments

Comments
 (0)