Skip to content

Commit 33580e7

Browse files
feat: Add shared ESLint config, rename tanstackBuildConfig (#103)
* chore: Add custom eslint flat config * Newline * Update maps * Add eslint export * Rename to tanstackVitePlugin * Try downgrading prettier * Remove tanstack/temp
1 parent a4954b4 commit 33580e7

File tree

22 files changed

+441
-1527
lines changed

22 files changed

+441
-1527
lines changed

.prettierignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
**/.next
2+
**/.nx/cache
3+
**/.svelte-kit
4+
**/coverage
5+
**/dist
6+
**/docs
7+
**/snap
8+
pnpm-lock.yaml

.prettierrc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"semi": false,
3+
"singleQuote": true,
4+
"trailingComma": "all"
5+
}

.vscode/settings.json

Lines changed: 0 additions & 48 deletions
This file was deleted.

bin/config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ function checkForConfigFile(configPath) {
5555
console.error(
5656
[
5757
'No tanstack.config.js file found!',
58-
'This may be because you\'re not passing the --config or --cwd flags.',
58+
"This may be because you're not passing the --config or --cwd flags.",
5959
'If you are passing these flags, check that the path is correct.',
6060
'Otherwise, you can create a `tanstack.config.js` file in your project root.',
6161
].join('\n'),

docs/config.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,16 @@
1414
"to": "overview"
1515
},
1616
{
17-
"label": "Build",
18-
"to": "build"
17+
"label": "ESLint",
18+
"to": "eslint"
1919
},
2020
{
2121
"label": "Publish",
2222
"to": "publish"
23+
},
24+
{
25+
"label": "Vite",
26+
"to": "vite"
2327
}
2428
]
2529
}

docs/eslint.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
id: eslint
3+
title: ESLint
4+
---
5+
6+
To-do!

docs/overview.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@ TanStack Config allows you to publish, update, and maintain your packages withou
77

88
## Utilities
99

10-
- [Build](../build)
10+
- [ESLint](../eslint)
1111
- [Publish](../publish)
12+
- [Vite](../vite)
1213

1314
## Required Pre-Requisites
1415

docs/build.md renamed to docs/vite.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
2-
id: build
3-
title: Build
2+
id: vite
3+
title: Vite
44
---
55

66
The Vite build setup is the culmination of several attempts to dual publish ESM and CJS for TanStack projects, while preserving compatibility with all Typescript module resolution options.
@@ -45,22 +45,22 @@ The build config is quite opinionated, as it is designed to work with our intern
4545

4646
### vite.config.ts
4747

48-
- Import `mergeConfig` and `tanstackBuildConfig`.
49-
- Merge your custom config first, followed by `tanstackBuildConfig`.
48+
- Import `mergeConfig` and `tanstackViteConfig`.
49+
- Merge your custom config first, followed by `tanstackViteConfig`.
5050
- Please avoid modifying `build` in your custom config.
5151
- See an example below:
5252

5353
```ts
5454
import { defineConfig, mergeConfig } from 'vite'
55-
import { tanstackBuildConfig } from '@tanstack/config/build'
55+
import { tanstackViteConfig } from '@tanstack/config/vite'
5656

5757
const config = defineConfig({
5858
// Framework plugins, vitest config, etc.
5959
})
6060

6161
export default mergeConfig(
6262
config,
63-
tanstackBuildConfig({
63+
tanstackViteConfig({
6464
entry: './src/index.ts',
6565
srcDir: './src',
6666
}),

eslint.config.js

Lines changed: 4 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,5 @@
1-
import antfu from '@antfu/eslint-config'
1+
// @ts-check
22

3-
export default antfu(
4-
{
5-
formatters: true,
6-
ignores: [
7-
'**/snap',
8-
'**/vite.config.js.timestamp-*',
9-
'**/vite.config.ts.timestamp-*',
10-
],
11-
},
12-
{
13-
rules: {
14-
'antfu/if-newline': 'off',
15-
'antfu/top-level-function': 'off',
16-
'jsdoc/require-returns-description': 'off',
17-
'style/arrow-parens': ['error', 'always'],
18-
'style/brace-style': ['error', '1tbs'],
19-
'node/prefer-global/process': 'off',
20-
'ts/array-type': ['error', { default: 'generic', readonly: 'generic' }],
21-
'ts/ban-ts-comment': 'off',
22-
'ts/consistent-type-definitions': 'off',
23-
'ts/no-inferrable-types': ['error', { ignoreParameters: true }],
24-
'curly': 'off',
25-
'no-console': 'off',
26-
},
27-
},
28-
)
3+
import { rootConfig } from './src/eslint/index.js'
4+
5+
export default [...rootConfig]

integrations/react/vite.config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { defineConfig, mergeConfig } from 'vitest/config'
22
import react from '@vitejs/plugin-react'
3-
import { tanstackBuildConfig } from '@tanstack/config/build'
3+
import { tanstackViteConfig } from '@tanstack/config/vite'
44

55
const config = defineConfig({
66
plugins: [react()],
@@ -12,7 +12,7 @@ const config = defineConfig({
1212

1313
export default mergeConfig(
1414
config,
15-
tanstackBuildConfig({
15+
tanstackViteConfig({
1616
entry: './src/index.ts',
1717
srcDir: './src',
1818
}),

0 commit comments

Comments
 (0)