diff --git a/.github/workflows/dependabot-auto-merge.yml b/.github/workflows/auto-merge.yml similarity index 94% rename from .github/workflows/dependabot-auto-merge.yml rename to .github/workflows/auto-merge.yml index 2578d63af..9325d4c4c 100644 --- a/.github/workflows/dependabot-auto-merge.yml +++ b/.github/workflows/auto-merge.yml @@ -1,4 +1,4 @@ -name: pill-request-auto-merge +name: pull-request-auto-merge on: pull_request: diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1d4f26f3f..acd748743 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,7 +14,7 @@ jobs: build: strategy: matrix: - node-version: [20.x] + node-version: [22.x] runs-on: ubuntu-latest steps: @@ -34,7 +34,7 @@ jobs: cwd: ./example/app args: [--no-frozen-lockfile] package_json_file: example/app/package.json - + - name: Build (example/app) working-directory: example/app run: pnpm lint && pnpm build @@ -42,7 +42,7 @@ jobs: build-backend: strategy: matrix: - node-version: [20.x] + node-version: [22.x] runs-on: ubuntu-latest steps: @@ -62,10 +62,12 @@ jobs: cwd: ./package args: [--no-frozen-lockfile] package_json_file: package/package.json - + + - uses: oven-sh/setup-bun@v2 + - name: Build (package) working-directory: package - run: pnpm lint && pnpm build + run: bun run --bun lint && bun run --bun build - uses: pnpm/action-setup@v4 name: Install pnpm (example/app) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index e382f165c..ff47cc19e 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -24,7 +24,7 @@ jobs: test: strategy: matrix: - node-version: [20.x] + node-version: [22.x] runs-on: ubuntu-latest steps: diff --git a/.github/workflows/enable-auto-merge.yml b/.github/workflows/enable-auto-merge.yml deleted file mode 100644 index 98ac33d08..000000000 --- a/.github/workflows/enable-auto-merge.yml +++ /dev/null @@ -1,27 +0,0 @@ -name: enables auto merge - -on: - pull_request: - branches: - - main - -permissions: - id-token: write - contents: read - -jobs: - configure: - runs-on: ubuntu-latest - - if: github.actor != 'dependabot[bot]' - - steps: - - name: Pull request auto merge enabler - if: github.event_name == 'pull_request' - uses: poad/github-pull-request-auto-merge-enable-action@v2 - with: - pull_request_number: ${{ github.event.pull_request.number }} - github_token: ${{ secrets.PERSONAL_TOKEN_FOR_GITHUB_ACTIONS }} - repository: ${{ github.event.repository.name }} - owner: ${{ github.repository_owner }} - merge_method: SQUASH diff --git a/example/app/.prettierignore b/example/app/.prettierignore deleted file mode 100644 index fc6b86e7d..000000000 --- a/example/app/.prettierignore +++ /dev/null @@ -1,2 +0,0 @@ -*.d.ts -*.js diff --git a/example/app/.prettierrc.json b/example/app/.prettierrc.json deleted file mode 100644 index 1d94e832c..000000000 --- a/example/app/.prettierrc.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "semi": true, - "singleQuote": true, - "trailingComma": "all" -} \ No newline at end of file diff --git a/example/app/eslint.config.mjs b/example/app/eslint.config.js similarity index 81% rename from example/app/eslint.config.mjs rename to example/app/eslint.config.js index 62e828b07..bdfa62243 100644 --- a/example/app/eslint.config.mjs +++ b/example/app/eslint.config.js @@ -1,25 +1,29 @@ +// @ts-check + +import { includeIgnoreFile } from '@eslint/compat'; + import nextPlugin from '@next/eslint-plugin-next'; import reactPlugin from 'eslint-plugin-react'; import hooksPlugin from 'eslint-plugin-react-hooks'; +// @ts-expect-error ignore type error import importPlugin from 'eslint-plugin-import'; import stylistic from '@stylistic/eslint-plugin'; import stylisticTs from '@stylistic/eslint-plugin-ts'; import stylisticJsx from '@stylistic/eslint-plugin-jsx'; import tseslint from 'typescript-eslint'; +import path from "node:path"; +import { fileURLToPath } from "node:url"; + +const __filename = fileURLToPath(import.meta.url); +const __dirname = path.dirname(__filename); +const gitignorePath = path.resolve(__dirname, "./.gitignore"); + export default tseslint.config( + includeIgnoreFile(gitignorePath), ...tseslint.configs.strict, ...tseslint.configs.stylistic, { - ignores: [ - './.next/*', - '**/*.d.ts', - '*.js', - 'src/tsconfig.json', - 'src/next-env.d.ts', - 'src/stories', - 'node_modules/**/*', - ], languageOptions: { parser: tseslint.parser, }, diff --git a/example/app/next.config.js b/example/app/next.config.ts similarity index 59% rename from example/app/next.config.js rename to example/app/next.config.ts index 938b6ba9b..a42b574c3 100644 --- a/example/app/next.config.js +++ b/example/app/next.config.ts @@ -1,5 +1,6 @@ -/** @type {import('next').NextConfig} */ -const config = { +import { NextConfig } from "next"; + +const config: NextConfig = { output: 'export', reactStrictMode: true, swcMinify: true, @@ -9,4 +10,4 @@ const config = { }, }; -module.exports = config; +export default config; diff --git a/example/app/package.json b/example/app/package.json index 1d839a893..4815c6826 100644 --- a/example/app/package.json +++ b/example/app/package.json @@ -2,19 +2,14 @@ "name": "examples", "version": "0.1.0", "private": true, + "type": "module", "scripts": { "dev": "next dev", "build": "next build", "start": "pnpm dlx serve@latest out", "release": "next build", - "style:check": "prettier --write src", - "style:fix": "prettier --write src", - "eslint:check": "eslint './src/**/*.{ts,tsx}'", - "eslint:fix": "eslint './src/**/*.{ts,tsx}' --fix", - "lint": "pnpm run --parallel /^.*:check/", - "lint-fix": "pnpm run /^.*:fix/", - "prebuild": "pnpm lint-fix", - "prestart": "pnpm build" + "lint": "eslint", + "lint-fix": "eslint --fix" }, "dependencies": { "next": "^15.1.3", @@ -23,6 +18,7 @@ "web-vitals": "^4.2.4" }, "devDependencies": { + "@eslint/compat": "^1.2.4", "@stylistic/eslint-plugin": "^2.12.1", "@stylistic/eslint-plugin-js": "^2.12.1", "@stylistic/eslint-plugin-jsx": "^2.12.1", diff --git a/example/app/pnpm-lock.yaml b/example/app/pnpm-lock.yaml index c65da960b..a70ce560c 100644 --- a/example/app/pnpm-lock.yaml +++ b/example/app/pnpm-lock.yaml @@ -21,6 +21,9 @@ importers: specifier: ^4.2.4 version: 4.2.4 devDependencies: + '@eslint/compat': + specifier: ^1.2.4 + version: 1.2.4(eslint@9.17.0) '@stylistic/eslint-plugin': specifier: ^2.12.1 version: 2.12.1(eslint@9.17.0)(typescript@5.7.2) @@ -190,6 +193,15 @@ packages: resolution: {integrity: sha512-CCZCDJuduB9OUkFkY2IgppNZMi2lBQgD2qzwXkEia16cge2pijY/aXi96CJMquDMn3nJdlPV1A5KrJEXwfLNzQ==} engines: {node: ^12.0.0 || ^14.0.0 || >=16.0.0} + '@eslint/compat@1.2.4': + resolution: {integrity: sha512-S8ZdQj/N69YAtuqFt7653jwcvuUj131+6qGLUyDqfDg1OIoBQ66OCuXC473YQfO2AaxITTutiRQiDwoo7ZLYyg==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + peerDependencies: + eslint: ^9.10.0 + peerDependenciesMeta: + eslint: + optional: true + '@eslint/config-array@0.19.1': resolution: {integrity: sha512-fo6Mtm5mWyKjA/Chy1BYTdn5mGJoDNjC7C64ug20ADsRDGrA85bN3uK3MaKbeRkRuuIEAR5N33Jr1pbm411/PA==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} @@ -1803,6 +1815,10 @@ snapshots: '@eslint-community/regexpp@4.12.1': {} + '@eslint/compat@1.2.4(eslint@9.17.0)': + optionalDependencies: + eslint: 9.17.0 + '@eslint/config-array@0.19.1': dependencies: '@eslint/object-schema': 2.1.5 diff --git a/example/app/tsconfig.json b/example/app/tsconfig.json index 1a51dd784..1a9ddce4e 100644 --- a/example/app/tsconfig.json +++ b/example/app/tsconfig.json @@ -1,7 +1,7 @@ { "compilerOptions": { "target": "esnext", - "module": "commonjs", + "module": "esnext", "lib": [ "dom", "dom.iterable", diff --git a/example/cdk/eslint.config.mjs b/example/cdk/eslint.config.mjs deleted file mode 100644 index 0a4e3737f..000000000 --- a/example/cdk/eslint.config.mjs +++ /dev/null @@ -1,31 +0,0 @@ -import eslint from '@eslint/js'; -import plugin from '@stylistic/eslint-plugin'; -import stylistic from '@stylistic/eslint-plugin'; -import stylisticTs from '@stylistic/eslint-plugin-ts'; -import tseslint from 'typescript-eslint'; - -export default tseslint.config( - eslint.configs.recommended, - ...tseslint.configs.strict, - ...tseslint.configs.stylistic, - { - languageOptions: { - parser: tseslint.parser, - }, - files: ['**/*.ts'], - ignores: [ - '**/*.d.ts', - '*.js', - 'src/tsconfig.json', - 'src/next-env.d.ts', - 'src/stories', - 'node_modules/**/*', - ], - plugins: { - '@stylistic': stylistic, - '@stylistic/ts': stylisticTs, - }, - rules: { - }, - }, -); diff --git a/example/cdk/example-cdk.json b/example/cdk/example-cdk.json index 6f4a219a8..d5ef385b3 100644 --- a/example/cdk/example-cdk.json +++ b/example/cdk/example-cdk.json @@ -1,5 +1,5 @@ { - "app": "pnpx ts-node --prefer-ts-exts bin/github-oidc-proxy-example-cognito.ts", + "app": "pnpm dlx tsx bin/github-oidc-proxy-example-cognito.ts", "watch": { "include": [ "**" diff --git a/example/cdk/package.json b/example/cdk/package.json index 38bf5dc34..26956105f 100644 --- a/example/cdk/package.json +++ b/example/cdk/package.json @@ -1,6 +1,7 @@ { "name": "github-oidc-proxy-example-cognito", "version": "0.1.0", + "type": "module", "bin": { "cognito": "bin/github-oidc-proxy-example-cognito.js" }, @@ -10,10 +11,10 @@ "test": "jest", "cdk": "cdk", "lint": "eslint './{bin,lib}/**/*.ts'", - "lint-fix": "eslint './{bin,lib}/**/*.ts' --fix", - "prebuild": "pnpm lint-fix" + "lint-fix": "eslint './{bin,lib}/**/*.ts' --fix" }, "devDependencies": { + "@eslint/compat": "^1.2.4", "@stylistic/eslint-plugin": "^2.12.1", "@stylistic/eslint-plugin-js": "^2.12.1", "@stylistic/eslint-plugin-plus": "^2.12.1", diff --git a/example/cdk/pnpm-lock.yaml b/example/cdk/pnpm-lock.yaml index a43e1c45e..1a3196b9d 100644 --- a/example/cdk/pnpm-lock.yaml +++ b/example/cdk/pnpm-lock.yaml @@ -21,6 +21,9 @@ importers: specifier: ^0.5.21 version: 0.5.21 devDependencies: + '@eslint/compat': + specifier: ^1.2.4 + version: 1.2.4(eslint@9.17.0) '@stylistic/eslint-plugin': specifier: ^2.12.1 version: 2.12.1(eslint@9.17.0)(typescript@5.7.2) @@ -242,6 +245,15 @@ packages: resolution: {integrity: sha512-CCZCDJuduB9OUkFkY2IgppNZMi2lBQgD2qzwXkEia16cge2pijY/aXi96CJMquDMn3nJdlPV1A5KrJEXwfLNzQ==} engines: {node: ^12.0.0 || ^14.0.0 || >=16.0.0} + '@eslint/compat@1.2.4': + resolution: {integrity: sha512-S8ZdQj/N69YAtuqFt7653jwcvuUj131+6qGLUyDqfDg1OIoBQ66OCuXC473YQfO2AaxITTutiRQiDwoo7ZLYyg==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + peerDependencies: + eslint: ^9.10.0 + peerDependenciesMeta: + eslint: + optional: true + '@eslint/config-array@0.19.1': resolution: {integrity: sha512-fo6Mtm5mWyKjA/Chy1BYTdn5mGJoDNjC7C64ug20ADsRDGrA85bN3uK3MaKbeRkRuuIEAR5N33Jr1pbm411/PA==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} @@ -1422,6 +1434,10 @@ snapshots: '@eslint-community/regexpp@4.12.1': {} + '@eslint/compat@1.2.4(eslint@9.17.0)': + optionalDependencies: + eslint: 9.17.0 + '@eslint/config-array@0.19.1': dependencies: '@eslint/object-schema': 2.1.5 diff --git a/example/cdk/tsconfig.json b/example/cdk/tsconfig.json index 1c489cc12..048f897b7 100644 --- a/example/cdk/tsconfig.json +++ b/example/cdk/tsconfig.json @@ -1,7 +1,7 @@ { "compilerOptions": { "target": "esnext", - "module": "commonjs", + "module": "esnext", "lib": [ "esnext" ], @@ -19,6 +19,7 @@ "inlineSources": true, "experimentalDecorators": true, "strictPropertyInitialization": false, + "moduleResolution": "node", "typeRoots": [ "./node_modules/@types" ] diff --git a/package/.gitignore b/package/.gitignore index b857f0bd4..ad7cd2dd7 100644 --- a/package/.gitignore +++ b/package/.gitignore @@ -8,3 +8,4 @@ yarn-error.log .cdk.staging cdk.out *.pem +!eslint.config.js diff --git a/package/cdk.json b/package/cdk.json index 89c9b704b..84f3ee42f 100644 --- a/package/cdk.json +++ b/package/cdk.json @@ -1,5 +1,5 @@ { - "app": "test -e jwtRS256.private.pem || pnpm create-keypair --bits 4096 jwtRS256 && pnpm dlx ts-node --prefer-ts-exts bin/github-cognito-oidc-proxy.ts", + "app": "test -e jwtRS256.private.pem || pnpm create-keypair --bits 4096 jwtRS256 && pnpm dlx tsx bin/github-cognito-oidc-proxy.ts", "watch": { "include": [ "**" diff --git a/package/eslint.config.mjs b/package/eslint.config.js similarity index 67% rename from package/eslint.config.mjs rename to package/eslint.config.js index c2d1ecb55..ffc5b01e2 100644 --- a/package/eslint.config.mjs +++ b/package/eslint.config.js @@ -1,25 +1,29 @@ // @ts-check -import eslint from '@eslint/js'; - +import { includeIgnoreFile } from '@eslint/compat'; import stylistic from '@stylistic/eslint-plugin'; import stylisticTs from '@stylistic/eslint-plugin-ts'; import tseslint from 'typescript-eslint'; // @ts-expect-error ignore type error import importPlugin from 'eslint-plugin-import'; +import path from "node:path"; +import { fileURLToPath } from "node:url"; + +const __filename = fileURLToPath(import.meta.url); +const __dirname = path.dirname(__filename); +const gitignorePath = path.resolve(__dirname, "./.gitignore"); + export default tseslint.config( - eslint.configs.recommended, + includeIgnoreFile(gitignorePath), + { + files: [ + './{bin,lib,lambda}/**/*.ts', + ], + }, ...tseslint.configs.strict, ...tseslint.configs.stylistic, { - files: ['{bin,lib}/*.ts'], - ignores: [ - '*.d.ts', - 'node_modules/**/*', - 'out', - 'cdk.out', - ], ...importPlugin.flatConfigs.recommended, ...importPlugin.flatConfigs.typescript, settings: { diff --git a/package/package.json b/package/package.json index baa669b3d..36c4990e3 100644 --- a/package/package.json +++ b/package/package.json @@ -1,6 +1,7 @@ { "name": "@github-cognito-oidc-proxy/package", "version": "0.1.0", + "type": "module", "bin": { "github-cognito-oidc-proxy": "bin/github-cognito-oidc-proxy.js" }, @@ -9,13 +10,11 @@ "clean": "tsc --build --clean", "watch": "tsc -w", "cdk": "cdk", - "lint": "eslint './{lambda,bin,lib}/**/*.ts'", - "lint-fix": "eslint './{lambda,bin,lib}/**/*.ts' --fix", - "prebuild": "pnpm lint-fix", - "prelint": "pnpm clean", - "prelint-fix": "pnpm clean" + "lint": "eslint", + "lint-fix": "eslint --fix" }, "devDependencies": { + "@eslint/compat": "^1.2.4", "@middy/core": "^6.0.0", "@stylistic/eslint-plugin": "^2.12.1", "@stylistic/eslint-plugin-js": "^2.12.1", diff --git a/package/pnpm-lock.yaml b/package/pnpm-lock.yaml index a02973424..9b7b5b566 100644 --- a/package/pnpm-lock.yaml +++ b/package/pnpm-lock.yaml @@ -36,6 +36,9 @@ importers: specifier: ^0.5.21 version: 0.5.21 devDependencies: + '@eslint/compat': + specifier: ^1.2.4 + version: 1.2.4(eslint@9.17.0) '@middy/core': specifier: ^6.0.0 version: 6.0.0 @@ -277,6 +280,15 @@ packages: resolution: {integrity: sha512-CCZCDJuduB9OUkFkY2IgppNZMi2lBQgD2qzwXkEia16cge2pijY/aXi96CJMquDMn3nJdlPV1A5KrJEXwfLNzQ==} engines: {node: ^12.0.0 || ^14.0.0 || >=16.0.0} + '@eslint/compat@1.2.4': + resolution: {integrity: sha512-S8ZdQj/N69YAtuqFt7653jwcvuUj131+6qGLUyDqfDg1OIoBQ66OCuXC473YQfO2AaxITTutiRQiDwoo7ZLYyg==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + peerDependencies: + eslint: ^9.10.0 + peerDependenciesMeta: + eslint: + optional: true + '@eslint/config-array@0.19.1': resolution: {integrity: sha512-fo6Mtm5mWyKjA/Chy1BYTdn5mGJoDNjC7C64ug20ADsRDGrA85bN3uK3MaKbeRkRuuIEAR5N33Jr1pbm411/PA==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} @@ -1574,6 +1586,10 @@ snapshots: '@eslint-community/regexpp@4.12.1': {} + '@eslint/compat@1.2.4(eslint@9.17.0)': + optionalDependencies: + eslint: 9.17.0 + '@eslint/config-array@0.19.1': dependencies: '@eslint/object-schema': 2.1.5 diff --git a/package/tsconfig.json b/package/tsconfig.json index f2a504414..c24a24898 100644 --- a/package/tsconfig.json +++ b/package/tsconfig.json @@ -1,9 +1,9 @@ { "compilerOptions": { - "target": "ES2022", - "module": "commonjs", + "target": "esnext", + "module": "esnext", "lib": [ - "es2022", + "esnext", "dom" ], "declaration": true, @@ -20,6 +20,7 @@ "inlineSources": true, "experimentalDecorators": true, "strictPropertyInitialization": false, + "moduleResolution": "node", "typeRoots": [ "./node_modules/@types", "../node_modules/@types"