Skip to content

Commit 86a9163

Browse files
chore: upgrade deps, lint, node v26 support. (#55)
1 parent 2471371 commit 86a9163

43 files changed

Lines changed: 4989 additions & 1591 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.eslintrc.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"ignorePatterns": ["dist/**", "coverage/**", "node_modules/**"]
3+
}

.github/workflows/ci.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,19 @@ jobs:
1414
strategy:
1515
matrix:
1616
os: [ubuntu-latest, windows-latest]
17-
version: ['22.21.1', '24.11.1']
17+
version: ['22.21.1', '24.16.0', '26.2.0']
1818
runs-on: ${{ matrix.os }}
1919
steps:
2020
- name: Checkout
21-
uses: actions/checkout@v6.0.1
21+
uses: actions/checkout@v6.0.2
2222
- name: Setup Node
23-
uses: actions/setup-node@v6.2.0
23+
uses: actions/setup-node@v6.4.0
2424
with:
2525
node-version: ${{ matrix.version }}
2626
- name: Install Dependencies
2727
run: npm ci
2828
- name: Save error log
29-
uses: actions/upload-artifact@v6.0.0
29+
uses: actions/upload-artifact@v7.0.1
3030
if: ${{ failure() }}
3131
with:
3232
name: npm-debug-log-${{ hashFiles('package-lock.json') }}
@@ -40,7 +40,7 @@ jobs:
4040
- name: Test
4141
run: npm test
4242
- name: Report Coverage
43-
uses: codecov/codecov-action@v5.5.2
43+
uses: codecov/codecov-action@v6.0.1
4444
with:
4545
token: ${{ secrets.CODECOV_TOKEN }}
4646
- name: Pack

.github/workflows/publish.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@ jobs:
1414
runs-on: ubuntu-latest
1515
steps:
1616
- name: Checkout
17-
uses: actions/checkout@v6.0.1
17+
uses: actions/checkout@v6.0.2
1818
- name: Setup Node
19-
uses: actions/setup-node@v6.2.0
19+
uses: actions/setup-node@v6.4.0
2020
with:
21-
node-version: '24.11.1'
21+
node-version: '26.2.0'
2222
- name: Install Dependencies
2323
run: npm ci
2424
- name: Save error log
25-
uses: actions/upload-artifact@v6.0.0
25+
uses: actions/upload-artifact@v7.0.1
2626
if: ${{ failure() }}
2727
with:
2828
name: npm-debug-log-${{ hashFiles('package-lock.json') }}

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ By default `@knighted/module` transforms the one-to-one [differences between ES
2525

2626
## Requirements
2727

28-
- Node 22.21.1+ or 24+
28+
- Node >= 22.21.1 (<23), >= 24 (<25), or >= 26 (<27)
2929

3030
## Install
3131

@@ -222,4 +222,7 @@ dub -t commonjs "src/**/*.{ts,js,mts,cts}" --ignore node_modules/** --transform-
222222
tsc
223223
```
224224

225+
> [!NOTE]
226+
> With TypeScript 6+, when a `tsconfig.json` is present, `rootDir` defaults to `.`. If your config uses `outDir` and includes sources under `src`, set `"rootDir": "./src"` explicitly to avoid TS5011.
227+
225228
This pre-`tsc` step rewrites globals-only (keeps import/export syntax) so the TypeScript checker sees already-rewritten sources; runtime semantics still match the target build.

docs/cjs-to-esm.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
## Scope
44

55
- Rewrites CommonJS modules to ESM when `target: 'module'` with `transformSyntax` enabled.
6-
- Assumes Node 22.21+ runtime with native ESM.
6+
- Assumes a supported runtime from package engines: Node >= 22.21.1 (<23), >= 24 (<25), or >= 26 (<27), with native ESM.
77
- Skips lowering when `module` or `exports` are shadowed at module scope to avoid mis-compilation.
88
- Throws when encountering `with` statements or unshadowed `eval` to avoid unsound rewrites.
99
- Deprecated CJS features (`require.extensions`, `module.parent`, legacy folder-as-module resolution) are left as-is.

docs/cli.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Command-line wrapper around `@knighted/module` for transforming files between ES
77
88
## Requirements
99

10-
- Node >= 22.21.1 (or Node 24+)
10+
- Node >= 22.21.1 (<23), >= 24 (<25), or >= 26 (<27)
1111

1212
## Installation
1313

docs/esm-to-cjs.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
## Scope
44

55
- Translates ESM syntax to CommonJS when `target: 'commonjs'` with `transformSyntax` enabled.
6-
- Assumes Node 22.21+ runtime with `__filename`/`__dirname` shims supplied by the host (matches package engines).
6+
- Assumes a supported runtime from package engines: Node >= 22.21.1 (<23), >= 24 (<25), or >= 26 (<27), with `__filename`/`__dirname` shims supplied by the host.
77
- Keeps optional live-binding behavior via `liveBindings` (strict/loose/off).
88
- Top-level await (TLA) handling is controlled by `topLevelAwait: 'error' | 'wrap' | 'preserve'` when lowering to CommonJS.
99
- Optional import.meta.main gating via `importMetaMain: 'shim' | 'warn' | 'error'`.

eslint.config.js

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
import importPlugin from 'eslint-plugin-import'
2+
import tsParser from '@typescript-eslint/parser'
3+
4+
export default [
5+
{
6+
ignores: ['dist/**', 'coverage/**', 'node_modules/**'],
7+
linterOptions: {
8+
reportUnusedDisableDirectives: 'off',
9+
},
10+
},
11+
{
12+
files: ['**/*.ts'],
13+
languageOptions: {
14+
parser: tsParser,
15+
ecmaVersion: 'latest',
16+
sourceType: 'module',
17+
},
18+
settings: {
19+
'import/parsers': {
20+
'@typescript-eslint/parser': ['.ts'],
21+
},
22+
'import/resolver': {
23+
typescript: {
24+
project: './tsconfig.json',
25+
alwaysTryTypes: true,
26+
},
27+
node: {
28+
extensions: ['.js', '.mjs', '.cjs', '.ts'],
29+
},
30+
},
31+
},
32+
plugins: {
33+
import: importPlugin,
34+
},
35+
rules: {
36+
'import/order': [
37+
'error',
38+
{
39+
groups: ['builtin', 'external', 'internal', 'sibling', 'index', 'parent'],
40+
'newlines-between': 'always',
41+
alphabetize: { order: 'asc', caseInsensitive: true },
42+
},
43+
],
44+
},
45+
},
46+
{
47+
files: ['src/**/*.ts'],
48+
rules: {
49+
'import/no-unused-modules': [
50+
'error',
51+
{
52+
missingExports: true,
53+
unusedExports: true,
54+
src: ['src/**/*.ts', 'test/**/*.ts'],
55+
ignoreExports: ['src/specifier.ts', 'src/types.ts'],
56+
},
57+
],
58+
},
59+
},
60+
{
61+
files: ['test/fixtures/**'],
62+
rules: {
63+
'import/no-unused-modules': 'off',
64+
},
65+
},
66+
]

oxlint.json

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,13 @@
44
"rules": {
55
"no-console": "error",
66
"unicorn/filename-case": ["error", { "case": "camelCase" }],
7-
"@typescript-eslint/no-explicit-any": "error",
8-
"import/order": [
9-
"error",
10-
{
11-
"groups": ["builtin", "external", "internal", "parent", "sibling", "index"],
12-
"newlines-between": "always",
13-
"alphabetize": { "order": "asc", "caseInsensitive": true }
14-
}
15-
],
16-
"import/no-unused-modules": [
17-
"error",
18-
{ "missingExports": true, "unusedExports": true }
19-
]
7+
"@typescript-eslint/no-explicit-any": "error"
208
},
219
"overrides": [
2210
{
23-
"files": ["test/fixtures/**", "testing.*", "test/helpers/**"],
11+
"files": ["test/fixtures/**"],
2412
"rules": {
13+
"getter-return": "off",
2514
"no-unused-vars": "off",
2615
"no-unused-expressions": "off",
2716
"no-dupe-class-members": "off",
@@ -32,12 +21,6 @@
3221
"no-eval": "off"
3322
}
3423
},
35-
{
36-
"files": ["test/fixtures/identifiers/**"],
37-
"rules": {
38-
"no-unused-vars": "off"
39-
}
40-
},
4124
{
4225
"files": ["test/**", "!test/cli.ts"],
4326
"rules": {

0 commit comments

Comments
 (0)