Skip to content

Commit 36a3085

Browse files
committed
fix: lint issues
1 parent d193614 commit 36a3085

7 files changed

+28
-14
lines changed

.eslintignore

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# from .gitignore
2+
node_modules/
3+
coverage/
4+
dist/
5+
.idea
6+
.cache
7+
*.tgz
8+
.DS_Store
9+
esm
10+
esnext
11+
12+
# custom ignore pattern
13+
*.html

.eslintrc.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"@typescript-eslint/explicit-member-accessibility": ["error", { "accessibility": "no-public" }],
1616
"@typescript-eslint/explicit-function-return-type": "off",
1717
"@typescript-eslint/no-parameter-properties": "off",
18-
"@typescript-eslint/no-use-before-define": ["error", { "functions": false }],
18+
"@typescript-eslint/no-use-before-define": ["error", { "functions": false, "classes": false }],
1919
"@typescript-eslint/no-explicit-any": "off",
2020
"@typescript-eslint/no-var-requires": "off"
2121
},

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"build:esm": "shx rm -rf ./esm && tsc -p ./tsconfig.build.json -m esnext --outDir esm",
2424
"build:next": "shx rm -rf ./esnext && tsc -p ./tsconfig.build.json --target esnext --outDir esnext",
2525
"prettier": "prettier '@(src|demo)/**/*.@(ts|tsx|html|less)' --write",
26-
"lint": "eslint src/**/* test/**/* demo/**/* --ext .ts,.tsx --ignore-pattern *.html --fix --max-warnings 0",
26+
"lint": "eslint . --ext .ts,.tsx --fix --max-warnings 0",
2727
"test": "jest --collectCoverage"
2828
},
2929
"husky": {

src/connect.tsx

+8-7
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,12 @@ export function connectAyanami<M extends Ayanami<S>, S, P>(
2828
return ((
2929
mapStateToProps?: (props: S) => Partial<P>,
3030
mapActionsToProps?: (actions: ActionMethodOfAyanami<M, S>) => Partial<P>,
31-
) => (props: P) => {
32-
const [state, action] = (ayanami as ConstructorOfAyanami<M>).useHooks<M, S>()
33-
const mappedState = mapStateToProps ? mapStateToProps(state) : state
34-
const mappedAction = mapActionsToProps ? mapActionsToProps(action as any) : action
35-
36-
return <Component {...mappedState} {...mappedAction} {...props} />
37-
}) as ComponentConnectedWithAyanami<M, S, P>
31+
) =>
32+
function ConnectAyanami(props: P) {
33+
const [state, action] = (ayanami as ConstructorOfAyanami<M>).useHooks<M, S>()
34+
const mappedState = mapStateToProps ? mapStateToProps(state) : state
35+
const mappedAction = mapActionsToProps ? mapActionsToProps(action as any) : action
36+
37+
return <Component {...mappedState} {...mappedAction} {...props} />
38+
}) as ComponentConnectedWithAyanami<M, S, P>
3839
}

src/redux-devtools-extension.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { noop } from 'lodash'
12
import { Ayanami } from './ayanami'
23

34
interface DevTools {
@@ -10,15 +11,14 @@ interface GlobalState {
1011
}
1112

1213
const FakeReduxDevTools = {
14+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
1315
connect: (_config: object) => ({ send: noop, init: noop }),
1416
}
1517

1618
const ReduxDevTools =
1719
(typeof window !== 'undefined' && (window as any).__REDUX_DEVTOOLS_EXTENSION__) ||
1820
FakeReduxDevTools
1921

20-
const noop = () => {}
21-
2222
const STATE: GlobalState = {}
2323

2424
export function getAyanamiName(ayanami: Ayanami<any>): string {

src/symbols.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
export interface ActionSymbols {
2-
decorator: Symbol
3-
actions: Symbol
2+
decorator: symbol
3+
actions: symbol
44
}
55

66
export const effectSymbols: ActionSymbols = {

src/types.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ type IsAny<T> = IfAny<T, true, false>
1616
type IsVoid<T> = IsAny<T> extends true ? false : [T] extends [void] ? true : false
1717

1818
// using class type to avoid conflict with user defined params
19-
class ArgumentsType<_Arguments extends Array<any>> {}
19+
class ArgumentsType<_Arguments extends any[]> {}
2020

2121
export type ActionMethod<
2222
T extends ArgumentsType<any[]> | never,

0 commit comments

Comments
 (0)