Skip to content
This repository was archived by the owner on Sep 20, 2023. It is now read-only.

Commit 3da5411

Browse files
authored
Merge pull request #13 from rpearce/build-update
build overhaul
2 parents 4510664 + bab6215 commit 3da5411

File tree

19 files changed

+21919
-15276
lines changed

19 files changed

+21919
-15276
lines changed

.eslintignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
coverage/
22
docs/
3-
node_modules/
4-
src/
3+
dist/

.eslintrc

Lines changed: 0 additions & 64 deletions
This file was deleted.

.eslintrc.js

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
module.exports = {
2+
env: {
3+
browser: true,
4+
es6: true,
5+
jest: true,
6+
node: true
7+
},
8+
extends: [
9+
'eslint:recommended',
10+
'plugin:jsx-a11y/recommended',
11+
'plugin:prettier/recommended',
12+
'plugin:react/recommended'
13+
],
14+
parserOptions: {
15+
ecmaVersion: 2019,
16+
sourceType: 'module'
17+
},
18+
plugins: [
19+
'jsx-a11y',
20+
'react',
21+
'react-hooks'
22+
],
23+
rules: {
24+
'indent': ['error', 2, { 'SwitchCase': 1 }],
25+
'jsx-quotes': ['error', 'prefer-double'],
26+
'jsx-a11y/no-onchange': 0,
27+
'no-trailing-spaces': 'error',
28+
'object-curly-spacing': ['error', 'always'],
29+
'quotes': ['error', 'single', { 'allowTemplateLiterals': true }],
30+
'react-hooks/exhaustive-deps': 'warn',
31+
'react-hooks/rules-of-hooks': 'error',
32+
'semi': ['error', 'never']
33+
},
34+
settings: {
35+
react: {
36+
version: '16'
37+
}
38+
}
39+
}

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,5 +60,5 @@ typings/
6060
# next.js build output
6161
.next
6262

63-
src/
63+
dist/
6464
*.tmp

.prettierrc.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module.exports = {
2+
semi: false,
3+
singleQuote: true
4+
}

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
language: node_js
22
node_js:
3-
- "11"
3+
- "12"
44
cache: yarn
55
after_success:
66
- npm run coverage

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# react-button-a11y
22
[![All Contributors](https://img.shields.io/badge/all_contributors-1-orange.svg?style=flat-square)](#contributors)
3-
[![npm version](https://img.shields.io/npm/v/react-button-a11y.svg)](https://www.npmjs.com/package/react-button-a11y) [![npm downloads](https://img.shields.io/npm/dt/react-button-a11y.svg)](https://www.npmjs.com/package/react-button-a11y) [![Build Status](https://travis-ci.org/rpearce/react-button-a11y.svg?branch=master)](https://travis-ci.org/rpearce/react-button-a11y) [![Coverage Status](https://coveralls.io/repos/github/rpearce/react-button-a11y/badge.svg?branch=master)](https://coveralls.io/github/rpearce/react-button-a11y?branch=master) [![Maintainability](https://api.codeclimate.com/v1/badges/8e4debef4b9f0e8acd6e/maintainability)](https://codeclimate.com/github/rpearce/react-button-a11y/maintainability)
3+
[![npm version](https://img.shields.io/npm/v/react-button-a11y.svg)](https://www.npmjs.com/package/react-button-a11y) [![npm downloads](https://img.shields.io/npm/dm/react-button-a11y.svg)](https://www.npmjs.com/package/react-button-a11y) [![Build Status](https://travis-ci.org/rpearce/react-button-a11y.svg?branch=master)](https://travis-ci.org/rpearce/react-button-a11y) [![Coverage Status](https://coveralls.io/repos/github/rpearce/react-button-a11y/badge.svg?branch=master)](https://coveralls.io/github/rpearce/react-button-a11y?branch=master) [![Maintainability](https://api.codeclimate.com/v1/badges/8e4debef4b9f0e8acd6e/maintainability)](https://codeclimate.com/github/rpearce/react-button-a11y/maintainability)
44

55
Make non-button elements accessible in React. This component applies the
66
following to an element that wants to be a "button":

__tests__/index.js

Lines changed: 9 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React, { createRef } from 'react'
2-
import { fireEvent, render } from 'react-testing-library'
3-
import 'jest-dom/extend-expect'
2+
import { fireEvent, render } from '@testing-library/react'
3+
import '@testing-library/jest-dom/extend-expect'
44

55
import ButtonA11y from '../source'
66

@@ -25,10 +25,7 @@ test('renders with aria-label, handles click', () => {
2525
test('renders with children, handles click', () => {
2626
const onClick = jest.fn()
2727
const { getByText } = render(
28-
<ButtonA11y
29-
className="mock-className"
30-
onClick={onClick}
31-
>
28+
<ButtonA11y className="mock-className" onClick={onClick}>
3229
Click Me
3330
</ButtonA11y>
3431
)
@@ -44,10 +41,7 @@ test('renders with children, handles click', () => {
4441
test('renders with button role and tabIndex 0', () => {
4542
const onClick = jest.fn()
4643
const { getByText } = render(
47-
<ButtonA11y
48-
className="mock-className"
49-
onClick={onClick}
50-
>
44+
<ButtonA11y className="mock-className" onClick={onClick}>
5145
Click Me
5246
</ButtonA11y>
5347
)
@@ -226,11 +220,7 @@ test('only calls onKeyDown when random keyCode', () => {
226220
test('does not break when onKeyDown not passed', () => {
227221
const onClick = jest.fn()
228222
const { getByText } = render(
229-
<ButtonA11y
230-
className="mock-className"
231-
onClick={onClick}
232-
type=""
233-
>
223+
<ButtonA11y className="mock-className" onClick={onClick} type="">
234224
Click Me
235225
</ButtonA11y>
236226
)
@@ -246,11 +236,7 @@ test('does not break when onKeyDown not passed', () => {
246236
test('does not break when onClick not passed', () => {
247237
const onKeyDown = jest.fn()
248238
const { getByText } = render(
249-
<ButtonA11y
250-
className="mock-className"
251-
onKeyDown={onKeyDown}
252-
type=""
253-
>
239+
<ButtonA11y className="mock-className" onKeyDown={onKeyDown} type="">
254240
Click Me
255241
</ButtonA11y>
256242
)
@@ -265,11 +251,7 @@ test('does not break when onClick not passed', () => {
265251

266252
test('renders as div element', () => {
267253
const { container, getByText } = render(
268-
<ButtonA11y
269-
className="mock-className"
270-
element="div"
271-
onClick={jest.fn()}
272-
>
254+
<ButtonA11y className="mock-className" element="div" onClick={jest.fn()}>
273255
Click Me
274256
</ButtonA11y>
275257
)
@@ -281,11 +263,7 @@ test('renders as div element', () => {
281263
test('forwards a ref', () => {
282264
const ref = createRef()
283265
render(
284-
<ButtonA11y
285-
className="mock-className"
286-
onClick={jest.fn()}
287-
ref={ref}
288-
>
266+
<ButtonA11y className="mock-className" onClick={jest.fn()} ref={ref}>
289267
Click Me
290268
</ButtonA11y>
291269
)
@@ -302,9 +280,7 @@ test('errors when no children & no aria-label', () => {
302280
onClick={jest.fn()}
303281
/>
304282
)
305-
}).toThrow(
306-
'react-button-a11y: `aria-label` required for accessibility'
307-
)
283+
}).toThrow('react-button-a11y: `aria-label` required for accessibility')
308284
})
309285

310286
// This is allowed but is unwise for accessibility

babel.config.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
const presets = [
2-
'@babel/preset-env',
3-
'@babel/preset-react'
4-
]
1+
const presets = ['@babel/preset-env', '@babel/preset-react']
52

63
module.exports = {
74
presets

0 commit comments

Comments
 (0)