chore: fix linting/formatting issues

This commit is contained in:
Stephan Meijer
2020-05-23 11:02:49 +02:00
parent 5f7197583a
commit 2ae5dc52db
5 changed files with 20 additions and 13 deletions

View File

@@ -1,13 +1,13 @@
import React from 'react'
import { Playground, PlaygroundProps } from 'docz'
import React from 'react';
import { Playground as DoczPlayground, PlaygroundProps } from 'docz';
import styles from './Playground.module.css';
export default (props: PlaygroundProps) => {
function Playground(props: PlaygroundProps) {
return (
<div className={styles.root}>
<Playground {...props} />
<DoczPlayground {...props} />
</div>
)
);
}
export default Playground;

View File

@@ -19,13 +19,20 @@ function Search(props: SearchProps): ReactElement {
const [results, setResults] = useState([]);
useEffect(() => {
provider.search({ query }).then((results: object[]) => setResults(results.slice(0, 5)));
provider
.search({ query })
.then((results: object[]) => setResults(results.slice(0, 5)));
}, [query]);
return (
<div className={styles.search}>
<form>
<input type="text" placeholder="search" value={query} onChange={(e) => setQuery(e.target.value)} />
<input
type="text"
placeholder="search"
value={query}
onChange={(e) => setQuery(e.target.value)}
/>
</form>
<div className={styles.result}>

View File

@@ -31,13 +31,13 @@
"build:css": "mkdir -p dist && cp ./assets/css/leaflet.css ./dist/geosearch.css",
"build:watch": "npm run build:dist -- --compress false --watch",
"test": "jest",
"lint": "tsc --noEmit && eslint 'src/**/*.{js,ts,tsx}' --quiet --fix && prettier '**/*.{md,mdx,json}' --write",
"lint": "tsc --noEmit && eslint '{docs,src,test}/**/*.{js,ts,tsx}' --quiet --fix && prettier '**/*.{md,mdx,json}' --write",
"docz:dev": "docz dev",
"docz:build": "docz build --base /leaflet-geosearch/",
"docz:serve": "docz build && docz serve",
"docs:update": "run-s clean build && npm run docz:build && git checkout gh-pages && find .docz/dist -name '*.js.map' -delete && cp -r .docz/dist/* . && git add . && git commit -m \"update docs\" && git checkout - && git push origin gh-pages",
"prepublish": "run-s test clean build",
"ci:lint": "eslint 'src/**/*.{js,ts,tsx}' -c ./.eslintrc.js",
"ci:lint": "eslint '{docs,src,test}/**/*.{js,ts,tsx}' -c ./.eslintrc.js",
"ci:tsc": "tsc --noEmit --project ./tsconfig.json",
"ci:test": "jest --ci"
},

View File

@@ -1,4 +1,4 @@
/* eslint-disable import/newline-after-import, no-undef */
/* eslint-disable no-undef, @typescript-eslint/no-var-requires */
const browserEnv = require('browser-env');
browserEnv();

View File

@@ -1,3 +1,3 @@
/* eslint-disable no-bitwise, prefer-template */
export default () => ('0000' + (Math.random() * Math.pow(36, 4) << 0)
.toString(36)).slice(-4);
export default () =>
('0000' + ((Math.random() * Math.pow(36, 4)) << 0).toString(36)).slice(-4);