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
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
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
lts/*
22.13.1
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' }), {}),
},
]
})()
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>/' }),
}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"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",
Expand All @@ -39,7 +39,7 @@
"node": ">=18.0.0"
},
"dependencies": {
"eslint-config-txo-typescript": "^7.3.23",
"eslint-config-txo-typescript": "^7.4.15",
"eslint-config-txo-typescript-react": "^3.0.6"
},
"devDependencies": {
Expand Down
24 changes: 24 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,32 @@ const e2eConfigList = typescriptEslintConfig(
},
)

const jestConfigList = typescriptEslintConfig(
{
name: 'jest',
files: ['__tests__/**/*.ts', '__tests__/**/*.tsx'],
languageOptions: {
parserOptions: {
project: '__tests__/tsconfig.json',
},
},
settings: {
'import/resolver': {
typescript: {
project: '__tests__/tsconfig.json',
},
},
},
extends: [
jestConfig,
],
},
)

export const configList: TSESLint.FlatConfig.Config[] = [
...defaultConfigList,
...e2eConfigList,
...jestConfigList,
{
ignores: [
'.releaserc.js',
Expand All @@ -98,6 +121,7 @@ export const configList: TSESLint.FlatConfig.Config[] = [
'commitlint.config.js',
'coverage',
'eslint.config.js',
'eslint-ci.config.js',
'ios',
'jest.config.js',
'lib',
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.test.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"noEmit": true
"noEmit": true,
},
"include": [
"test/**/*"
Expand Down
Loading
Loading