Skip to content

Commit 804220e

Browse files
authored
chore: update eslint and sync boilerplate changes (#779)
1 parent cf0d8ab commit 804220e

File tree

15 files changed

+1205
-824
lines changed

15 files changed

+1205
-824
lines changed

.boilerplate-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
fbb58dd35ba36ecc8dad791268120463b53a6815
1+
81018841961fa40b00651c15444d45d4ca1018ce

.github/workflows/resolve-yarn-lock.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66

77
jobs:
88
resolve-yarn-lock-on-comment:
9-
name: '/'
9+
name: 'Resolve yarn.lock'
1010
if: contains(github.event.comment.body, '/resolve yarn.lock')
1111
uses: technology-studio/github-workflows/.github/workflows/_resolve-yarn-lock.yml@main
1212
secrets: inherit

.husky/pre-commit

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
yarn git-hook
2-
1+
yarn -s lint-staged

.husky/prepare-commit-msg

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
11
yarn commitlint --edit || exec < /dev/tty && yarn txo-cz --hook > /dev/null 2>&1 || true
2-

.vscode/launch.json

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,17 @@
88
"name": "Debug Jest Tests",
99
"type": "node",
1010
"request": "launch",
11-
"runtimeArgs": ["--inspect-brk", "${workspaceRoot}/node_modules/.bin/jest", "--runInBand", "--coverage", "false"],
11+
"runtimeArgs": ["--inspect-brk", "${workspaceRoot}/node_modules/.bin/jest", "--runInBand", "--coverage", "false", "${file}"],
12+
"console": "integratedTerminal",
13+
"internalConsoleOptions": "neverOpen"
14+
},
15+
{
16+
"name": "Debug Jest Tests with yarn",
17+
"type": "node",
18+
"request": "launch",
19+
"runtimeExecutable": "yarn",
20+
"args": ["test", "--runInBand", "--coverage=false", "${file}"],
21+
"runtimeArgs": ["--inspect-brk"],
1222
"console": "integratedTerminal",
1323
"internalConsoleOptions": "neverOpen"
1424
},

__tests__/Setup.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* @Copyright: Technology Studio
55
**/
66

7-
import './Config/LogConfig'
7+
import 'Config/LogConfig'
88

99
// Mock your external modules here if needed
1010
// jest

__tests__/tsconfig.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
{
22
"extends": "../tsconfig-base.json",
33
"compilerOptions": {
4+
"rootDir": "../",
5+
"baseUrl": "../",
6+
"paths": {
7+
"Config/*": ["./__tests__/Config/*"],
8+
"Data/*": ["./__tests__/Data/*"],
9+
"Utils/*": ["./__tests__/Utils/*"],
10+
"src": ["./src"],
11+
"src/*": ["./src/*"]
12+
}
413
},
514
"include": [
615
"./**/*.ts"

eslint-ci-rules.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
[
2+
"@typescript-eslint/no-magic-numbers",
3+
"@typescript-eslint/no-import-type-side-effects",
4+
"max-lines",
5+
"@typescript-eslint/no-unnecessary-condition",
6+
"@typescript-eslint/prefer-destructuring",
7+
"@typescript-eslint/no-unsafe-type-assertion",
8+
"max-nested-callbacks",
9+
"@stylistic/space-before-function-paren",
10+
"@stylistic/max-statements-per-line",
11+
"@stylistic/indent-binary-ops",
12+
"complexity",
13+
"logical-assignment-operators",
14+
"@typescript-eslint/max-params",
15+
"@typescript-eslint/init-declarations",
16+
"@stylistic/operator-linebreak",
17+
"@stylistic/arrow-parens",
18+
"@typescript-eslint/no-unnecessary-type-parameters",
19+
"@typescript-eslint/no-misused-spread",
20+
"@typescript-eslint/switch-exhaustiveness-check"
21+
]

eslint-ci.config.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
const ciRules = require('./eslint-ci-rules.json')
2+
3+
module.exports = (async function config() {
4+
const { default: defaultConfigPromise } = await import('./eslint.config.js')
5+
const defaultConfig = await defaultConfigPromise
6+
return [
7+
...defaultConfig,
8+
{
9+
files: ['**/*.ts', '**/*.tsx'],
10+
rules: ciRules.reduce((acc, rule) => ({ ...acc, [rule]: 'warn' }), {}),
11+
},
12+
]
13+
})()

eslint.config.js

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
const txoConfig = require('eslint-config-txo-typescript-react')
2-
3-
/** @type {import('eslint').Linter.FlatConfig[]} */
4-
const config = [
5-
...txoConfig.default,
6-
]
7-
8-
module.exports = config
1+
module.exports = (async function config() {
2+
const txoPackageConfigList = await import('eslint-config-txo-package-react')
3+
return txoPackageConfigList.configList
4+
})()

0 commit comments

Comments
 (0)