mirror of
https://github.com/tachiyomiorg/tachiyomi-extensions-inspector.git
synced 2024-12-25 16:21:50 +01:00
a bit of eslint rules
This commit is contained in:
parent
c3a4f827cb
commit
59c69a4f7f
@ -1,22 +1,33 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
env: {
|
env: {
|
||||||
browser: true,
|
browser: true,
|
||||||
es2021: true,
|
es2021: true,
|
||||||
},
|
},
|
||||||
extends: [
|
extends: [
|
||||||
'plugin:react/recommended',
|
'plugin:react/recommended',
|
||||||
'airbnb',
|
'airbnb',
|
||||||
],
|
],
|
||||||
parserOptions: {
|
parserOptions: {
|
||||||
ecmaFeatures: {
|
ecmaFeatures: {
|
||||||
jsx: true,
|
jsx: true,
|
||||||
|
},
|
||||||
|
ecmaVersion: 12,
|
||||||
|
sourceType: 'module',
|
||||||
|
},
|
||||||
|
plugins: [
|
||||||
|
'react',
|
||||||
|
],
|
||||||
|
rules: {
|
||||||
|
// Indent with 4 spaces
|
||||||
|
indent: ['error', 4],
|
||||||
|
|
||||||
|
// Indent JSX with 4 spaces
|
||||||
|
'react/jsx-indent': ['error', 4],
|
||||||
|
|
||||||
|
// Indent props with 4 spaces
|
||||||
|
'react/jsx-indent-props': ['error', 4],
|
||||||
|
|
||||||
|
// allow JSX in both js and jsx files
|
||||||
|
'react/jsx-filename-extension': [1, { extensions: ['.js', '.jsx'] }],
|
||||||
},
|
},
|
||||||
ecmaVersion: 12,
|
|
||||||
sourceType: 'module',
|
|
||||||
},
|
|
||||||
plugins: [
|
|
||||||
'react',
|
|
||||||
],
|
|
||||||
rules: {
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
@ -1,31 +1,28 @@
|
|||||||
import React, {useState} from "react";
|
import React, { useState } from 'react';
|
||||||
import {
|
import {
|
||||||
BrowserRouter as Router,
|
BrowserRouter as Router,
|
||||||
Switch,
|
Switch,
|
||||||
Route,
|
Route,
|
||||||
Link
|
} from 'react-router-dom';
|
||||||
} from "react-router-dom";
|
|
||||||
import Button from '@material-ui/core/Button';
|
import Button from '@material-ui/core/Button';
|
||||||
import TemporaryDrawer from "./components/TemporaryDrawer";
|
import NavBar from './components/NavBar';
|
||||||
import NavBar from "./components/NavBar";
|
import ExtensionCard from './components/ExtensionCard';
|
||||||
import ExtensionCard from "./components/ExtensionCard";
|
|
||||||
|
|
||||||
|
|
||||||
export default function App() {
|
export default function App() {
|
||||||
return (
|
return (
|
||||||
<Router>
|
<Router>
|
||||||
{/*<TemporaryDrawer/>*/}
|
{/* <TemporaryDrawer/> */}
|
||||||
<NavBar/>
|
<NavBar />
|
||||||
|
|
||||||
<Switch>
|
<Switch>
|
||||||
<Route path="/extensions">
|
<Route path="/extensions">
|
||||||
<Extensions/>
|
<Extensions />
|
||||||
</Route>
|
</Route>
|
||||||
<Route path="/users">
|
<Route path="/users">
|
||||||
<Users/>
|
<Users />
|
||||||
</Route>
|
</Route>
|
||||||
<Route path="/">
|
<Route path="/">
|
||||||
<Home/>
|
<Home />
|
||||||
</Route>
|
</Route>
|
||||||
</Switch>
|
</Switch>
|
||||||
</Router>
|
</Router>
|
||||||
@ -34,15 +31,15 @@ export default function App() {
|
|||||||
|
|
||||||
function Extensions() {
|
function Extensions() {
|
||||||
let mapped;
|
let mapped;
|
||||||
let [extensions, setExtensions] = useState([])
|
const [extensions, setExtensions] = useState([]);
|
||||||
|
|
||||||
if (extensions.length === 0) {
|
if (extensions.length === 0) {
|
||||||
mapped = <h3>wait</h3>;
|
mapped = <h3>wait</h3>;
|
||||||
fetch("http://127.0.0.1:4567/api/v1/extensions")
|
fetch('http://127.0.0.1:4567/api/v1/extensions')
|
||||||
.then(response => response.json())
|
.then((response) => response.json())
|
||||||
.then(data => setExtensions(data));
|
.then((data) => setExtensions(data));
|
||||||
} else {
|
} else {
|
||||||
mapped = extensions.map(it => <ExtensionCard {...it} />);
|
mapped = extensions.map((it) => <ExtensionCard {...it} />);
|
||||||
}
|
}
|
||||||
|
|
||||||
return <h2>{mapped}</h2>;
|
return <h2>{mapped}</h2>;
|
||||||
@ -53,7 +50,7 @@ function Home() {
|
|||||||
<Button variant="contained" color="primary">
|
<Button variant="contained" color="primary">
|
||||||
Hello World
|
Hello World
|
||||||
</Button>
|
</Button>
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function Users() {
|
function Users() {
|
||||||
|
Loading…
Reference in New Issue
Block a user