Server: Phase 2 (REVIEW not respected yet)
This commit is contained in:
1 parent
5d16ded553
commit
142b47674d
4271 files changed
+1203269
No files matched your search
+25
@@ -0,0 +1,25 @@
|
||||
// @ts-check
|
||||
|
||||
import rootConfig from './root.eslint.config.js'
|
||||
|
||||
export default [
|
||||
...rootConfig,
|
||||
{
|
||||
rules: {
|
||||
'cspell/spellchecker': 'off',
|
||||
'@typescript-eslint/no-unnecessary-condition': 'off',
|
||||
'import/no-duplicates': 'off',
|
||||
'import/no-unresolved': 'off',
|
||||
'import/order': 'off',
|
||||
'no-shadow': 'off',
|
||||
'sort-imports': 'off',
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ['src/**/__testfixtures__/**'],
|
||||
rules: {
|
||||
// Codemod fixtures intentionally preserve historical QueryClient syntax.
|
||||
'no-restricted-syntax': 'off',
|
||||
},
|
||||
},
|
||||
]
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
{
|
||||
"name": "@tanstack/query-codemods",
|
||||
"private": true,
|
||||
"description": "Collection of codemods to make the migration easier.",
|
||||
"author": "Balázs Máté Petró",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/TanStack/query.git",
|
||||
"directory": "packages/query-codemods"
|
||||
},
|
||||
"homepage": "https://tanstack.com/query",
|
||||
"funding": {
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/tannerlinsley"
|
||||
},
|
||||
"scripts": {
|
||||
"clean": "premove ./coverage ./dist-ts",
|
||||
"test:eslint": "eslint --concurrency=auto ./src",
|
||||
"test:lib": "vitest",
|
||||
"test:lib:dev": "pnpm run test:lib --watch"
|
||||
},
|
||||
"type": "module",
|
||||
"exports": {
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"sideEffects": false,
|
||||
"files": [
|
||||
"src",
|
||||
"!src/jest.config.js",
|
||||
"!src/**/__testfixtures__",
|
||||
"!src/**/__tests__"
|
||||
],
|
||||
"devDependencies": {
|
||||
"@types/jscodeshift": "17.3.0",
|
||||
"jscodeshift": "17.3.0"
|
||||
}
|
||||
}
|
||||
Generated
Vendored
+113
@@ -0,0 +1,113 @@
|
||||
// @ts-check
|
||||
|
||||
// @ts-ignore Needed due to moduleResolution Node vs Bundler
|
||||
import { tanstackConfig } from '@tanstack/eslint-config'
|
||||
import pluginCspell from '@cspell/eslint-plugin'
|
||||
import vitest from '@vitest/eslint-plugin'
|
||||
|
||||
export default [
|
||||
...tanstackConfig,
|
||||
{
|
||||
name: 'tanstack/temp',
|
||||
plugins: {
|
||||
cspell: pluginCspell,
|
||||
},
|
||||
rules: {
|
||||
'cspell/spellchecker': [
|
||||
'warn',
|
||||
{
|
||||
cspell: {
|
||||
words: [
|
||||
'Promisable', // Our public interface
|
||||
'TSES', // @typescript-eslint package's interface
|
||||
'codemod', // We support our codemod
|
||||
'combinate', // Library name
|
||||
'datatag', // Query options tagging
|
||||
'extralight', // Our public interface
|
||||
'jscodeshift',
|
||||
'refetches', // Query refetch operations
|
||||
'retryer', // Our public interface
|
||||
'solidjs', // Our target framework
|
||||
'tabular-nums', // https://developer.mozilla.org/en-US/docs/Web/CSS/font-variant-numeric
|
||||
'tanstack', // Our package scope
|
||||
'todos', // Too general word to be caught as error
|
||||
'tsqd', // Our public interface (TanStack Query Devtools shorthand)
|
||||
'tsdown', // We use tsdown as builder
|
||||
'typecheck', // Field of vite.config.ts
|
||||
'vue-demi', // dependency of @tanstack/vue-query
|
||||
'ɵkind', // Angular specific
|
||||
'ɵproviders', // Angular specific
|
||||
],
|
||||
},
|
||||
},
|
||||
],
|
||||
'@typescript-eslint/no-empty-function': 'off',
|
||||
'@typescript-eslint/no-unsafe-function-type': 'off',
|
||||
'no-case-declarations': 'off',
|
||||
/**
|
||||
* Disallows direct calls to deprecated imperative query methods of `QueryClient`
|
||||
* for new tests and code
|
||||
*
|
||||
* Existing tests that directly test the methods from before the refactoring
|
||||
* will be grandfathered in and allowed to continue using the deprecated methods.
|
||||
* They should not be removed, but new tests should use the new methods instead.
|
||||
*/
|
||||
'no-restricted-syntax': [
|
||||
'error',
|
||||
{
|
||||
selector:
|
||||
'CallExpression[callee.type="MemberExpression"]:matches([callee.property.name="fetchQuery"], [callee.computed=true][callee.property.value="fetchQuery"])',
|
||||
message: 'Use queryClient.query(options) instead.',
|
||||
},
|
||||
{
|
||||
selector:
|
||||
'CallExpression[callee.type="MemberExpression"]:matches([callee.property.name="prefetchQuery"], [callee.computed=true][callee.property.value="prefetchQuery"])',
|
||||
message:
|
||||
'Use queryClient.query(options).catch(noop) instead if errors should be swallowed.',
|
||||
},
|
||||
{
|
||||
selector:
|
||||
'CallExpression[callee.type="MemberExpression"]:matches([callee.property.name="ensureQueryData"], [callee.computed=true][callee.property.value="ensureQueryData"])',
|
||||
message:
|
||||
"Use queryClient.query({ ...options, staleTime: 'static' }) instead.",
|
||||
},
|
||||
{
|
||||
selector:
|
||||
'CallExpression[callee.type="MemberExpression"]:matches([callee.property.name="fetchInfiniteQuery"], [callee.computed=true][callee.property.value="fetchInfiniteQuery"])',
|
||||
message: 'Use queryClient.infiniteQuery(options) instead.',
|
||||
},
|
||||
{
|
||||
selector:
|
||||
'CallExpression[callee.type="MemberExpression"]:matches([callee.property.name="prefetchInfiniteQuery"], [callee.computed=true][callee.property.value="prefetchInfiniteQuery"])',
|
||||
message:
|
||||
'Use queryClient.infiniteQuery(options).catch(noop) instead if errors should be swallowed.',
|
||||
},
|
||||
{
|
||||
selector:
|
||||
'CallExpression[callee.type="MemberExpression"]:matches([callee.property.name="ensureInfiniteQueryData"], [callee.computed=true][callee.property.value="ensureInfiniteQueryData"])',
|
||||
message:
|
||||
"Use queryClient.infiniteQuery({ ...options, staleTime: 'static' }) instead.",
|
||||
},
|
||||
],
|
||||
'prefer-const': 'off',
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ['**/*.spec.ts*', '**/*.test.ts*', '**/*.test-d.ts*'],
|
||||
plugins: { vitest },
|
||||
rules: {
|
||||
...vitest.configs.recommended.rules,
|
||||
'vitest/consistent-test-it': [
|
||||
'error',
|
||||
{ fn: 'it', withinDescribe: 'it' },
|
||||
],
|
||||
'vitest/no-standalone-expect': [
|
||||
'error',
|
||||
{
|
||||
additionalTestBlockFunctions: ['itIf'],
|
||||
},
|
||||
],
|
||||
},
|
||||
settings: { vitest: { typecheck: true } },
|
||||
},
|
||||
]
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"extends": "../../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "./dist-ts",
|
||||
"rootDir": "."
|
||||
},
|
||||
"include": ["src", "*.config.ts", "*.config.js", "package.json"]
|
||||
}
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
import { defineConfig } from 'vitest/config'
|
||||
|
||||
import packageJson from './package.json'
|
||||
|
||||
export default defineConfig({
|
||||
// fix from https://github.com/vitest-dev/vitest/issues/6992#issuecomment-2509408660
|
||||
resolve: {
|
||||
conditions: ['@tanstack/custom-condition'],
|
||||
},
|
||||
environments: {
|
||||
ssr: {
|
||||
resolve: {
|
||||
conditions: ['@tanstack/custom-condition'],
|
||||
},
|
||||
},
|
||||
},
|
||||
test: {
|
||||
name: packageJson.name,
|
||||
dir: './src',
|
||||
watch: false,
|
||||
globals: true,
|
||||
coverage: {
|
||||
enabled: !!process.env.CI,
|
||||
provider: 'istanbul',
|
||||
include: ['src/**/*.{js,ts,cjs,mjs,jsx,tsx}'],
|
||||
},
|
||||
typecheck: { enabled: true },
|
||||
restoreMocks: true,
|
||||
},
|
||||
})
|
||||
Reference in new issue
Block a user