Skip to content

Commit

Permalink
chore(typescript): upgrade to [email protected]
Browse files Browse the repository at this point in the history
  • Loading branch information
unicornware committed Oct 14, 2021
1 parent e075120 commit f74cf2f
Show file tree
Hide file tree
Showing 14 changed files with 462 additions and 170 deletions.
28 changes: 21 additions & 7 deletions .eslintrc.base.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ module.exports = {
ecmaFeatures: {
impliedStrict: true
},
extraFileExtensions: ['.cjs', '.mjs'],
extraFileExtensions: ['.cjs', '.cts', '.mjs', '.mts'],
project: ['./tsconfig.json'],
sourceType: 'module',
tsconfigRootDir: __dirname,
Expand Down Expand Up @@ -121,6 +121,7 @@ module.exports = {
'fixme',
'loadenv',
'mjs',
'ncc',
'nullable',
'nullish',
'perf',
Expand All @@ -134,6 +135,7 @@ module.exports = {
'ttsc',
'tutils',
'usr',
'vercel',
'wasm',
'wip',
'workspace',
Expand Down Expand Up @@ -216,24 +218,30 @@ module.exports = {
},
overrides: [
{
files: ['**/*.cjs'],
files: ['**/*.cjs', '**/*.cts'],
rules: {
'unicorn/prefer-module': 0
}
},
{
files: ['**/*.cjs', '**/*.md/*.js'],
files: ['**/*.cjs', '**/*.cts', '**/*.md/*.js'],
rules: {
'@typescript-eslint/no-var-requires': 0
}
},
{
files: ['**/*.cjs', '**/*.mjs'],
files: ['**/*.cjs', '**/*.cts', '**/*.mjs'],
parser: `${__dirname}/node_modules/@babel/eslint-parser/lib/index.cjs`,
parserOptions: {
requireConfigFile: false
}
},
{
files: ['**/*.d.cts', '**/*.d.mts'],
rules: {
'prettier/prettier': 0
}
},
{
files: ['**/*.md'],
extends: ['plugin:markdownlint/recommended'],
Expand All @@ -244,7 +252,6 @@ module.exports = {
files: ['**/*.md/*.ts'],
parser: require.resolve('@typescript-eslint/parser')
},

{
files: ['.eslintrc.*'],
rules: {
Expand All @@ -262,11 +269,18 @@ module.exports = {
root: true,
settings: {
'import/parsers': {
[require.resolve('@typescript-eslint/parser')]: ['.d.ts', '.ts']
[require.resolve('@typescript-eslint/parser')]: [
'.cts',
'.d.cts',
'.d.mts',
'.d.ts',
'.mts',
'.ts'
]
},
'import/resolver': {
[require.resolve('eslint-import-resolver-node')]: {
extensions: ['.ts']
extensions: ['.cts', '.mts', '.ts']
},
[require.resolve('eslint-import-resolver-typescript')]: {
alwaysTryTypes: true
Expand Down
15 changes: 7 additions & 8 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@
name: continuous-integration
on:
pull_request:
types:
- opened
- reopened
- synchronize
push:
branches:
- next
Expand Down Expand Up @@ -47,18 +43,21 @@ jobs:
run: yarn --immutable
env:
NODE_AUTH_TOKEN: ${PAT_GPR}
- id: env
name: Set environment variables
run: ./tools/cli/loadenv.cjs -gc=test
- id: check-format
name: Check code formatting
run: yarn check:format
- id: check-style
name: Check code style
run: yarn check:style --max-warnings 0
- id: check-types
name: Check types
run: yarn check:types
- id: env
name: Set build environment variables
run: node ./tools/cli/loadenv.cjs -gc=test
- id: check-build
name: Check build
run: yarn build --tarball
- id: env-post
name: Post Set environment variables
name: Post Set build environment variables
run: echo "NODE_OPTIONS=''" >> $GITHUB_ENV
7 changes: 7 additions & 0 deletions .husky/pre-push
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Pre Commit Hook
#
# References:
#
# - https://typicode.github.io/husky

yarn check:types
13 changes: 12 additions & 1 deletion .prettierrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,18 @@ module.exports = {
trailingComma: 'none',
overrides: [
{
files: ['*.sh', '.husky/commit-msg', '.husky/pre-commit'],
files: ['*.cts', '*.mts'],
options: {
parser: 'typescript'
}
},
{
files: [
'*.sh',
'.husky/commit-msg',
'.husky/pre-commit',
'.husky/pre-push'
],
options: {
functionNextLine: true,
indent: 2,
Expand Down
42 changes: 39 additions & 3 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,50 @@
{
"eslint.options": {
"configFile": "./.eslintrc.cjs",
"extensions": [".cjs", ".md", ".mjs", ".ts"]
"extensions": [".cjs", ".cts", ".md", ".mjs", ".mts", ".ts"]
},
"files.associations": {
"*.d.cts": "typescript",
"*.d.mts": "typescript",
".env": "shellscript",
".env.*": "shellscript",
".markdownlintignore": "ignore",
"commit-msg": "shellscript",
"pre-commit": "shellscript"
"pre-commit": "shellscript",
"pre-push": "shellscript"
},
"prettier.configPath": "./.prettierrc.cjs",
"typescript.tsdk": "node_modules/typescript/lib"
"typescript.tsdk": "node_modules/typescript/lib",
"vsicons.associations.files": [
{
"extensions": [".commitlintrc.cjs", ".commitlintrc.ts"],
"format": "svg",
"icon": "commitlint"
},
{
"extensions": [".d.cts", ".d.mts"],
"format": "svg",
"icon": "typescriptdef"
},
{
"extensions": [".eslintrc.base.cjs"],
"format": "svg",
"icon": "eslint"
},
{
"extensions": ["prod.cjs.json", "prod.esm.json", "prod.types.json"],
"format": "svg",
"icon": "tsconfig"
},
{
"extensions": [".lintstagedrc.cjs"],
"format": "svg",
"icon": "lintstagedrc"
},
{
"extensions": ["yarnrc.yml"],
"format": "svg",
"icon": "yarn"
}
]
}
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@
"check:dedupe": "yarn dedupe --check",
"check:format": "prettier --check .",
"check:install": "yarn dlx @yarnpkg/doctor .",
"check:style": "eslint . --ext cjs,md,mjs,ts",
"check:style": "eslint . --ext cjs,cts,md,mjs,mts,ts",
"check:types": "tsc -p tsconfig.prod.json --noEmit",
"check:upgrades": "yarn upgrade-interactive",
"fix:format": "prettier --write .",
"fix:style": "yarn check:style --fix --cache",
Expand Down Expand Up @@ -98,7 +99,6 @@
"@typescript-eslint/parser": "4.33.0",
"@vates/toggle-scripts": "1.0.0",
"@vercel/ncc": "0.31.1",
"@zerollup/ts-transform-paths": "1.7.18",
"chalk": "4.1.2",
"concurrently": "6.3.0",
"convert-extension": "0.3.0",
Expand Down Expand Up @@ -129,16 +129,16 @@
"rimraf": "3.0.2",
"shelljs": "0.8.4",
"ts-node": "10.2.1",
"ts-patch": "1.4.4",
"tsc-alias": "1.3.10",
"tsc-prog": "2.2.1",
"tsconfig": "7.0.0",
"tsconfig-paths": "3.11.0",
"typescript": "4.4.3",
"typescript": "4.5.0-beta",
"yargs": "17.2.1"
},
"peerDependencies": {
"@types/node": ">=14.0.0",
"typescript": ">=2.7"
"typescript": "4.5.0-beta"
},
"peerDependenciesMeta": {
"@types/node": {
Expand Down
4 changes: 2 additions & 2 deletions src/types/deep-omit.type.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type BuiltIn from './built-in.type'
import type KeysOptional from './keys-optional.type'
import type KeysRequired from './keys-required.type'
import type ObjectUnknown from './object-unknown.type'
import type ObjectPlain from './object-plain.type'
import type OmitByType from './omit-by-type.type'

/**
Expand All @@ -19,7 +19,7 @@ import type OmitByType from './omit-by-type.type'
*/
type DeepOmit<
T extends DeepOmitHelper<F>,
F extends ObjectUnknown
F extends ObjectPlain
> = T extends BuiltIn
? T
: T extends Map<infer KeyType, infer ValueType>
Expand Down
Loading

0 comments on commit f74cf2f

Please sign in to comment.