Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Update prettier, eslint, rollup, scripts #5490

Merged
merged 14 commits into from
May 29, 2023
7 changes: 6 additions & 1 deletion .codesandbox/ci.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
{
"installCommand": "install:csb",
"sandboxes": ["/examples/react/basic-typescript", "/examples/solid/basic-typescript", "/examples/svelte/basic", "/examples/vue/basic"],
"sandboxes": [
"/examples/react/basic-typescript",
"/examples/solid/basic-typescript",
"/examples/svelte/basic",
"/examples/vue/basic"
],
"packages": ["packages/**"],
"node": "16"
}
11 changes: 8 additions & 3 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// @ts-check

/** @type {import('eslint').Linter.Config} */
module.exports = {
const config = {
root: true,
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint', 'import'],
Expand Down Expand Up @@ -36,7 +36,8 @@ module.exports = {
'@typescript-eslint/ban-types': 'off',
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/consistent-type-imports': [
'error', { prefer: 'type-imports' }
'error',
{ prefer: 'type-imports' },
],
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-empty-interface': 'off',
Expand All @@ -45,10 +46,12 @@ module.exports = {
'@typescript-eslint/no-unnecessary-condition': 'error',
'@typescript-eslint/no-unnecessary-type-assertion': 'error',
'@typescript-eslint/no-inferrable-types': [
'error', { ignoreParameters: true },
'error',
{ ignoreParameters: true },
],
'import/default': 'off',
'import/export': 'off',
'import/newline-after-import': 'error',
'import/no-cycle': 'error',
'import/no-duplicates': 'off',
'import/no-unresolved': ['error', { ignore: ['^@tanstack/'] }],
Expand All @@ -65,3 +68,5 @@ module.exports = {
},
],
}

module.exports = config
6 changes: 4 additions & 2 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/packages/svelte-query/.svelte-kit
/packages/react-query/build
**/.next
**/.svelte-kit
**/build
**/dist
/packages/codemods/**/__testfixtures__
3 changes: 3 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,17 @@ If you have been assigned to fix an issue or develop a new feature, please follo
- Submit PR for review.

### Running examples

- Make sure you've installed the dependencies by running `$ pnpm install` in the repo's root directory.
- If you want to run the example against your local changes, run `pnpm run watch` in the repo's root directory. Otherwise, it will be run against the latest TanStack Query release.
- Run `pnpm run dev` in the selected examples' directory.

#### Note on `examples/react-native`

React Native example requires Expo to work. Please follow the instructions from example's README.md file to learn more.

#### Note on standalone execution

If you want to run an example without installing dependencies for the whole repo, just follow instructions from the example's README.md file. It will be then run against the latest TanStack Query release.

## Online one-click setup
Expand Down
10 changes: 2 additions & 8 deletions examples/react/algolia/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
{
"compilerOptions": {
"target": "ES2020",
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"esModuleInterop": true,
Expand All @@ -20,7 +16,5 @@
"noEmit": true,
"jsx": "react-jsx"
},
"include": [
"src"
]
"include": ["src"]
}
2 changes: 1 addition & 1 deletion examples/react/auto-refetching/pages/api/data.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export default async (req, res) => {
list = []
}

await new Promise(r => setTimeout(r, 100))
await new Promise((r) => setTimeout(r, 100))

res.json(list)
}
10 changes: 2 additions & 8 deletions examples/react/basic-typescript/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
{
"compilerOptions": {
"target": "ES2020",
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"esModuleInterop": true,
Expand All @@ -20,7 +16,5 @@
"noEmit": true,
"jsx": "react-jsx"
},
"include": [
"src"
]
"include": ["src"]
}
8 changes: 4 additions & 4 deletions examples/react/basic-typescript/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";

// https://vitejs.dev/config/
export default defineConfig({
plugins: [react()]
})
plugins: [react()],
});
2 changes: 1 addition & 1 deletion examples/react/load-more-infinite-scroll/pages/about.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ export default () => {
return (
<a
href=""
onClick={e => {
onClick={(e) => {
window.history.back()
e.preventDefault()
}}
Expand Down
4 changes: 1 addition & 3 deletions examples/react/load-more-infinite-scroll/pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,7 @@ function Example() {
</>
)}
<hr />
<Link href="/about">
Go to another page
</Link>
<Link href="/about">Go to another page</Link>
<ReactQueryDevtools initialIsOpen />
</div>
)
Expand Down
5 changes: 4 additions & 1 deletion examples/react/nextjs/components/Header/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ export const Header = () => {
<Link href="/" className={pathname === '/' ? 'is-active' : ''}>
Home
</Link>
<Link href="/client-only" className={pathname === '/client-only' ? 'is-active' : ''}>
<Link
href="/client-only"
className={pathname === '/client-only' ? 'is-active' : ''}
>
Client-Only
</Link>
<style jsx>{`
Expand Down
Loading