Skip to content

Commit 00aec0e

Browse files
committed
feat(typescript): convert to typescript
update tests to tsx match types version with dep versions
1 parent 95702fd commit 00aec0e

File tree

10 files changed

+9376
-8101
lines changed

10 files changed

+9376
-8101
lines changed

.babelrc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"presets": [
3-
"amex"
3+
"amex",
4+
"@babel/preset-typescript"
45
]
56
}

.eslintrc.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
{
2-
"extends": "amex"
2+
"extends": "amex",
3+
"ignorePatterns": ["build/**/*"]
34
}

.github/workflows/release.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ jobs:
2626
node-version-file: ".nvmrc"
2727
- name: Install dependencies
2828
run: npm ci
29+
- name: Build
30+
run: npm run build
2931
- name: Release
3032
env:
3133
GIT_AUTHOR_EMAIL: ${{ secrets.GIT_AUTHOR_EMAIL }}

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
node_modules
22
test-results
3-
.jest-cache
3+
.jest-cache
4+
build
File renamed without changes.
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,15 @@ describe('createSharedContext', () => {
2020
it('should create context with React.createContext', () => {
2121
const createContextSpy = jest.spyOn(React, 'createContext');
2222
// eslint-disable-next-line unicorn/import-index, global-require
23-
const createSharedContext = require('../index.js');
23+
const createSharedContext = require('../src/index.ts');
2424
createSharedContext('myCoolDefaultValue', 'sharedContext');
2525

2626
expect(createContextSpy).toHaveBeenCalledWith('myCoolDefaultValue');
2727
});
2828

2929
it('should return the same context object if the key matches', () => {
3030
// eslint-disable-next-line unicorn/import-index, global-require
31-
const createSharedContext = require('../index.js');
31+
const createSharedContext = require('../src/index.ts');
3232
const testProvider = createSharedContext('', 'sharedContext');
3333
const { Provider } = testProvider;
3434
const testConsumer = createSharedContext('', 'sharedContext');
@@ -54,7 +54,7 @@ describe('createSharedContext', () => {
5454

5555
it('should not return the same context object if the key does not matches', () => {
5656
// eslint-disable-next-line unicorn/import-index, global-require
57-
const createSharedContext = require('../index.js');
57+
const createSharedContext = require('../src/index.ts');
5858
const defaultValue = 'default';
5959
const testProvider = createSharedContext('', 'sharedContext');
6060
const { Provider } = testProvider;
@@ -81,7 +81,7 @@ describe('createSharedContext', () => {
8181

8282
it('should use the same default value from first call', () => {
8383
// eslint-disable-next-line unicorn/import-index, global-require
84-
const createSharedContext = require('../index.js');
84+
const createSharedContext = require('../src/index.ts');
8585
const defaultValue = 'default';
8686
createSharedContext(defaultValue, 'someContext');
8787
const testDefaultContext = createSharedContext('never see this', 'someContext');
@@ -106,7 +106,7 @@ describe('createSharedContext', () => {
106106
const createContextSpy = jest.spyOn(React, 'createContext');
107107
const warnSpy = jest.spyOn(console, 'warn');
108108
// eslint-disable-next-line unicorn/import-index, global-require
109-
const createSharedContext = require('../index.js');
109+
const createSharedContext = require('../src/index.ts');
110110

111111
createSharedContext('default');
112112
expect(warnSpy).toHaveBeenCalledWith('Second parameter in createSharedReactContext was not set, defaulting to React.createContext');

0 commit comments

Comments
 (0)