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

Switch to using the centralized tooling configs #4606

Draft
wants to merge 8 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 0 additions & 61 deletions .eslintrc.js

This file was deleted.

6 changes: 5 additions & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ on:
- '@rtk-query/codegen-openapi'
- '@rtk-query/graphql-request-base-query'
- '@reduxjs/rtk-codemods'
- '@reduxjs/eslint-config'
- '@reduxjs/prettier-config'
- '@reduxjs/tsconfig'
- '@reduxjs/vitest-config'
jobs:
publish:
runs-on: ubuntu-latest
Expand All @@ -28,7 +32,7 @@ jobs:
registry-url: 'https://registry.npmjs.org'
cache: 'yarn'
- run: yarn install --frozen-lockfile
- run: yarn workspace ${{ inputs.package }} test
- run: yarn workspaces foreach --include "${{ inputs.package }}" run test
- run: yarn workspace ${{ inputs.package }} exec npm publish --access public --provenance
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
117 changes: 117 additions & 0 deletions .github/workflows/test-configs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
name: Test Configs

on: [push, pull_request, workflow_dispatch]

jobs:
test-types:
name: Test types with TypeScript ${{ matrix.ts }} on ${{ matrix.os }} and Node.js ${{ matrix.node }}
runs-on: ${{ matrix.os }}

strategy:
fail-fast: false

matrix:
package:
[
'@reduxjs/eslint-config',
'@reduxjs/prettier-config',
'@reduxjs/vitest-config',
]
node: ['22.x']
os: [ubuntu-latest]
ts: ['5.3', '5.4', '5.5', '5.6', '5.7', '5.8']

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Use node ${{ matrix.node }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
cache: 'yarn'

- name: Install dependencies
run: yarn install

- name: Install TypeScript ${{ matrix.ts }}
run: yarn up typescript@${{ matrix.ts }}

- name: Run type tests
run: yarn workspace ${{ matrix.package }} run test-types

are-the-types-wrong:
name: Check if the type definitions for ${{ matrix.package }} are correct with Node.js ${{ matrix.node }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}

strategy:
fail-fast: false

matrix:
node: ['22.x']
package:
[
'@reduxjs/eslint-config',
'@reduxjs/prettier-config',
'@reduxjs/tsconfig',
'@reduxjs/vitest-config',
]
os: [ubuntu-latest]

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Use node ${{ matrix.node }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
cache: 'yarn'

- name: Install dependencies
run: yarn install

- name: Run are-the-types-wrong for ${{ matrix.package }} with Node.js ${{ matrix.node }} on ${{ matrix.os }}
run: yarn workspace ${{ matrix.package }} run check-exports --format table

- name: Did we fail?
if: failure()
run: ls -R

publint:
name: Check if the package.json for ${{ matrix.package }} is correct with Node.js ${{ matrix.node }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}

strategy:
fail-fast: false

matrix:
node: ['22.x']
package:
[
'@reduxjs/eslint-config',
'@reduxjs/prettier-config',
'@reduxjs/tsconfig',
'@reduxjs/vitest-config',
]
os: [ubuntu-latest]

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Use node ${{ matrix.node }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
cache: 'yarn'

- name: Install dependencies
run: yarn install

- name: Run publint for ${{ matrix.package }} with Node.js ${{ matrix.node }} on ${{ matrix.os }}
run: yarn workspace ${{ matrix.package }} run check-package-json

- name: Did we fail?
if: failure()
run: ls -R
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,5 @@ typesversions
.pnp.*
*.tgz

tsconfig.vitest-temp.json
tsconfig.vitest-temp.json
.eslintcache
9 changes: 5 additions & 4 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
**/dist/**
**/etc/**
**/temp/**
**/__testfixtures__/**
__testfixtures__/
.docusaurus/
.next/
examples/publish-ci/
.yarn/
4 changes: 0 additions & 4 deletions .prettierrc.json

This file was deleted.

4 changes: 3 additions & 1 deletion docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"name": "docs",
"devDependencies": {
"@manaflair/redux-batch": "^1.0.0",
"@reduxjs/tsconfig": "workspace:^",
"@types/nanoid": "^2.1.0",
"@types/react": "^19.0.1",
"async-mutex": "^0.3.2",
Expand All @@ -12,6 +13,7 @@
"nanoid": "^3.1.23",
"next-redux-wrapper": "^7.0.5",
"redux-persist": "^6.0.0",
"rxjs": "^6.6.2"
"rxjs": "^6.6.2",
"typescript": "^5.8.2"
}
}
1 change: 1 addition & 0 deletions docs/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"extends": "@reduxjs/tsconfig/base",
"compilerOptions": {
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
Expand Down
55 changes: 55 additions & 0 deletions eslint.config.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import { createESLintConfig } from '@reduxjs/eslint-config'
import eslintConfigPackageJson from '@reduxjs/eslint-config/package.json' with { type: 'json' }

const basename = `${eslintConfigPackageJson.name}/overrides`

const eslintConfig = createESLintConfig([
{
name: `${basename}/global-ignores`,
ignores: [
'packages/rtk-codemods/transforms/*/__testfixtures__/',
'packages/toolkit/.size-limit.cjs',
'packages/rtk-query-codegen-openapi/test/config.example.js',
'examples/publish-ci/',

// TODO: Remove this later.
'examples/',
],
},

{
name: `${basename}/no-require-imports`,
files: ['examples/query/react/graphql-codegen/src/mocks/schema.js'],
languageOptions: {
sourceType: 'commonjs',
},
rules: {
'@typescript-eslint/no-require-imports': [
2,
{
allow: ['ts-node', '\\./db(.c?[tj]s)?$'],
allowAsImport: false,
},
],
},
},

{
name: `${basename}/examples/type-portability/nodenext-cjs`,
files: ['examples/type-portability/nodenext-cjs/**/*.?(c)ts?(x)'],
languageOptions: {
sourceType: 'commonjs',
},
rules: {
'@typescript-eslint/no-namespace': [
0,
{
allowDeclarations: false,
allowDefinitionFiles: true,
},
],
},
},
])

export default eslintConfig
1 change: 1 addition & 0 deletions examples/action-listener/counter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
]
},
"devDependencies": {
"@reduxjs/tsconfig": "workspace:^",
"jest-watch-typeahead": "^1.1.0"
}
}
19 changes: 2 additions & 17 deletions examples/action-listener/counter/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,5 @@
{
"compilerOptions": {
"target": "es5",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noFallthroughCasesInSwitch": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react-jsx"
},
"extends": "@reduxjs/tsconfig/create-react-app",
"compilerOptions": {},
"include": ["src"]
}
1 change: 1 addition & 0 deletions examples/query/react/advanced/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"react-scripts": "5.0.1"
},
"devDependencies": {
"@reduxjs/tsconfig": "workspace:^",
"@types/react": "^19.0.1",
"@types/react-dom": "^19.0.1",
"typescript": "^5.8.2"
Expand Down
21 changes: 3 additions & 18 deletions examples/query/react/advanced/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,5 @@
{
"include": ["./src/**/*"],
"compilerOptions": {
"strict": true,
"esModuleInterop": true,
"lib": ["dom", "es2015"],
"jsx": "react-jsx",
"target": "es5",
"allowJs": true,
"skipLibCheck": true,
"allowSyntheticDefaultImports": true,
"forceConsistentCasingInFileNames": true,
"noFallthroughCasesInSwitch": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true
}
"extends": "@reduxjs/tsconfig/create-react-app",
"compilerOptions": {},
"include": ["src"]
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"react-scripts": "5.0.1"
},
"devDependencies": {
"@reduxjs/tsconfig": "workspace:^",
"@types/react": "^19.0.1",
"@types/react-dom": "^19.0.1",
"typescript": "^5.8.2"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,5 @@
{
"include": ["./src/**/*"],
"compilerOptions": {
"strict": true,
"esModuleInterop": true,
"lib": ["dom", "es2015"],
"jsx": "react-jsx",
"target": "es5",
"allowJs": true,
"skipLibCheck": true,
"allowSyntheticDefaultImports": true,
"forceConsistentCasingInFileNames": true,
"noFallthroughCasesInSwitch": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true
}
"extends": "@reduxjs/tsconfig/create-react-app",
"compilerOptions": {},
"include": ["src"]
}
Loading