Skip to content
Open
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
1 change: 1 addition & 0 deletions .boilerplate-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
d769f2d57af542dd1ef245dc3594d9e5ac6e31dc
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ on:

jobs:
release:
name: '/'
name: 'Release'
uses: technology-studio/github-workflows/.github/workflows/_release.yml@main
secrets: inherit
3 changes: 3 additions & 0 deletions .ncurc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"dep": "dev,prod,peer"
}
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
lts/*
22.13.1
6 changes: 3 additions & 3 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"name": "Debug Jest Tests",
"type": "node",
"request": "launch",
"runtimeArgs": [ "--inspect-brk", "${workspaceRoot}/node_modules/.bin/jest", "--runInBand", "--coverage", "false", "${file}" ],
"runtimeArgs": ["--inspect-brk", "${workspaceRoot}/node_modules/.bin/jest", "--runInBand", "--coverage", "false", "${file}"],
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen"
},
Expand All @@ -17,8 +17,8 @@
"type": "node",
"request": "launch",
"runtimeExecutable": "yarn",
"args": [ "test", "--runInBand", "--coverage=false", "${file}" ],
"runtimeArgs": [ "--inspect-brk" ],
"args": ["test", "--runInBand", "--coverage=false", "${file}"],
"runtimeArgs": ["--inspect-brk"],
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen"
},
Expand Down
2 changes: 0 additions & 2 deletions __tests__/Tests/Lint.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import { ESLint } from 'eslint'
test('shoud not have lint issues', async () => {
const eslint = new ESLint()
const results = await eslint.lintFiles(['test/**/*.tsx'])
// eslint-disable-next-line @typescript-eslint/no-magic-numbers -- result should have no errors
const isWithoutError = results.every((result: { errorCount: number }) => result.errorCount === 0)
expect(isWithoutError).toBe(true)
// eslint-disable-next-line @typescript-eslint/no-magic-numbers -- we want to make the timeout longer
}, 20000)
7 changes: 7 additions & 0 deletions __tests__/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"paths": {
"Config/*": [ "./__tests__/Config/*" ],
"Data/*": [ "./__tests__/Data/*" ],
"Utils/*": [ "./__tests__/Utils/*" ],
"src": [ "./src" ],
"src/*": [ "./src/*" ]
}
},
"include": [
"./**/*.ts"
Expand Down
1 change: 1 addition & 0 deletions eslint-ci-rules.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[]
13 changes: 13 additions & 0 deletions eslint-ci.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import ciRules from './eslint-ci-rules.json' with { type: 'json' }

export default (async function config() {
const { default: defaultConfigPromise } = await import('./eslint.config.js')
const defaultConfig = await defaultConfigPromise
return [
...defaultConfig,
{
files: ['**/*.ts', '**/*.tsx'],
rules: ciRules.reduce((acc, rule) => ({ ...acc, [rule]: 'warn' }), {}),
},
]
})()
14 changes: 13 additions & 1 deletion eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {
typescriptConfigList,
jestConfig,
stylisticConfig,
typescriptConfigList,
typescriptEslintConfig
} from 'eslint-config-txo-typescript'
import {
Expand All @@ -13,12 +14,23 @@ export default typescriptEslintConfig(
files: ['**/*.ts', '**/*.tsx'],
extends: [
...typescriptConfigList,
// TODO: remove after migrating to prettier
stylisticConfig,
reactConfig,
]
},
{
files: ['__tests__/**/*.ts', '__tests__/**/*.tsx'],
extends: [
jestConfig,
]
},
{
ignores: [
'commitlint.config.js',
'jest.config.js',
'.releaserc.js',
'eslint.config.js',
'coverage',
'lib',
'node_modules',
Expand Down
4 changes: 4 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@
* @Copyright: Technology Studio
**/

import { pathsToModuleNameMapper } from 'ts-jest'
import { defaults } from 'jest-config'

import tsconfig from './__tests__/tsconfig.json' with { type: 'json' }

export default {
preset: 'ts-jest',
cache: true,
Expand All @@ -28,4 +31,5 @@ export default {
tsconfig: '<rootDir>/__tests__/tsconfig.json'
}]
},
moduleNameMapper: pathsToModuleNameMapper(tsconfig.compilerOptions.paths, { prefix: '<rootDir>/' }),
}
14 changes: 9 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,26 @@
"build:lib": "yarn tsc",
"build:watch": "yarn tsc --watch",
"build": "yarn build:clean && yarn build:lib",
"compare-boilerplate-version": "./scripts/compare-boilerplate-version.sh",
"coverage": "jest --coverage && open coverage/lcov-report/index.html || xdg-open coverage/lcov-report/index.html",
"lint:ci": "yarn lint",
"lint:ci": "yarn eslint -c eslint-ci.config.js --cache . && yarn txo-eslint ccr --cache",
"lint:fix": "eslint . --fix",
"lint": "eslint --max-warnings 0 .",
"prepare": "husky && yarn build",
"sanity": "yarn build && yarn lint:ci && tsc --noEmit && yarn test --coverage && echo 'success'",
"print-txo-packages": "yarn list 2> /dev/null|grep @txo|sed 's/.*\\(@txo[^@]*\\)@^*\\([^ ]*\\).*/\\1@\\2/g'|sort|uniq",
"sanity": "yarn build && yarn lint:ci && tsc --noEmit && yarn test --coverage && yarn compare-boilerplate-version && echo 'success'",
"semantic-release": "semantic-release",
"test:watch": "concurrently \"yarn build:watch\" \"yarn test --watch\"",
"test": "node --experimental-vm-modules node_modules/jest/bin/jest.js",
"type-check": "tsc --noEmit"
"type-check": "tsc --noEmit",
"update-boilerplate-version": "./scripts/update-boilerplate-version.sh"
},
"engines": {
"node": ">=18.0.0"
},
"dependencies": {
"eslint-plugin-jsx-a11y": "^6.10.2",
"eslint-plugin-react": "^7.37.2",
"eslint-plugin-react": "^7.37.4",
"eslint-plugin-react-hooks": "^5.1.0"
},
"devDependencies": {
Expand All @@ -47,10 +50,11 @@
"@types/eslint": "^9.6.1",
"@types/jest": "^29.5.14",
"@types/react": "^18.3.24",
"eslint-config-txo-typescript": "^7.3.8",
"eslint-config-txo-typescript": "^7.4.10",
"husky": "^9.1.7",
"jest": "^29.7.0",
"lint-staged": "^16.1.6",
"npm-check-updates": "^17.1.14",
"react": "^18.3.1",
"rimraf": "^6.0.1",
"ts-jest": "^29.4.4",
Expand Down
14 changes: 14 additions & 0 deletions scripts/compare-boilerplate-version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env bash

LATEST=$(
git ls-remote -h git@github.com:technology-studio/test-boilerplate-typescript.git |
grep refs/heads/master | awk '{ print $1 }'
)
CURRENT=$(cat .boilerplate-version)
echo "Latest version: $LATEST"
echo "Current version: $CURRENT"
if [ "$LATEST" != "$CURRENT" ]; then
echo "🚫 Boilerplate versions do not match! Check test-boilerplate-typescript repo for new changes."
exit 1
fi
echo "✅ Boilerplate versions match!"
8 changes: 8 additions & 0 deletions scripts/update-boilerplate-version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash

LATEST=$(
git ls-remote -h git@github.com:technology-studio/test-boilerplate-typescript.git |
grep refs/heads/master | awk '{ print $1 }'
)
echo $LATEST > .boilerplate-version
echo "Updated boilerplate version to: $LATEST"
1 change: 0 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ export const reactConfig: Linter.Config = {
plugins: {
'jsx-a11y': eslintPluginJsxA11y,
'react-hooks': eslintPluginReactHooks,
// @ts-expect-error -- TODO: eslint-plugin-react has broken types, remove when new version is published - https://github.com/jsx-eslint/eslint-plugin-react/pull/3840
'react': eslintPluginReact,
},
}
3 changes: 3 additions & 0 deletions tsconfig.base.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "@txo/tsconfig",
}
13 changes: 6 additions & 7 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
{
"extends": "@txo/tsconfig",
"extends": "./tsconfig.base.json",
"compilerOptions": {
"declaration": true,
"noEmit": false,
"outDir": "lib",
"typeRoots": [
"node_modules/@types",
"src/types"
]
"declaration": true,
"outDir": "./lib"
},
"include": [
"src/**/*"
],
"exclude": [
"node_modules"
]
}
Loading
Loading