Skip to content

Commit 1fe8bd4

Browse files
Merge pull request #1319 from remarkablemark/fix/esm
2 parents b2f8642 + b1bf1d5 commit 1fe8bd4

27 files changed

Lines changed: 1566 additions & 264 deletions

.github/workflows/build.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,3 @@ jobs:
2222

2323
- name: Build package
2424
run: npm run build
25-
26-
- name: Lint package
27-
run: npm run lint:package

.github/workflows/lint.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,22 @@ jobs:
2020
- name: Install dependencies
2121
run: npm ci --prefer-offline
2222

23+
- name: Build package
24+
run: npm run build
25+
2326
- name: Run ESLint
2427
run: npm run lint
2528

2629
- name: Type check
2730
run: npm run lint:tsc
31+
32+
- name: Lint package
33+
run: npm run lint:package
34+
35+
- name: Check types
36+
run: |
37+
npx @arethetypeswrong/cli --pack
38+
if [[ "$(npx @arethetypeswrong/cli --pack -f json | jq '.problems != {}')" == 'true' ]]; then
39+
npx @arethetypeswrong/cli --pack -f json | jq
40+
exit 1
41+
fi

.github/workflows/test.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,10 @@ jobs:
2121
run: npm ci --prefer-offline
2222

2323
- name: Run server test
24-
run: npm run test:server
24+
run: npm run test:coverage
2525

2626
- name: Generate coverage report
27-
run: |
28-
mkdir -p coverage
29-
npx nyc report --reporter=text-lcov > coverage/lcov.info
27+
run: npx nyc report --reporter=text-lcov > coverage/lcov.info
3028

3129
- name: Upload coverage reports to Codecov
3230
uses: codecov/codecov-action@v5

eslint.config.mjs

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,47 @@
1-
import path from 'node:path';
21
import { fileURLToPath } from 'node:url';
32

43
import { includeIgnoreFile } from '@eslint/compat';
5-
import { FlatCompat } from '@eslint/eslintrc';
6-
import js from '@eslint/js';
7-
import typescriptEslint from '@typescript-eslint/eslint-plugin';
8-
import tsParser from '@typescript-eslint/parser';
4+
import eslint from '@eslint/js';
5+
import { defineConfig } from 'eslint/config';
96
import prettier from 'eslint-plugin-prettier';
107
import simpleImportSort from 'eslint-plugin-simple-import-sort';
8+
import tsdoc from 'eslint-plugin-tsdoc';
119
import globals from 'globals';
10+
import tseslint from 'typescript-eslint';
1211

13-
const __filename = fileURLToPath(import.meta.url);
14-
const __dirname = path.dirname(__filename);
15-
const gitignorePath = path.resolve(__dirname, '.gitignore');
12+
const gitignorePath = fileURLToPath(new URL('.gitignore', import.meta.url));
1613

17-
const compat = new FlatCompat({
18-
baseDirectory: __dirname,
19-
recommendedConfig: js.configs.recommended,
20-
allConfig: js.configs.all,
21-
});
22-
23-
export default [
14+
export default defineConfig([
2415
includeIgnoreFile(gitignorePath),
2516

26-
...compat.extends(
27-
'eslint:recommended',
28-
'plugin:@typescript-eslint/recommended',
29-
),
30-
3117
{
18+
files: ['**/*.{cjs,cts,js,jsx,mjs,mts,ts,tsx}'],
19+
3220
plugins: {
33-
'@typescript-eslint': typescriptEslint,
3421
'simple-import-sort': simpleImportSort,
22+
eslint,
3523
prettier,
24+
tsdoc,
3625
},
3726

27+
extends: [
28+
eslint.configs.recommended,
29+
tseslint.configs.recommended,
30+
tseslint.configs.recommendedTypeChecked,
31+
tseslint.configs.strictTypeChecked,
32+
tseslint.configs.stylisticTypeChecked,
33+
],
34+
3835
languageOptions: {
3936
globals: {
4037
...globals.browser,
4138
...globals.mocha,
4239
...globals.node,
4340
},
44-
parser: tsParser,
41+
parserOptions: {
42+
project: ['tsconfig.build.json', 'tsconfig.test.json'],
43+
tsconfigRootDir: import.meta.dirname,
44+
},
4545
},
4646

4747
rules: {
@@ -62,4 +62,4 @@ export default [
6262
'@typescript-eslint/no-require-imports': 'off',
6363
},
6464
},
65-
];
65+
]);

karma.conf.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
/**
22
* @see https://karma-runner.github.io/6.4/config/configuration-file.html
3+
*
4+
* @param {{LOG_INFO: string; set: () => void}} config
35
*/
46
module.exports = (config) => {
57
config.set({

0 commit comments

Comments
 (0)