Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(typescript): convert to typescript #51

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
{
"presets": [
"amex"
]
}
"presets": ["amex", "@babel/preset-typescript"]
}
55 changes: 53 additions & 2 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,54 @@
{
"extends": "amex"
}
"extends": ["amex", "plugin:@typescript-eslint/recommended", "prettier"],
"settings": { "import/resolver": { "typescript": {} } },
"parserOptions": {
"project": true,
"extraFileExtensions": [".json"]
},
"parser": "@typescript-eslint/parser",
"plugins": ["@typescript-eslint"],
"ignorePatterns": ["dist/**/*", "commitlint.config.js"],
"overrides": [
{
"files": ["__tests__/**"],
"extends": [
"amex/test",
"plugin:@typescript-eslint/recommended",
"prettier"
],
"rules": {
"import/extensions": [
"error",
"ignorePackages",
{
"ts": "never",
"tsx": "never",
"js": "never",
"jsx": "never"
}
]
}
},
{
zacowan marked this conversation as resolved.
Show resolved Hide resolved
"files": ["src/**"],
"extends": [
"amex",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/strict-type-checked",
"prettier"
],
"rules": {
"import/extensions": [
"error",
"ignorePackages",
{
"ts": "never",
"tsx": "never",
"js": "never",
"jsx": "never"
}
]
}
}
]
}
2 changes: 2 additions & 0 deletions .github/workflows/health-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ jobs:
run: npm ci
env:
NODE_ENV: development
- name: Build
run: npm run build
- name: Run Test Script
run: npm test
env:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ jobs:
node-version-file: ".nvmrc"
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build
xAndreiLi marked this conversation as resolved.
Show resolved Hide resolved
- name: Release
env:
GIT_AUTHOR_EMAIL: ${{ secrets.GIT_AUTHOR_EMAIL }}
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ jobs:
run: npm ci
env:
NODE_ENV: development
- name: Build
run: npm run build
- name: Unit Tests
run: npm run test:unit
env:
xAndreiLi marked this conversation as resolved.
Show resolved Hide resolved
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
node_modules
test-results
.jest-cache
coverage
dist
3 changes: 0 additions & 3 deletions __tests__/.eslintrc.json

This file was deleted.

31 changes: 0 additions & 31 deletions __tests__/__snapshots__/index.spec.jsx.snap

This file was deleted.

115 changes: 0 additions & 115 deletions __tests__/index.spec.jsx

This file was deleted.

6 changes: 6 additions & 0 deletions __tests__/setup.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { afterEach } from "vitest";
import { cleanup } from "@testing-library/react";

afterEach(() => {
cleanup();
});
40 changes: 40 additions & 0 deletions __tests__/unit/__snapshots__/index.spec.tsx.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html

exports[`createSharedReactContext > should not return the same context object if the key does not match 1`] = `
<body>
<div>
<div
data-testid="consumerDiv"
id="value"
>
default
</div>
</div>
</body>
`;

exports[`createSharedReactContext > should return the same context object if the key matches 1`] = `
<body>
<div>
<div
data-testid="consumerDiv"
id="value"
>
context value
</div>
</div>
</body>
`;

exports[`createSharedReactContext > should use the same default value from first call 1`] = `
<body>
<div>
<div
data-testid="consumerDiv"
id="value"
>
default
</div>
</div>
</body>
`;
Loading
Loading