Skip to content

Commit

Permalink
Bump scaffold (#64)
Browse files Browse the repository at this point in the history
* Bump scaffold

* Add eslint-import-resolver-*

* Add triple-slash reference

* Fix extension

* Revert

---------

Co-authored-by: @compulim <@compulim>
Co-authored-by: William Wong <compulim@hotmail.com>
  • Loading branch information
compulim-workflow-bot[bot] and compulim authored Oct 13, 2024
1 parent 1ca1e16 commit fdb3230
Show file tree
Hide file tree
Showing 27 changed files with 251 additions and 33 deletions.
1 change: 1 addition & 0 deletions .eslintrc.jest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ rules:
react/display-name: off
# Disable for convenience
react/prop-types: off
'@typescript-eslint/no-require-imports': off
11 changes: 9 additions & 2 deletions .eslintrc.production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,17 @@ rules:
import/exports-last: error
import/extensions:
- error
- always
- ignorePackages # eslint-plugin-import does not understand named import
import/first: error
import/newline-after-import: error
import/no-anonymous-default-export: error
import/no-duplicates: error
import/no-namespace: error
import/no-unassigned-import: error
import/no-unassigned-import:
- error
- allow:
- '**/*.css'
- dotenv/config
settings:
import/extensions:
- .cjs
Expand All @@ -41,3 +45,6 @@ settings:
- .mts
- .ts
- .tsx
import/resolver:
node: true
typescript: true
3 changes: 3 additions & 0 deletions .eslintrc.typescript.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ parser: '@typescript-eslint/parser'
plugins:
- '@typescript-eslint'
rules:
# Shortening if-statement into &&, ||, or ternary operators.
'@typescript-eslint/no-unused-expressions': off

'@typescript-eslint/no-unused-vars':
- error
- argsIgnorePattern: ^_
Expand Down
4 changes: 0 additions & 4 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
env:
browser: true
extends:
- eslint:recommended
# - plugin:import/recommended
overrides:
- extends: .eslintrc.react.yml
files:
Expand Down Expand Up @@ -67,7 +64,6 @@ parserOptions:
ecmaVersion: latest
sourceType: module
plugins:
# - import
- prettier
root: true
rules:
Expand Down
127 changes: 124 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
],
"scripts": {
"build": "npm run build --if-present --workspaces",
"bump": "npm run bump:prod && npm run bump:dev && npm run bump:auditfix && npm run bump:packages && npm run bump:eslintrc",
"bump:auditfix": "npm audit fix || exit 0",
"bump": "npm run bump:prod && npm run bump:dev && npm run bump:packages && npm run bump:eslintrc",
"bump:dev": "PACKAGES_TO_BUMP=$(cat package.json | jq -r '(.pinDependencies // {}) as $P | (.localPeerDependencies // {}) as $L | (.devDependencies // {}) | to_entries | map(select(.key as $K | $L | has($K) | not)) | map(.key + \"@\" + ($P[.key] // [\"latest\"])[0]) | join(\" \")') && [ ! -z \"$PACKAGES_TO_BUMP\" ] && npm install $PACKAGES_TO_BUMP || true",
"bump:eslintrc": "if [ -f node_modules/react/package.json ]; then docker run -e VERSION=$(cat node_modules/react/package.json | jq -r '.version') -i --rm mikefarah/yq '.settings.react.version = strenv(VERSION)' < ./.eslintrc.react.yml | tee /tmp/output.tmp && mv /tmp/output.tmp ./.eslintrc.react.yml; fi",
"bump:packages": "npm run bump --if-present --workspaces",
Expand All @@ -28,6 +27,8 @@
"@typescript-eslint/eslint-plugin": "^7.4.0",
"@typescript-eslint/parser": "^7.4.0",
"eslint": "^8.57.0",
"eslint-import-resolver-node": "^0.3.9",
"eslint-import-resolver-typescript": "^3.6.3",
"eslint-plugin-import": "^2.30.0",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-react": "^7.34.1",
Expand Down
2 changes: 2 additions & 0 deletions packages/integration-test/.eslintrc.custom.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
env:
browser: true
3 changes: 1 addition & 2 deletions packages/integration-test/.eslintrc.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
extends:
- ../../.eslintrc.mocha.yml
- ../../.eslintrc.react.yml
- ./.eslintrc.custom.yml
38 changes: 38 additions & 0 deletions packages/integration-test/jest.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"testMatch": ["**/__tests__/**/*.?([cm])[jt]s?(x)", "**/?(*.)+(spec|test).?([cm])[jt]s?(x)"],
"transform": {
"\\.cjsx?$": [
"babel-jest",
{
"presets": [
[
"@babel/preset-react",
{
"runtime": "classic"
}
]
]
}
],
"\\.mjsx?$": [
"babel-jest",
{
"presets": [
[
"@babel/preset-react",
{
"runtime": "classic"
}
],
[
"@babel/preset-env",
{
"modules": "commonjs",
"targets": "defaults"
}
]
]
}
]
}
}
5 changes: 2 additions & 3 deletions packages/integration-test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@
"description": "",
"private": true,
"scripts": {
"bump": "npm run bump:prod && npm run bump:dev && npm run bump:auditfix",
"bump:auditfix": "npm audit fix || exit 0",
"bump": "npm run bump:prod && npm run bump:dev",
"bump:dev": "PACKAGES_TO_BUMP=$(cat package.json | jq -r '(.pinDependencies // {}) as $P | (.localPeerDependencies // {}) as $L | (.devDependencies // {}) | to_entries | map(select(.key as $K | $L | has($K) | not)) | map(.key + \"@\" + ($P[.key] // [\"latest\"])[0]) | join(\" \")') && [ ! -z \"$PACKAGES_TO_BUMP\" ] && npm install $PACKAGES_TO_BUMP || true",
"bump:prod": "PACKAGES_TO_BUMP=$(cat package.json | jq -r '(.pinDependencies // {}) as $P | (.localPeerDependencies // {}) as $L | (.dependencies // {}) | to_entries | map(select(.key as $K | $L | has($K) | not)) | map(.key + \"@\" + ($P[.key] // [\"latest\"])[0]) | join(\" \")') && [ ! -z \"$PACKAGES_TO_BUMP\" ] && npm install $PACKAGES_TO_BUMP || true",
"precommit": "eslint --ext .js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts ./",
"precommit": "ESLINT_USE_FLAT_CONFIG=false eslint --ext .js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts ./",
"switch": "cat package.json | jq --arg SWITCH_NAME $SWITCH_NAME -r '(.[\"switch:\" + $SWITCH_NAME] // {}) as $TEMPLATE | .devDependencies += ($TEMPLATE.devDependencies // {}) | .dependencies += ($TEMPLATE.dependencies // {})' | tee ./package.json.tmp && mv ./package.json.tmp ./package.json",
"test": "mocha --recursive"
},
Expand Down
3 changes: 3 additions & 0 deletions packages/integration-test/tsconfig.custom.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "@tsconfig/strictest/tsconfig.json"
}
7 changes: 7 additions & 0 deletions packages/integration-test/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// This configuration file is for VSCode only.
{
"compilerOptions": {
"jsx": "react"
},
"extends": "./tsconfig.custom.json"
}
Empty file.
2 changes: 2 additions & 0 deletions packages/iter-fest/.eslintrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
extends:
- ./.eslintrc.custom.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const run = ({ filename }) => {

const TS_EXPECT_ERROR = /(\/\/\s+)(@ts-expect-error)[\s+(.*)]/gu;
const TSCONFIG = {
allowImportingTsExtensions: true,
allowSyntheticDefaultImports: true,
jsx: typeScript.JsxEmit.React,
noEmit: true,
Expand Down
5 changes: 2 additions & 3 deletions packages/iter-fest/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -521,12 +521,11 @@
"typings": "./dist/iter-fest.d.ts",
"scripts": {
"build": "tsup",
"bump": "npm run bump:prod && npm run bump:dev && npm run bump:auditfix",
"bump:auditfix": "npm audit fix || exit 0",
"bump": "npm run bump:prod && npm run bump:dev",
"bump:dev": "PACKAGES_TO_BUMP=$(cat package.json | jq -r '(.pinDependencies // {}) as $P | (.localPeerDependencies // {}) as $L | (.devDependencies // {}) | to_entries | map(select(.key as $K | $L | has($K) | not)) | map(.key + \"@\" + ($P[.key] // [\"latest\"])[0]) | join(\" \")') && [ ! -z \"$PACKAGES_TO_BUMP\" ] && npm install $PACKAGES_TO_BUMP || true",
"bump:prod": "PACKAGES_TO_BUMP=$(cat package.json | jq -r '(.pinDependencies // {}) as $P | (.localPeerDependencies // {}) as $L | (.dependencies // {}) | to_entries | map(select(.key as $K | $L | has($K) | not)) | map(.key + \"@\" + ($P[.key] // [\"latest\"])[0]) | join(\" \")') && [ ! -z \"$PACKAGES_TO_BUMP\" ] && npm install $PACKAGES_TO_BUMP || true",
"precommit": "npm run precommit:eslint && npm run precommit:publint && npm run precommit:typescript:production && npm run precommit:typescript:test",
"precommit:eslint": "eslint ./src/",
"precommit:eslint": "ESLINT_USE_FLAT_CONFIG=false eslint ./src/",
"precommit:publint": "publint",
"precommit:typescript:production": "tsc --noEmit --project ./src/tsconfig.precommit.production.json",
"precommit:typescript:test": "tsc --noEmit --project ./src/tsconfig.precommit.test.json",
Expand Down
2 changes: 2 additions & 0 deletions packages/iter-fest/src/private/JestMockOf.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/// <reference types="jest" />

// eslint-disable-next-line @typescript-eslint/no-explicit-any
export type JestMockOf<T extends (this: any, ...args: any[]) => any> = jest.Mock<
ReturnType<T>,
Expand Down
3 changes: 3 additions & 0 deletions packages/iter-fest/src/tsconfig.custom.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "@tsconfig/strictest/tsconfig.json"
}
8 changes: 6 additions & 2 deletions packages/iter-fest/src/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@
"moduleResolution": "Bundler",
"noEmit": true,
"strict": true,
"target": "ESNext"
"target": "ESNext",
"types": [
"jest",
"node"
]
},
"extends": "@tsconfig/strictest/tsconfig.json"
"extends": "./tsconfig.custom.json"
}
Loading

0 comments on commit fdb3230

Please sign in to comment.