Skip to content

Commit

Permalink
upgrade to @epic-web/config
Browse files Browse the repository at this point in the history
  • Loading branch information
kentcdodds committed May 27, 2024
1 parent f18e79f commit 298e670
Show file tree
Hide file tree
Showing 106 changed files with 3,418 additions and 1,835 deletions.
1,899 changes: 1,870 additions & 29 deletions epicshop/package-lock.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions epicshop/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"type": "module",
"dependencies": {
"@epic-web/config": "^1.5.4",
"@epic-web/workshop-app": "^4.5.0",
"execa": "^8.0.1"
}
Expand Down
28 changes: 28 additions & 0 deletions epicshop/post-set-playground.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import fs from 'node:fs'
import path from 'node:path'

const exclude = [
'exercises/04.',
'exercises/05.',
'exercises/06.',
'exercises/07.',
]

if (exclude.every(e => !process.env.EPICSHOP_PLAYGROUND_SRC_DIR.includes(e))) {
fs.writeFileSync(
path.join(process.env.EPICSHOP_PLAYGROUND_DEST_DIR, 'tsconfig.json'),
JSON.stringify(
{
include: ['**/*.ts', '**/*.tsx'],
extends: ['@epic-web/config/typescript'],
compilerOptions: {
paths: {
'#*': ['../shared/*'],
},
},
},
null,
2,
),
)
}
21 changes: 3 additions & 18 deletions epicshop/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,4 @@
{
"include": ["**/*.ts", "**/*.tsx", "**/*.js"],
"compilerOptions": {
"lib": ["ES2023"],
"isolatedModules": true,
"esModuleInterop": true,
"module": "ES2022",
"moduleResolution": "Bundler",
"resolveJsonModule": true,
"target": "ES2022",
"strict": true,
"noImplicitAny": true,
"allowJs": true,
"forceConsistentCasingInFileNames": true,
"skipLibCheck": true,
"allowImportingTsExtensions": true,
"noEmit": true
}
}
"include": ["@epic-web/config/reset.d.ts", "**/*.ts", "**/*.tsx", "**/*.js"],
"extends": ["@epic-web/config/typescript"]
}
49 changes: 11 additions & 38 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,40 +1,13 @@
/** @type {import('@types/eslint').Linter.Config} */
export default {
files: ['**/*.js', '**/*.ts', '**/*.tsx'],
languageOptions: { parser: await import('@typescript-eslint/parser') },
plugins: {
'@typescript-eslint': (await import('@typescript-eslint/eslint-plugin'))
.default,
'react-hooks': (await import('eslint-plugin-react-hooks')).default,
import: (await import('eslint-plugin-import')).default,
},
rules: {
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'warn',
import defaultConfig from '@epic-web/config/eslint'

'@typescript-eslint/consistent-type-imports': [
'warn',
{
prefer: 'type-imports',
disallowTypeAnnotations: true,
fixStyle: 'inline-type-imports',
},
],
'import/no-duplicates': ['warn', { 'prefer-inline': true }],
'import/consistent-type-specifier-style': ['warn', 'prefer-inline'],
'import/order': [
'warn',
{
alphabetize: { order: 'asc', caseInsensitive: true },
groups: [
'builtin',
'external',
'internal',
'parent',
'sibling',
'index',
],
},
],
/** @type {import("eslint").Linter.Config} */
export default [
...defaultConfig,
{
rules: {
// we leave unused vars around for the exercises
'no-unused-vars': 'off',
'@typescript-eslint/no-unused-vars': 'off',
},
},
}
]
11 changes: 1 addition & 10 deletions examples/unnecessary-rerenders/reset.d.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1 @@
import '@total-typescript/ts-reset'
import '@total-typescript/ts-reset/dom'

import 'react'

declare module 'react' {
interface CSSProperties {
[key: `--${string}`]: string | number
}
}
import '@epic-web/config/reset.d.ts'
19 changes: 4 additions & 15 deletions examples/unnecessary-rerenders/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,9 @@
{
"include": ["**/*.ts", "**/*.tsx"],
"extends": ["@epic-web/config/typescript"],
"compilerOptions": {
"lib": ["DOM", "DOM.Iterable", "ES2023"],
"isolatedModules": true,
"esModuleInterop": true,
"jsx": "react-jsx",
"module": "ES2022",
"moduleResolution": "Bundler",
"resolveJsonModule": true,
"target": "ES2022",
"strict": true,
"noImplicitAny": true,
"allowJs": true,
"forceConsistentCasingInFileNames": true,
"skipLibCheck": true,
"allowImportingTsExtensions": true,
"noEmit": true,
"paths": {
"#*": ["../../../shared/*"]
}
}
}
11 changes: 1 addition & 10 deletions exercises/01.elements/01.problem.reuse/reset.d.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1 @@
import '@total-typescript/ts-reset'
import '@total-typescript/ts-reset/dom'

import 'react'

declare module 'react' {
interface CSSProperties {
[key: `--${string}`]: string | number
}
}
import '@epic-web/config/reset.d.ts'
19 changes: 4 additions & 15 deletions exercises/01.elements/01.problem.reuse/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,9 @@
{
"include": ["**/*.ts", "**/*.tsx"],
"extends": ["@epic-web/config/typescript"],
"compilerOptions": {
"lib": ["DOM", "DOM.Iterable", "ES2023"],
"isolatedModules": true,
"esModuleInterop": true,
"jsx": "react-jsx",
"module": "ES2022",
"moduleResolution": "Bundler",
"resolveJsonModule": true,
"target": "ES2022",
"strict": true,
"noImplicitAny": true,
"allowJs": true,
"forceConsistentCasingInFileNames": true,
"skipLibCheck": true,
"allowImportingTsExtensions": true,
"noEmit": true,
"paths": {
"#*": ["../../../shared/*"]
}
}
}
11 changes: 1 addition & 10 deletions exercises/01.elements/01.solution.reuse/reset.d.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1 @@
import '@total-typescript/ts-reset'
import '@total-typescript/ts-reset/dom'

import 'react'

declare module 'react' {
interface CSSProperties {
[key: `--${string}`]: string | number
}
}
import '@epic-web/config/reset.d.ts'
19 changes: 4 additions & 15 deletions exercises/01.elements/01.solution.reuse/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,9 @@
{
"include": ["**/*.ts", "**/*.tsx"],
"extends": ["@epic-web/config/typescript"],
"compilerOptions": {
"lib": ["DOM", "DOM.Iterable", "ES2023"],
"isolatedModules": true,
"esModuleInterop": true,
"jsx": "react-jsx",
"module": "ES2022",
"moduleResolution": "Bundler",
"resolveJsonModule": true,
"target": "ES2022",
"strict": true,
"noImplicitAny": true,
"allowJs": true,
"forceConsistentCasingInFileNames": true,
"skipLibCheck": true,
"allowImportingTsExtensions": true,
"noEmit": true,
"paths": {
"#*": ["../../../shared/*"]
}
}
}
11 changes: 1 addition & 10 deletions exercises/01.elements/02.problem.props/reset.d.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1 @@
import '@total-typescript/ts-reset'
import '@total-typescript/ts-reset/dom'

import 'react'

declare module 'react' {
interface CSSProperties {
[key: `--${string}`]: string | number
}
}
import '@epic-web/config/reset.d.ts'
19 changes: 4 additions & 15 deletions exercises/01.elements/02.problem.props/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,9 @@
{
"include": ["**/*.ts", "**/*.tsx"],
"extends": ["@epic-web/config/typescript"],
"compilerOptions": {
"lib": ["DOM", "DOM.Iterable", "ES2023"],
"isolatedModules": true,
"esModuleInterop": true,
"jsx": "react-jsx",
"module": "ES2022",
"moduleResolution": "Bundler",
"resolveJsonModule": true,
"target": "ES2022",
"strict": true,
"noImplicitAny": true,
"allowJs": true,
"forceConsistentCasingInFileNames": true,
"skipLibCheck": true,
"allowImportingTsExtensions": true,
"noEmit": true,
"paths": {
"#*": ["../../../shared/*"]
}
}
}
11 changes: 1 addition & 10 deletions exercises/01.elements/02.solution.props/reset.d.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1 @@
import '@total-typescript/ts-reset'
import '@total-typescript/ts-reset/dom'

import 'react'

declare module 'react' {
interface CSSProperties {
[key: `--${string}`]: string | number
}
}
import '@epic-web/config/reset.d.ts'
19 changes: 4 additions & 15 deletions exercises/01.elements/02.solution.props/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,9 @@
{
"include": ["**/*.ts", "**/*.tsx"],
"extends": ["@epic-web/config/typescript"],
"compilerOptions": {
"lib": ["DOM", "DOM.Iterable", "ES2023"],
"isolatedModules": true,
"esModuleInterop": true,
"jsx": "react-jsx",
"module": "ES2022",
"moduleResolution": "Bundler",
"resolveJsonModule": true,
"target": "ES2022",
"strict": true,
"noImplicitAny": true,
"allowJs": true,
"forceConsistentCasingInFileNames": true,
"skipLibCheck": true,
"allowImportingTsExtensions": true,
"noEmit": true,
"paths": {
"#*": ["../../../shared/*"]
}
}
}
11 changes: 1 addition & 10 deletions exercises/01.elements/03.problem.context/reset.d.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1 @@
import '@total-typescript/ts-reset'
import '@total-typescript/ts-reset/dom'

import 'react'

declare module 'react' {
interface CSSProperties {
[key: `--${string}`]: string | number
}
}
import '@epic-web/config/reset.d.ts'
19 changes: 4 additions & 15 deletions exercises/01.elements/03.problem.context/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,9 @@
{
"include": ["**/*.ts", "**/*.tsx"],
"extends": ["@epic-web/config/typescript"],
"compilerOptions": {
"lib": ["DOM", "DOM.Iterable", "ES2023"],
"isolatedModules": true,
"esModuleInterop": true,
"jsx": "react-jsx",
"module": "ES2022",
"moduleResolution": "Bundler",
"resolveJsonModule": true,
"target": "ES2022",
"strict": true,
"noImplicitAny": true,
"allowJs": true,
"forceConsistentCasingInFileNames": true,
"skipLibCheck": true,
"allowImportingTsExtensions": true,
"noEmit": true,
"paths": {
"#*": ["../../../shared/*"]
}
}
}
11 changes: 1 addition & 10 deletions exercises/01.elements/03.solution.context/reset.d.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1 @@
import '@total-typescript/ts-reset'
import '@total-typescript/ts-reset/dom'

import 'react'

declare module 'react' {
interface CSSProperties {
[key: `--${string}`]: string | number
}
}
import '@epic-web/config/reset.d.ts'
19 changes: 4 additions & 15 deletions exercises/01.elements/03.solution.context/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,9 @@
{
"include": ["**/*.ts", "**/*.tsx"],
"extends": ["@epic-web/config/typescript"],
"compilerOptions": {
"lib": ["DOM", "DOM.Iterable", "ES2023"],
"isolatedModules": true,
"esModuleInterop": true,
"jsx": "react-jsx",
"module": "ES2022",
"moduleResolution": "Bundler",
"resolveJsonModule": true,
"target": "ES2022",
"strict": true,
"noImplicitAny": true,
"allowJs": true,
"forceConsistentCasingInFileNames": true,
"skipLibCheck": true,
"allowImportingTsExtensions": true,
"noEmit": true,
"paths": {
"#*": ["../../../shared/*"]
}
}
}
11 changes: 1 addition & 10 deletions exercises/01.elements/04.problem.use-memo/reset.d.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1 @@
import '@total-typescript/ts-reset'
import '@total-typescript/ts-reset/dom'

import 'react'

declare module 'react' {
interface CSSProperties {
[key: `--${string}`]: string | number
}
}
import '@epic-web/config/reset.d.ts'
Loading

0 comments on commit 298e670

Please sign in to comment.