From 2ae5dc52dbea7ed70cacb001af550074ff594420 Mon Sep 17 00:00:00 2001 From: Stephan Meijer Date: Sat, 23 May 2020 11:02:49 +0200 Subject: [PATCH] chore: fix linting/formatting issues --- docs/components/Playground.tsx | 12 ++++++------ docs/components/Search.tsx | 11 +++++++++-- package.json | 4 ++-- test/browserEnv.js | 2 +- test/randomId.js | 4 ++-- 5 files changed, 20 insertions(+), 13 deletions(-) diff --git a/docs/components/Playground.tsx b/docs/components/Playground.tsx index aad6c341..792cc607 100644 --- a/docs/components/Playground.tsx +++ b/docs/components/Playground.tsx @@ -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 (
- +
- ) + ); } +export default Playground; diff --git a/docs/components/Search.tsx b/docs/components/Search.tsx index 5e152013..c5a13d15 100644 --- a/docs/components/Search.tsx +++ b/docs/components/Search.tsx @@ -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 (
- setQuery(e.target.value)} /> + setQuery(e.target.value)} + />
diff --git a/package.json b/package.json index aeae4310..5a89670a 100644 --- a/package.json +++ b/package.json @@ -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" }, diff --git a/test/browserEnv.js b/test/browserEnv.js index 1fb5253c..103d5bf3 100644 --- a/test/browserEnv.js +++ b/test/browserEnv.js @@ -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(); diff --git a/test/randomId.js b/test/randomId.js index 36d475ed..e8570ace 100644 --- a/test/randomId.js +++ b/test/randomId.js @@ -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);