Skip to content

Commit c2cb26e

Browse files
committed
chore: update project tooling
- Upgrade to eslint 10 - Replace ncc with rollup - Make project ESM only
1 parent 6ca41c5 commit c2cb26e

14 files changed

+3405
-7443
lines changed

eslint.config.mjs

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,15 @@
11
// See: https://eslint.org/docs/latest/use/configure/configuration-files
22

3-
import path from 'node:path'
4-
import url from 'node:url'
5-
import globals from 'globals'
6-
73
import { FlatCompat } from '@eslint/eslintrc'
84
import js from '@eslint/js'
9-
105
import typescriptParser from '@typescript-eslint/parser'
11-
import typescriptPlugin from '@typescript-eslint/eslint-plugin'
6+
import typescriptEslint from '@typescript-eslint/eslint-plugin'
127
import jest from 'eslint-plugin-jest'
138
import prettier from 'eslint-plugin-prettier'
9+
import globals from 'globals'
1410

15-
const __filename = url.fileURLToPath(import.meta.url)
16-
const __dirname = path.dirname(__filename)
1711
const compat = new FlatCompat({
18-
baseDirectory: __dirname,
12+
baseDirectory: import.meta.dirname,
1913
recommendedConfig: js.configs.recommended,
2014
allConfig: js.configs.all
2115
})
@@ -35,7 +29,7 @@ export default [
3529
plugins: {
3630
jest,
3731
prettier,
38-
'@typescript-eslint': typescriptPlugin
32+
'@typescript-eslint': typescriptEslint
3933
},
4034

4135
languageOptions: {
@@ -51,16 +45,24 @@ export default [
5145
sourceType: 'module',
5246

5347
parserOptions: {
54-
project: ['tsconfig.eslint.json'],
55-
tsconfigRootDir: '.'
48+
projectService: {
49+
allowDefaultProject: [
50+
'__fixtures__/*.ts',
51+
'__tests__/*.ts',
52+
'eslint.config.mjs',
53+
'jest.config.js',
54+
'rollup.config.ts'
55+
]
56+
},
57+
tsconfigRootDir: import.meta.dirname
5658
}
5759
},
5860

5961
settings: {
6062
'import/resolver': {
6163
typescript: {
6264
alwaysTryTypes: true,
63-
project: 'tsconfig.eslint.json'
65+
project: 'tsconfig.json'
6466
}
6567
}
6668
},

jest.config.js

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
// See: https://jestjs.io/docs/configuration
2+
3+
/** @type {import('ts-jest').JestConfigWithTsJest} **/
4+
export default {
5+
clearMocks: true,
6+
collectCoverage: true,
7+
collectCoverageFrom: ['./src/**'],
8+
coverageDirectory: './coverage',
9+
coveragePathIgnorePatterns: ['/node_modules/', '/dist/'],
10+
coverageReporters: ['json-summary', 'text', 'lcov'],
11+
// Uncomment the below lines if you would like to enforce a coverage threshold
12+
// for your action. This will fail the build if the coverage is below the
13+
// specified thresholds.
14+
// coverageThreshold: {
15+
// global: {
16+
// branches: 100,
17+
// functions: 100,
18+
// lines: 100,
19+
// statements: 100
20+
// }
21+
// },
22+
extensionsToTreatAsEsm: ['.ts'],
23+
moduleFileExtensions: ['ts', 'js'],
24+
preset: 'ts-jest',
25+
reporters: ['default'],
26+
resolver: 'ts-jest-resolver',
27+
testEnvironment: 'node',
28+
testMatch: ['**/*.test.ts'],
29+
testPathIgnorePatterns: ['/dist/', '/node_modules/'],
30+
transform: {
31+
'^.+\\.ts$': [
32+
'ts-jest',
33+
{
34+
tsconfig: 'tsconfig.json',
35+
useESM: true
36+
}
37+
]
38+
},
39+
verbose: true
40+
}

jest.config.json

Lines changed: 0 additions & 15 deletions
This file was deleted.

0 commit comments

Comments
 (0)