Skip to content

Commit 5235213

Browse files
authoredFeb 17, 2024
chore: Add workspace config from Query (#45)
* Update eslint config * Add sherif and knip * Update nx.json * Enable method-signature-style
1 parent d81cf5a commit 5235213

21 files changed

+1070
-173
lines changed
 

‎.eslintrc.cjs

+42-10
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,14 @@
33
/** @type {import('eslint').Linter.Config} */
44
const config = {
55
root: true,
6+
reportUnusedDisableDirectives: true,
7+
ignorePatterns: ['**/build', '**/coverage', '**/dist'],
68
parser: '@typescript-eslint/parser',
7-
plugins: ['@typescript-eslint', 'compat', 'import'],
9+
plugins: ['@typescript-eslint', 'import'],
810
extends: [
9-
'plugin:@typescript-eslint/eslint-recommended',
11+
'eslint:recommended',
1012
'plugin:@typescript-eslint/recommended',
11-
'plugin:compat/recommended',
13+
'plugin:@typescript-eslint/stylistic',
1214
'plugin:import/recommended',
1315
'plugin:import/typescript',
1416
'prettier',
@@ -19,7 +21,7 @@ const config = {
1921
},
2022
parserOptions: {
2123
tsconfigRootDir: __dirname,
22-
project: './tsconfig.json',
24+
project: true,
2325
sourceType: 'module',
2426
ecmaVersion: 2020,
2527
},
@@ -35,26 +37,56 @@ const config = {
3537
},
3638
},
3739
rules: {
40+
'@typescript-eslint/array-type': 'off',
3841
'@typescript-eslint/ban-types': 'off',
3942
'@typescript-eslint/ban-ts-comment': 'off',
40-
'@typescript-eslint/consistent-type-imports': 'error',
43+
'@typescript-eslint/consistent-type-definitions': 'off',
44+
'@typescript-eslint/consistent-type-imports': [
45+
'error',
46+
{ prefer: 'type-imports' },
47+
],
4148
'@typescript-eslint/explicit-module-boundary-types': 'off',
49+
'@typescript-eslint/method-signature-style': 'error',
4250
'@typescript-eslint/no-empty-interface': 'off',
4351
'@typescript-eslint/no-explicit-any': 'off',
4452
'@typescript-eslint/no-non-null-assertion': 'off',
4553
'@typescript-eslint/no-unnecessary-condition': 'error',
54+
'@typescript-eslint/no-unused-vars': 'off',
4655
'@typescript-eslint/no-inferrable-types': [
4756
'error',
48-
{
49-
ignoreParameters: true,
50-
},
57+
{ ignoreParameters: true },
5158
],
52-
'no-shadow': 'error',
59+
'@typescript-eslint/prefer-for-of': 'off',
60+
'import/default': 'off',
61+
'import/export': 'off',
62+
'import/namespace': 'off',
63+
'import/newline-after-import': 'error',
5364
'import/no-cycle': 'error',
65+
'import/no-duplicates': 'off',
66+
'import/no-named-as-default-member': 'off',
5467
'import/no-unresolved': ['error', { ignore: ['^@tanstack/'] }],
5568
'import/no-unused-modules': ['off', { unusedExports: true }],
69+
'import/order': [
70+
'error',
71+
{
72+
groups: [
73+
'builtin',
74+
'external',
75+
'internal',
76+
'parent',
77+
'sibling',
78+
'index',
79+
'object',
80+
'type',
81+
],
82+
},
83+
],
84+
'no-async-promise-executor': 'off',
85+
'no-empty': 'off',
5686
'no-redeclare': 'off',
57-
'@typescript-eslint/no-unused-vars': 'off',
87+
'no-shadow': 'error',
88+
'no-undef': 'off',
89+
'sort-imports': ['error', { ignoreDeclarationSort: true }],
5890
},
5991
overrides: [
6092
{

‎.gitattributes

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# Auto detect text files and perform LF normalization
2-
* text=auto
2+
* text=auto eol=lf

‎.gitignore

+3-14
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,9 @@ package-lock.json
77
yarn.lock
88

99
# builds
10-
types
1110
build
12-
*/build
13-
dist
14-
lib
15-
es
16-
artifacts
17-
.rpt2_cache
1811
coverage
19-
*.tgz
12+
dist
2013

2114
# misc
2215
.DS_Store
@@ -38,15 +31,11 @@ stats.html
3831
.vscode/settings.json
3932

4033
*.log
41-
.DS_Store
4234
.cache
43-
.pnpm-store
44-
dist
4535
.idea
46-
47-
nx-cloud.env
48-
4936
.nx/cache
37+
.pnpm-store
5038
.tsup
39+
5140
vite.config.js.timestamp-*
5241
vite.config.ts.timestamp-*

‎knip.json

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"$schema": "https://unpkg.com/knip@4/schema.json",
3+
"workspaces": {
4+
"packages/angular-store": {
5+
"ignoreDependencies": ["@angular/compiler-cli"]
6+
},
7+
"packages/vue-store": {
8+
"ignoreDependencies": ["vue2", "vue2.7"]
9+
}
10+
}
11+
}

‎nx.json

+8
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,17 @@
5353
"inputs": ["^public"],
5454
"cache": true
5555
},
56+
"test:knip": {
57+
"cache": true,
58+
"inputs": ["{workspaceRoot}/**/*"]
59+
},
5660
"test:format": {
5761
"cache": true,
5862
"inputs": ["{workspaceRoot}/**/*"]
63+
},
64+
"test:sherif": {
65+
"cache": true,
66+
"inputs": ["{workspaceRoot}/**/*"]
5967
}
6068
}
6169
}

‎package.json

+10-5
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,12 @@
1313
"test:ci": "nx run-many --targets=test:format,test:eslint,test:lib,test:types,test:build,build",
1414
"test:eslint": "nx affected --target=test:eslint",
1515
"test:format": "pnpm run prettier --check",
16+
"test:sherif": "sherif",
1617
"test:lib": "nx affected --target=test:lib --exclude=examples/**",
1718
"test:lib:dev": "pnpm run test:lib && nx watch --all -- pnpm run test:lib",
1819
"test:build": "nx affected --target=test:build --exclude=examples/**",
1920
"test:types": "nx affected --target=test:types --exclude=examples/**",
21+
"test:knip": "knip",
2022
"build": "nx affected --target=build --exclude=examples/**",
2123
"build:all": "nx run-many --target=build --exclude=examples/**",
2224
"watch": "pnpm run build:all && nx watch --all -- pnpm run build:all",
@@ -28,7 +30,9 @@
2830
},
2931
"nx": {
3032
"includedScripts": [
31-
"test:format"
33+
"test:format",
34+
"test:knip",
35+
"test:sherif"
3236
]
3337
},
3438
"namespace": "@tanstack",
@@ -39,28 +43,29 @@
3943
"@testing-library/react": "^14.1.2",
4044
"@testing-library/user-event": "^14.4.3",
4145
"@testing-library/vue": "^7.0.0",
42-
"@types/eslint": "^8.56.0",
46+
"@types/eslint": "^8.56.2",
4347
"@types/jest": "^26.0.4",
4448
"@types/node": "^18.19.3",
4549
"@types/react": "^18.2.45",
4650
"@types/react-dom": "^18.0.5",
47-
"@typescript-eslint/eslint-plugin": "^6.4.1",
48-
"@typescript-eslint/parser": "^6.4.1",
51+
"@typescript-eslint/eslint-plugin": "^6.21.0",
52+
"@typescript-eslint/parser": "^6.21.0",
4953
"@vitest/coverage-istanbul": "^1.2.2",
5054
"eslint": "^8.56.0",
5155
"eslint-config-prettier": "^9.1.0",
5256
"eslint-import-resolver-typescript": "^3.6.1",
53-
"eslint-plugin-compat": "^4.2.0",
5457
"eslint-plugin-import": "^2.29.1",
5558
"eslint-plugin-react": "^7.33.2",
5659
"eslint-plugin-react-hooks": "^4.6.0",
5760
"jsdom": "^23.0.1",
61+
"knip": "^4.6.0",
5862
"nx": "^17.2.8",
5963
"prettier": "^4.0.0-alpha.8",
6064
"publint": "^0.2.7",
6165
"react": "^18.2.0",
6266
"react-dom": "^18.2.0",
6367
"rimraf": "^5.0.5",
68+
"sherif": "^0.7.0",
6469
"solid-js": "^1.7.8",
6570
"typescript": "^5.2.2",
6671
"typescript49": "npm:typescript@4.9",

‎packages/angular-store/.eslintrc.cjs

+1-6
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
// @ts-check
22

33
/** @type {import('eslint').Linter.Config} */
4-
const config = {
5-
parserOptions: {
6-
tsconfigRootDir: __dirname,
7-
project: './tsconfig.json',
8-
},
9-
}
4+
const config = {}
105

116
module.exports = config

‎packages/angular-store/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,10 @@
5454
},
5555
"devDependencies": {
5656
"@analogjs/vite-plugin-angular": "^0.2.32",
57-
"@angular/core": "^17.1.2",
5857
"@angular/common": "^17.1.2",
5958
"@angular/compiler": "^17.1.2",
6059
"@angular/compiler-cli": "^17.1.2",
60+
"@angular/core": "^17.1.2",
6161
"@angular/platform-browser": "^17.1.2",
6262
"@angular/platform-browser-dynamic": "^17.1.2",
6363
"zone.js": "^0.14.3"

‎packages/angular-store/src/index.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import {
2-
effect,
3-
signal,
4-
type CreateSignalOptions,
52
Injector,
63
assertInInjectionContext,
4+
effect,
75
inject,
86
runInInjectionContext,
7+
signal,
98
} from '@angular/core'
109
import type { AnyUpdater, Store } from '@tanstack/store'
10+
import type { CreateSignalOptions } from '@angular/core'
1111

1212
type NoInfer<T> = [T][T extends any ? 0 : never]
1313

‎packages/react-store/.eslintrc.cjs

-4
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,6 @@
33
/** @type {import('eslint').Linter.Config} */
44
const config = {
55
extends: ['plugin:react/recommended', 'plugin:react-hooks/recommended'],
6-
parserOptions: {
7-
tsconfigRootDir: __dirname,
8-
project: './tsconfig.json',
9-
},
106
rules: {
117
'react/jsx-key': ['error', { checkFragmentShorthand: true }],
128
'react-hooks/exhaustive-deps': 'error',

‎packages/react-store/src/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import type { AnyUpdater, Store } from '@tanstack/store'
21
import { useSyncExternalStoreWithSelector } from 'use-sync-external-store/shim/with-selector.js'
2+
import type { AnyUpdater, Store } from '@tanstack/store'
33

44
export * from '@tanstack/store'
55

‎packages/react-store/src/tests/index.test.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ import { render, waitFor } from '@testing-library/react'
22
import '@testing-library/jest-dom'
33
import * as React from 'react'
44
import { Store } from '@tanstack/store'
5-
import { useStore, shallow } from '../index'
65
import { useState } from 'react'
76
import userEvent from '@testing-library/user-event'
7+
import { shallow, useStore } from '../index'
88

99
const user = userEvent.setup()
1010

‎packages/solid-store/.eslintrc.cjs

+1-9
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,6 @@
11
// @ts-check
22

33
/** @type {import('eslint').Linter.Config} */
4-
const config = {
5-
parserOptions: {
6-
tsconfigRootDir: __dirname,
7-
project: './tsconfig.json',
8-
},
9-
rules: {
10-
'no-unused-vars': 'off',
11-
},
12-
}
4+
const config = {}
135

146
module.exports = config

‎packages/solid-store/src/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import type { AnyUpdater, Store } from '@tanstack/store'
2-
import type { Accessor } from 'solid-js'
31
import { onCleanup } from 'solid-js'
42
import { createStore, reconcile } from 'solid-js/store'
3+
import type { AnyUpdater, Store } from '@tanstack/store'
4+
import type { Accessor } from 'solid-js'
55

66
export * from '@tanstack/store'
77

‎packages/store/.eslintrc.cjs

+1-6
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
// @ts-check
22

33
/** @type {import('eslint').Linter.Config} */
4-
const config = {
5-
parserOptions: {
6-
tsconfigRootDir: __dirname,
7-
project: './tsconfig.json',
8-
},
9-
}
4+
const config = {}
105

116
module.exports = config

‎packages/store/src/tests/index.test.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { describe, test, expect, vi } from 'vitest'
1+
import { describe, expect, test, vi } from 'vitest'
22
import { Store } from '../index'
33

44
describe('store', () => {

‎packages/vue-store/.eslintrc.cjs

+1-9
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,6 @@
11
// @ts-check
22

33
/** @type {import('eslint').Linter.Config} */
4-
const config = {
5-
parserOptions: {
6-
tsconfigRootDir: __dirname,
7-
project: './tsconfig.json',
8-
},
9-
rules: {
10-
'no-unused-vars': 'off',
11-
},
12-
}
4+
const config = {}
135

146
module.exports = config

‎packages/vue-store/src/index.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
import { readonly, ref, toRaw, watch } from 'vue-demi'
12
import type { AnyUpdater, Store } from '@tanstack/store'
2-
import { readonly, type Ref, ref, toRaw, watch } from 'vue-demi'
3+
import type { Ref } from 'vue-demi'
34

45
export * from '@tanstack/store'
56

‎packages/vue-store/src/tests/index.test.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
// We need to import `h` as it's part of Vue's JSX transform
22
// @ts-expect-error
3-
import { h, defineComponent } from 'vue-demi'
3+
import { defineComponent, h } from 'vue-demi'
44
import { render, waitFor } from '@testing-library/vue'
55
import '@testing-library/jest-dom'
66
import { Store } from '@tanstack/store'
7-
import { useStore, shallow } from '../index'
87
import userEvent from '@testing-library/user-event'
8+
import { shallow, useStore } from '../index'
99

1010
const user = userEvent.setup()
1111

‎pnpm-lock.yaml

+978-94
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎pnpm-workspace.yaml

-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,2 @@
11
packages:
22
- 'packages/**'
3-
- 'examples/react/**'
4-
- 'examples/solid/**'
5-
- 'examples/vue/**'

0 commit comments

Comments
 (0)
Please sign in to comment.