-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: move to full ESM, fully upgrade everything (#1)
- Loading branch information
Showing
16 changed files
with
4,514 additions
and
1,173 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
## Description | ||
|
||
Please include a summary of the changes and the related issue. | ||
|
||
## Related Issue | ||
|
||
Closes # (issue) | ||
|
||
## Type of change | ||
|
||
- [ ] Bug fix | ||
- [ ] New feature | ||
- [ ] Breaking change | ||
- [ ] Documentation update | ||
|
||
## Checklist | ||
|
||
- [ ] My code follows the style guidelines of this project | ||
- [ ] I have performed a self-review of my own code | ||
- [ ] I have made corresponding changes to the documentation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
20 | ||
22 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{ | ||
"exclude": "node_modules/", | ||
"jsc": { | ||
"parser": { | ||
"syntax": "typescript", | ||
"topLevelAwait": true | ||
}, | ||
"target": "esnext", | ||
"baseUrl": ".", | ||
"experimental": { | ||
"plugins": [ | ||
[ | ||
"@swc/plugin-transform-imports", | ||
{ | ||
"^(.*?)(\\.ts)$": { | ||
"skipDefaultConversion": true, | ||
"transform": "{{matches.[1]}}.js" | ||
} | ||
} | ||
] | ||
] | ||
} | ||
}, | ||
"module": { | ||
"type": "nodenext" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
import typescriptEslint from "@typescript-eslint/eslint-plugin"; | ||
import globals from "globals"; | ||
import tsParser from "@typescript-eslint/parser"; | ||
import path from "node:path"; | ||
import { fileURLToPath } from "node:url"; | ||
import js from "@eslint/js"; | ||
import { FlatCompat } from "@eslint/eslintrc"; | ||
|
||
const __filename = fileURLToPath(import.meta.url); | ||
const __dirname = path.dirname(__filename); | ||
const compat = new FlatCompat({ | ||
baseDirectory: __dirname, | ||
recommendedConfig: js.configs.recommended, | ||
allConfig: js.configs.all, | ||
}); | ||
|
||
export default [ | ||
{ | ||
ignores: ["**/dist/"], | ||
}, | ||
...compat.extends( | ||
"eslint:recommended", | ||
"plugin:@typescript-eslint/recommended", | ||
), | ||
{ | ||
plugins: { | ||
"@typescript-eslint": typescriptEslint, | ||
}, | ||
|
||
languageOptions: { | ||
globals: { | ||
...Object.fromEntries( | ||
Object.entries(globals.browser).map(([key]) => [key, "off"]), | ||
), | ||
}, | ||
|
||
parser: tsParser, | ||
ecmaVersion: "latest", | ||
sourceType: "module", | ||
}, | ||
|
||
rules: { | ||
indent: [ | ||
"error", | ||
2, | ||
{ | ||
offsetTernaryExpressions: true, | ||
}, | ||
], | ||
|
||
"linebreak-style": ["error", "unix"], | ||
quotes: ["error", "double"], | ||
semi: ["error", "always"], | ||
"comma-dangle": ["error", "always-multiline"], | ||
|
||
"@typescript-eslint/no-unused-vars": [ | ||
"error", | ||
{ | ||
varsIgnorePattern: "^_", | ||
}, | ||
], | ||
}, | ||
}, | ||
{ | ||
files: ["**/.eslintrc.{js,cjs}"], | ||
|
||
languageOptions: { | ||
globals: { | ||
...globals.node, | ||
}, | ||
|
||
ecmaVersion: 5, | ||
sourceType: "commonjs", | ||
}, | ||
}, | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,18 @@ | ||
import type { JestConfigWithTsJest } from "ts-jest"; | ||
|
||
const jestConfig: JestConfigWithTsJest = { | ||
preset: "ts-jest", | ||
preset: "ts-jest/presets/default-esm", // Use ESM-compatible preset | ||
extensionsToTreatAsEsm: [".ts"], // Treat these extensions as ESM | ||
transform: { | ||
"^.+\\.ts$": ["ts-jest", { useESM: true }], // Use ts-jest to handle TypeScript files with ESM | ||
}, | ||
testEnvironment: "node", // Use Node.js environment | ||
moduleNameMapper: { | ||
"^(\\.{1,2}/.*)\\.js$": "$1", // Map module paths correctly | ||
}, | ||
transformIgnorePatterns: [ | ||
"/node_modules/(?!chalk|ansi-escapes)", // Ensure node_modules are transformed correctly | ||
], | ||
}; | ||
|
||
export default jestConfig; |
Oops, something went wrong.