Skip to content

Commit

Permalink
chore: bump semver deps
Browse files Browse the repository at this point in the history
  • Loading branch information
tdreyno committed Nov 4, 2021
1 parent 69b0a06 commit d0f814a
Show file tree
Hide file tree
Showing 13 changed files with 516 additions and 625 deletions.
58 changes: 29 additions & 29 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ name: "CodeQL"

on:
push:
branches: [ main ]
branches: [main]
pull_request:
# The branches below must be a subset of the branches above
branches: [ main ]
branches: [main]
schedule:
- cron: '43 11 * * 4'
- cron: "43 11 * * 4"

jobs:
analyze:
Expand All @@ -32,40 +32,40 @@ jobs:
strategy:
fail-fast: false
matrix:
language: [ 'javascript' ]
language: ["javascript"]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
# Learn more:
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed

steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Checkout repository
uses: actions/checkout@v2

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release
#- run: |
# make bootstrap
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
6 changes: 2 additions & 4 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,12 @@
"type": "node",
"name": "vscode-jest-tests",
"request": "launch",
"args": [
"--runInBand"
],
"args": ["--runInBand"],
"cwd": "${workspaceFolder}",
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen",
"disableOptimisticBPs": true,
"program": "${workspaceFolder}/node_modules/jest/bin/jest"
}
]
}
}
2 changes: 1 addition & 1 deletion commitlint.config.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
module.exports = { extends: ["@commitlint/config-conventional"] };
module.exports = { extends: ["@commitlint/config-conventional"] }
20 changes: 10 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,16 @@
]
},
"devDependencies": {
"@commitlint/cli": "^13.2.0",
"@commitlint/cli": "^14.1.0",
"@commitlint/config-conventional": "^14.1.0",
"@commitlint/prompt": "^13.1.0",
"@commitlint/prompt": "^14.1.0",
"@pika/pack": "^0.5.0",
"@pika/plugin-build-node": "^0.9.2",
"@pika/plugin-build-web": "^0.9.2",
"@pika/plugin-ts-standard-pkg": "^0.9.2",
"@semantic-release/changelog": "^5.0.1",
"@semantic-release/git": "^9.0.1",
"@semantic-release/github": "^7.2.3",
"@semantic-release/changelog": "^6.0.1",
"@semantic-release/git": "^10.0.1",
"@semantic-release/github": "^8.0.2",
"@testing-library/jest-dom": "^5.15.0",
"@testing-library/react": "^12.1.2",
"@types/jest": "^27.0.2",
Expand All @@ -57,13 +57,13 @@
"@types/node": "^16.11.6",
"@types/react": "^17.0.33",
"@types/serialize-javascript": "^5.0.1",
"@typescript-eslint/eslint-plugin": "^4.26.0",
"@typescript-eslint/parser": "^4.33.0",
"@typescript-eslint/eslint-plugin": "^5.3.0",
"@typescript-eslint/parser": "^5.3.0",
"commitizen": "^4.2.3",
"cz-conventional-changelog": "3.3.0",
"eslint": "^7.32.0",
"eslint": "^8.1.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-prettier": "^3.4.0",
"eslint-plugin-prettier": "^4.0.0",
"gzip-size-cli": "^5.0.0",
"husky": "^7.0.0",
"jest": "^27.3.1",
Expand All @@ -72,7 +72,7 @@
"prettier": "^2.2.1",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"semantic-release": "^17.4.2",
"semantic-release": "^18.0.0",
"serialize-javascript": "^6.0.0",
"terser": "^5.7.0",
"ts-jest": "^27.0.7",
Expand Down
6 changes: 2 additions & 4 deletions src/__tests__/core.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -316,10 +316,8 @@ describe("Fizz core", () => {
)

return createInitialContext(
unboundHistory.map(({ data, name }) =>
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
(STATES as any)[name](data),
),
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-return
unboundHistory.map(({ data, name }) => (STATES as any)[name](data)),
)
}

Expand Down
6 changes: 4 additions & 2 deletions src/action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ export const Action = <T extends string, P>(type: T, payload: P) =>
new Action_(type, payload)
export type Action<T extends string, P> = Action_<T, P>

export type ActionName<A extends Action<any, any>, T = A["type"]> =
T extends string ? T : never
export type ActionName<
A extends Action<any, any>,
T = A["type"],
> = T extends string ? T : never

export type ActionPayload<A extends Action<any, any>> = A["payload"]

Expand Down
2 changes: 2 additions & 0 deletions src/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,11 +164,13 @@ const processIndividualStateReturn = (

// If we get a promise, convert it to a Task
if (item instanceof Promise) {
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
return executeResultfromTask(Task.fromPromise(item))
}

// If we get a task, hold on to it.
if (item instanceof Task) {
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
return executeResultfromTask(item)
}

Expand Down
7 changes: 2 additions & 5 deletions src/effect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,7 @@ const RESERVED_EFFECTS = [
"unsubscribe",
]

export const __internalEffect = <
D extends any,
F extends (context: Context) => void,
>(
export const __internalEffect = <D, F extends (context: Context) => void>(
label: string,
data: D,
executor: F,
Expand All @@ -45,7 +42,7 @@ export const __internalEffect = <
isEffect: true,
})

export const effect = <D extends any, F extends (context: Context) => void>(
export const effect = <D, F extends (context: Context) => void>(
label: string,
data: D,
executor?: F,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { ActionCreatorType, createAction } from "../../../../../action"

export const finishedLoading =
createAction<"FinishedLoading", string>("FinishedLoading")
export const finishedLoading = createAction<"FinishedLoading", string>(
"FinishedLoading",
)
export type FinishedLoading = ActionCreatorType<typeof finishedLoading>
1 change: 1 addition & 0 deletions src/react/createFizzContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ export function createFizzContext<
createInitialContext([initialState], { maxHistory, disableLogging }),
Object.keys(actions),
fallback,
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
parentRuntime,
),
[initialState],
Expand Down
3 changes: 3 additions & 0 deletions src/runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ export const createRuntime = (
}

case "unsubscribe": {
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
const unsub = subscriptions_.get(effect.data)

if (unsub) {
Expand Down Expand Up @@ -229,6 +230,7 @@ export const createRuntime = (
pendingActions_.push([action, task])

if (immediateId_) {
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
clearTimeout(immediateId_ as any)
}

Expand All @@ -245,6 +247,7 @@ export const createRuntime = (
Object.keys(actions).reduce((sum, key) => {
sum[key] = (...args: Array<any>) => {
try {
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
return run(actions[key](...args))
} catch (e) {
if (e instanceof NoStatesRespondToAction) {
Expand Down
21 changes: 9 additions & 12 deletions src/state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export type StateReturn =
export interface StateTransition<
Name extends string,
A extends Action<any, any>,
Data extends any,
Data,
> {
name: Name
data: Data
Expand Down Expand Up @@ -57,11 +57,7 @@ export const isStateTransition = (
* the action to run and an arbitrary number of serializable
* arguments.
*/
export type State<
Name extends string,
A extends Action<any, any>,
Data extends any,
> = (
export type State<Name extends string, A extends Action<any, any>, Data> = (
action: A,
data: Data,
utils: {
Expand All @@ -73,7 +69,7 @@ export type State<
export interface BoundStateFn<
Name extends string,
A extends Action<any, any>,
Data extends any = undefined,
Data = undefined,
> {
(...data: Data extends undefined ? [] : [Data]): StateTransition<
Name,
Expand Down Expand Up @@ -103,10 +99,12 @@ const cloneDeep = (value: any): any => {
}

if (value instanceof Set) {
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
return new Set(cloneDeep(Array.from(value)))
}

if (value instanceof Map) {
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
return new Map(cloneDeep(Array.from(value)))
}

Expand All @@ -117,7 +115,7 @@ const cloneDeep = (value: any): any => {
export const stateWrapper = <
Name extends string,
A extends Action<any, any>,
Data extends any = undefined,
Data = undefined,
>(
name: Name,
executor: State<Name, A, Data>,
Expand Down Expand Up @@ -208,15 +206,13 @@ const matchAction =
return fallback ? fallback(data, utils) : undefined
}

// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
return handler(data, action.payload, utils)
}

let counter = 1

export const state = <
Actions extends Action<string, any>,
Data extends any = undefined,
>(
export const state = <Actions extends Action<string, any>, Data = undefined>(
handlers: {
[A in Actions as ActionName<A>]: (
data: Data,
Expand Down Expand Up @@ -262,6 +258,7 @@ class Matcher<S extends StateTransition<string, any, any>, T> {
}

run(): T | undefined {
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
const handler = this.handlers.get(this.state.state)

if (!handler) {
Expand Down
Loading

0 comments on commit d0f814a

Please sign in to comment.