style(examples): run prettier on the examples (#1092)

* chore: add dir "example" and file types "js,jsx" to prettier script

* chore: create .prettierignore and add "/examples/build"

* chore: remove deprecated prettier config

* style: run yarn prettier

* chore: make prettier run only for `example/src`

* chore: add `"bracketSameLine": true` to prettier config

* style: run yarn prettier

* Update examples/config-overrides.js

Co-authored-by: Daishi Kato <dai-shi@users.noreply.github.com>
This commit is contained in:
Mike 2022-07-17 12:50:25 +08:00 committed by GitHub
parent 37112e585c
commit c16c8d108f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 7 additions and 9 deletions

View File

@ -39,7 +39,7 @@
"semi": false,
"trailingComma": "es5",
"singleQuote": true,
"jsxBracketSameLine": true,
"bracketSameLine": true,
"tabWidth": 2,
"printWidth": 120
},

View File

@ -10,8 +10,7 @@ export default function Backdrop() {
className="canvas-container"
orthographic
gl={{ powerPreference: 'high-performance', antialias: false, stencil: false, alpha: false, depth: false }}
camera={{ zoom: 5, position: [0, 0, 200], far: 300, near: 0 }}
>
camera={{ zoom: 5, position: [0, 0, 200], far: 300, near: 0 }}>
<Suspense fallback={null}>
<Scene dof={dof} />
</Suspense>

View File

@ -9,7 +9,7 @@ export default function CopyButton({ code, ...props }) {
const [isCopied, setIsCopied] = useState(false)
const timer = useRef()
const handleCopy = useCallback(() => {
const handleCopy = useCallback(() => {
clearTimeout(timer.current)
copyToClipboard(code).then(() => {
setIsCopied(true)
@ -34,8 +34,7 @@ export default function CopyButton({ code, ...props }) {
strokeWidth={2}
strokeLinecap="round"
strokeLinejoin="round"
{...props}
>
{...props}>
<rect x={9} y={9} width={13} height={13} rx={2} ry={2} />
<path d="M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1" />
</svg>

View File

@ -1,3 +1,3 @@
export const copyToClipboard = (str) => {
return navigator.clipboard.writeText(str)
}
}

View File

@ -68,8 +68,8 @@
"build:shallow": "rollup -c --config-shallow",
"build:context": "rollup -c --config-context",
"postbuild": "yarn copy",
"prettier": "prettier '*.{js,json,md}' '{src,tests,docs}/**/*.{ts,tsx,md,mdx}' --write",
"prettier:ci": "prettier '*.{js,json,md}' '{src,tests,docs}/**/*.{ts,tsx,md,mdx}' --list-different",
"prettier": "prettier '*.{js,json,md}' '{examples/src,src,tests,docs}/**/*.{js,jsx,ts,tsx,md,mdx}' --write",
"prettier:ci": "prettier '*.{js,json,md}' '{examples/src,src,tests,docs}/**/*.{js,jsx,ts,tsx,md,mdx}' --list-different",
"eslint": "eslint --fix '*.{js,json}' '{src,tests}/**/*.{ts,tsx}'",
"eslint:ci": "eslint '*.{js,json}' '{src,tests}/**/*.{ts,tsx}'",
"pretest": "tsc --noEmit",