Skip to content

Commit 5ffc34f

Browse files
committed
Format with ruff + prettier
1 parent 169e2dc commit 5ffc34f

File tree

3 files changed

+41
-45
lines changed

3 files changed

+41
-45
lines changed

src/js/rollup.config.js

+19-19
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,23 @@ import commonjs from "rollup-plugin-commonjs";
33
import replace from "rollup-plugin-replace";
44

55
export default {
6-
input: "src/index.js",
7-
output: {
8-
file: "../reactpy_router/static/bundle.js",
9-
format: "esm",
10-
},
11-
plugins: [
12-
resolve(),
13-
commonjs(),
14-
replace({
15-
"process.env.NODE_ENV": JSON.stringify("production"),
16-
}),
17-
],
18-
onwarn: function (warning) {
19-
if (warning.code === "THIS_IS_UNDEFINED") {
20-
// skip warning where `this` is undefined at the top level of a module
21-
return;
22-
}
23-
console.warn(warning.message);
24-
},
6+
input: "src/index.js",
7+
output: {
8+
file: "../reactpy_router/static/bundle.js",
9+
format: "esm",
10+
},
11+
plugins: [
12+
resolve(),
13+
commonjs(),
14+
replace({
15+
"process.env.NODE_ENV": JSON.stringify("production"),
16+
}),
17+
],
18+
onwarn: function (warning) {
19+
if (warning.code === "THIS_IS_UNDEFINED") {
20+
// skip warning where `this` is undefined at the top level of a module
21+
return;
22+
}
23+
console.warn(warning.message);
24+
},
2525
};

src/js/src/index.js

+20-20
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,27 @@ import React from "react";
22
import ReactDOM from "react-dom";
33

44
export function bind(node) {
5-
return {
6-
create: (type, props, children) =>
7-
React.createElement(type, props, ...children),
8-
render: (element) => {
9-
ReactDOM.render(element, node);
10-
},
11-
unmount: () => ReactDOM.unmountComponentAtNode(node),
12-
};
5+
return {
6+
create: (type, props, children) =>
7+
React.createElement(type, props, ...children),
8+
render: (element) => {
9+
ReactDOM.render(element, node);
10+
},
11+
unmount: () => ReactDOM.unmountComponentAtNode(node),
12+
};
1313
}
1414

1515
export function History({ onChange }) {
16-
// Capture changes to the browser's history
17-
React.useEffect(() => {
18-
const listener = () => {
19-
onChange({
20-
pathname: window.location.pathname,
21-
search: window.location.search,
22-
});
23-
};
24-
window.addEventListener("popstate", listener);
25-
return () => window.removeEventListener("popstate", listener);
26-
});
27-
return null;
16+
// Capture changes to the browser's history
17+
React.useEffect(() => {
18+
const listener = () => {
19+
onChange({
20+
pathname: window.location.pathname,
21+
search: window.location.search,
22+
});
23+
};
24+
window.addEventListener("popstate", listener);
25+
return () => window.removeEventListener("popstate", listener);
26+
});
27+
return null;
2828
}

src/reactpy_router/types.py

+2-6
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,13 @@ def __hash__(self) -> int:
3838
class Router(Protocol[R_contra]):
3939
"""Return a component that renders the first matching route"""
4040

41-
def __call__(
42-
self, *routes: R_contra, select: Literal["first", "all"] = "first"
43-
) -> ComponentType:
44-
...
41+
def __call__(self, *routes: R_contra, select: Literal["first", "all"] = "first") -> ComponentType: ...
4542

4643

4744
class RouteCompiler(Protocol[R_contra]):
4845
"""Compile a route into a resolver that can be matched against a path"""
4946

50-
def __call__(self, route: R_contra) -> RouteResolver:
51-
...
47+
def __call__(self, route: R_contra) -> RouteResolver: ...
5248

5349

5450
class RouteResolver(Protocol):

0 commit comments

Comments
 (0)