Skip to content

Commit

Permalink
chore: fix builds/tests/eslint (#4780)
Browse files Browse the repository at this point in the history
* chore(deps): upgrade `typescript`

* chore(ts): don't exclude test files in tsconfig

* test: expect error when overriding `NODE_ENV`

* chore: remove unused import

* format

* chore: use pnpm@7 in action

* chore: fix eslint

* chore: remove pnpm from engines

* chore: fix configs/builds

* fix: make eslint works

* Update pnpm-lock.yaml

* fix: build failure

* fix: add react to paths

* ignore upstash for now

* add eslintignore, add a bunch of tsconfig.eslint.json

* ignore mikro orm for now

* Delete tsconfig.eslint.json

* Update package.json

* Update pnpm-lock.yaml

* move eslint back to package.json

* move eslintrc.js out

Co-authored-by: Thang Vu <thvu@hey.com>
Co-authored-by: Thang Vu <thang.vu@binance.com>
  • Loading branch information
3 people committed Sep 9, 2022
1 parent 44aaa6f commit 8104cb1
Show file tree
Hide file tree
Showing 36 changed files with 287 additions and 128 deletions.
27 changes: 27 additions & 0 deletions .eslintrc.js
@@ -0,0 +1,27 @@
const path = require("path")

module.exports = {
root: true,
parser: "@typescript-eslint/parser",
parserOptions: {
project: [path.resolve(__dirname, "./packages/**/tsconfig.eslint.json")],
},
extends: ["standard-with-typescript", "prettier"],
globals: {
localStorage: "readonly",
location: "readonly",
fetch: "readonly",
},
rules: {
camelcase: "off",
"@typescript-eslint/naming-convention": "off",
"@typescript-eslint/strict-boolean-expressions": "off",
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/restrict-template-expressions": "off",
},
plugins: ["jest"],
env: {
"jest/globals": true,
},
ignorePatterns: [".eslintrc.js"],
}
65 changes: 9 additions & 56 deletions package.json
Expand Up @@ -6,39 +6,41 @@
"scripts": {
"build:app": "turbo run build --filter=next-auth-app --include-dependencies",
"build": "turbo run build --filter=next-auth --filter=@next-auth/* --no-deps",
"lint": "turbo run lint --filter=!next-auth-docs --parallel",
"test": "turbo run test --concurrency=1 --filter=!@next-auth/pouchdb-adapter --filter=!@next-auth/mikro-orm-adapter --filter=!@next-auth/upstash-redis-adapter --filter=!next-auth-* --filter=[HEAD^1]",
"clean": "turbo run clean --no-cache",
"dev:app": "turbo run dev --parallel --continue --filter=next-auth-app...",
"dev:docs": "turbo run dev --filter=next-auth-docs",
"dev": "pnpm dev:app",
"email": "cd apps/dev && pnpm email",
"lint:fix": "turbo run lint -- --fix",
"lint": "turbo run lint --filter=!next-auth-docs",
"release": "release",
"test": "turbo run test --concurrency=1 --filter=!@next-auth/pouchdb-adapter --filter=!@next-auth/upstash-redis-adapter --filter=!@next-auth/mikro-orm-adapter --filter=!next-auth-* --filter=[HEAD^1]",
"version:pr": "node ./config/version-pr"
},
"devDependencies": {
"@actions/core": "^1.6.0",
"@balazsorban/monorepo-release": "0.0.4",
"@types/jest": "^28.1.3",
"@types/node": "^17.0.25",
"@typescript-eslint/eslint-plugin": "^5.10.2",
"@typescript-eslint/parser": "^4.33.0",
"eslint": "^7.32.0",
"eslint-config-prettier": "^8.3.0",
"eslint-config-standard-with-typescript": "^21.0.1",
"eslint-plugin-import": "^2.25.4",
"eslint-plugin-jest": "^25.3.0",
"eslint-plugin-jest": "^27.0.1",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^6.0.0",
"husky": "^7.0.4",
"prettier": "2.4.1",
"pretty-quick": "^3.1.2",
"semver": "7.3.5",
"stream-to-array": "2.3.0",
"ts-node": "10.5.0",
"turbo": "1.3.1",
"typescript": "^4.5.2"
"typescript": "4.7.4"
},
"engines": {
"node": "^12.19.0 || ^14.15.0 || ^16.13.0",
"pnpm": ">=6.32.3"
"node": "^12.19.0 || ^14.15.0 || ^16.13.0"
},
"prettier": {
"semi": false,
Expand All @@ -52,55 +54,6 @@
}
]
},
"eslintConfig": {
"parser": "@typescript-eslint/parser",
"extends": [
"standard-with-typescript",
"prettier"
],
"ignorePatterns": [
"node_modules",
"next-env.d.ts",
"types",
".next",
"dist",
"/core",
"/react.js"
],
"globals": {
"localStorage": "readonly",
"location": "readonly",
"fetch": "readonly"
},
"rules": {
"camelcase": "off",
"@typescript-eslint/naming-convention": "off",
"@typescript-eslint/strict-boolean-expressions": "off",
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/restrict-template-expressions": "off"
},
"overrides": [
{
"files": [
"./**/*test.js"
],
"env": {
"jest/globals": true
},
"extends": [
"plugin:jest/recommended"
],
"plugins": [
"jest"
]
}
]
},
"eslintIgnore": [
"./*.d.ts",
"**/tests",
"**/__tests__"
],
"packageManager": "pnpm@7.5.1",
"funding": [
{
Expand Down
8 changes: 8 additions & 0 deletions packages/adapter-dgraph/tsconfig.eslint.json
@@ -0,0 +1,8 @@
{
"extends": "./tsconfig.json",
"include": ["tests", "src"],
"exclude": [
"./*.js",
"./*.d.ts",
]
}
2 changes: 1 addition & 1 deletion packages/adapter-dgraph/tsconfig.json
@@ -1,5 +1,5 @@
{
"extends": "@next-auth/tsconfig/adapters.json",
"extends": "@next-auth/tsconfig/tsconfig.adapters.json",
"compilerOptions": {
"rootDir": "src",
"outDir": "dist"
Expand Down
8 changes: 8 additions & 0 deletions packages/adapter-dynamodb/tsconfig.eslint.json
@@ -0,0 +1,8 @@
{
"extends": "./tsconfig.json",
"include": ["tests", "src"],
"exclude": [
"./*.js",
"./*.d.ts",
]
}
2 changes: 1 addition & 1 deletion packages/adapter-dynamodb/tsconfig.json
@@ -1,5 +1,5 @@
{
"extends": "@next-auth/tsconfig/adapters.json",
"extends": "@next-auth/tsconfig/tsconfig.adapters.json",
"compilerOptions": {
"rootDir": "src",
"outDir": "dist"
Expand Down
8 changes: 8 additions & 0 deletions packages/adapter-fauna/tsconfig.eslint.json
@@ -0,0 +1,8 @@
{
"extends": "./tsconfig.json",
"include": ["tests", "src"],
"exclude": [
"./*.js",
"./*.d.ts",
]
}
2 changes: 1 addition & 1 deletion packages/adapter-fauna/tsconfig.json
@@ -1,5 +1,5 @@
{
"extends": "@next-auth/tsconfig/adapters.json",
"extends": "@next-auth/tsconfig/tsconfig.adapters.json",
"compilerOptions": {
"rootDir": "src",
"outDir": "dist"
Expand Down
8 changes: 8 additions & 0 deletions packages/adapter-firebase/tsconfig.eslint.json
@@ -0,0 +1,8 @@
{
"extends": "./tsconfig.json",
"include": ["tests", "src"],
"exclude": [
"./*.js",
"./*.d.ts",
]
}
5 changes: 3 additions & 2 deletions packages/adapter-firebase/tsconfig.json
@@ -1,10 +1,11 @@
{
"extends": "@next-auth/tsconfig/adapters.json",
"extends": "@next-auth/tsconfig/tsconfig.base.json",
"compilerOptions": {
"rootDir": "src",
"outDir": "dist",
"strict": true,
"noUncheckedIndexedAccess": true
"noUncheckedIndexedAccess": true,
"moduleResolution": "node"
},
"exclude": ["tests", "dist", "jest.config.js"]
}
8 changes: 8 additions & 0 deletions packages/adapter-mikro-orm/tsconfig.eslint.json
@@ -0,0 +1,8 @@
{
"extends": "./tsconfig.json",
"include": ["tests", "src"],
"exclude": [
"./*.js",
"./*.d.ts",
]
}
2 changes: 1 addition & 1 deletion packages/adapter-mikro-orm/tsconfig.json
@@ -1,5 +1,5 @@
{
"extends": "@next-auth/tsconfig/adapters.json",
"extends": "@next-auth/tsconfig/tsconfig.adapters.json",
"compilerOptions": {
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
Expand Down
8 changes: 8 additions & 0 deletions packages/adapter-mongodb/tsconfig.eslint.json
@@ -0,0 +1,8 @@
{
"extends": "./tsconfig.json",
"include": ["tests", "src"],
"exclude": [
"./*.js",
"./*.d.ts",
]
}
2 changes: 1 addition & 1 deletion packages/adapter-mongodb/tsconfig.json
@@ -1,5 +1,5 @@
{
"extends": "@next-auth/tsconfig/adapters.json",
"extends": "@next-auth/tsconfig/tsconfig.adapters.json",
"compilerOptions": {
"rootDir": "src",
"outDir": "dist"
Expand Down
8 changes: 8 additions & 0 deletions packages/adapter-neo4j/tsconfig.eslint.json
@@ -0,0 +1,8 @@
{
"extends": "./tsconfig.json",
"include": ["tests", "src"],
"exclude": [
"./*.js",
"./*.d.ts",
]
}
2 changes: 1 addition & 1 deletion packages/adapter-neo4j/tsconfig.json
@@ -1,5 +1,5 @@
{
"extends": "@next-auth/tsconfig/adapters.json",
"extends": "@next-auth/tsconfig/tsconfig.adapters.json",
"compilerOptions": {
"rootDir": "src",
"outDir": "dist"
Expand Down
8 changes: 8 additions & 0 deletions packages/adapter-pouchdb/tsconfig.eslint.json
@@ -0,0 +1,8 @@
{
"extends": "./tsconfig.json",
"include": ["tests", "src"],
"exclude": [
"./*.js",
"./*.d.ts",
]
}
2 changes: 1 addition & 1 deletion packages/adapter-pouchdb/tsconfig.json
@@ -1,5 +1,5 @@
{
"extends": "@next-auth/tsconfig/base.json",
"extends": "@next-auth/tsconfig/tsconfig.base.json",
"compilerOptions": {
"rootDir": "src",
"outDir": "dist",
Expand Down
2 changes: 1 addition & 1 deletion packages/adapter-prisma/tests/index.test.ts
@@ -1,8 +1,8 @@
import { randomUUID, runBasicTests } from "@next-auth/adapter-test"
import { PrismaClient } from "@prisma/client"
import { PrismaAdapter } from "../src"
const prisma = new PrismaClient()
import { ObjectId } from "mongodb"
const prisma = new PrismaClient()

runBasicTests({
adapter: PrismaAdapter(prisma),
Expand Down
8 changes: 8 additions & 0 deletions packages/adapter-prisma/tsconfig.eslint.json
@@ -0,0 +1,8 @@
{
"extends": "./tsconfig.json",
"include": ["tests", "src"],
"exclude": [
"./*.js",
"./*.d.ts",
]
}
2 changes: 1 addition & 1 deletion packages/adapter-prisma/tsconfig.json
@@ -1,5 +1,5 @@
{
"extends": "@next-auth/tsconfig/adapters.json",
"extends": "@next-auth/tsconfig/tsconfig.adapters.json",
"compilerOptions": {
"rootDir": "src",
"outDir": "dist"
Expand Down
8 changes: 8 additions & 0 deletions packages/adapter-sequelize/tsconfig.eslint.json
@@ -0,0 +1,8 @@
{
"extends": "./tsconfig.json",
"include": ["tests", "src"],
"exclude": [
"./*.js",
"./*.d.ts",
]
}
2 changes: 1 addition & 1 deletion packages/adapter-sequelize/tsconfig.json
@@ -1,5 +1,5 @@
{
"extends": "@next-auth/tsconfig/adapters.json",
"extends": "@next-auth/tsconfig/tsconfig.adapters.json",
"compilerOptions": {
"rootDir": "src",
"outDir": "dist"
Expand Down
8 changes: 8 additions & 0 deletions packages/adapter-typeorm-legacy/tsconfig.eslint.json
@@ -0,0 +1,8 @@
{
"extends": "./tsconfig.json",
"include": ["tests", "src"],
"exclude": [
"./*.js",
"./*.d.ts",
]
}
2 changes: 1 addition & 1 deletion packages/adapter-typeorm-legacy/tsconfig.json
@@ -1,5 +1,5 @@
{
"extends": "@next-auth/tsconfig/adapters.json",
"extends": "@next-auth/tsconfig/tsconfig.adapters.json",
"compilerOptions": {
"rootDir": "src",
"outDir": "dist",
Expand Down
8 changes: 8 additions & 0 deletions packages/adapter-upstash-redis/tsconfig.eslint.json
@@ -0,0 +1,8 @@
{
"extends": "./tsconfig.json",
"include": ["tests", "src"],
"exclude": [
"./*.js",
"./*.d.ts",
]
}
2 changes: 1 addition & 1 deletion packages/adapter-upstash-redis/tsconfig.json
@@ -1,5 +1,5 @@
{
"extends": "@next-auth/tsconfig/adapters.json",
"extends": "@next-auth/tsconfig/tsconfig.adapters.json",
"compilerOptions": {
"rootDir": "src",
"outDir": "dist"
Expand Down
16 changes: 3 additions & 13 deletions packages/next-auth/package.json
Expand Up @@ -38,16 +38,16 @@
},
"scripts": {
"build": "pnpm clean && pnpm build:js && pnpm build:css",
"build:js": "pnpm clean && pnpm generate-providers && pnpm tsc --project tsconfig.json && babel --config-file ./config/babel.config.js src --out-dir . --extensions \".tsx,.ts,.js,.jsx\"",
"clean": "rm -rf coverage client css utils providers core jwt react next index.d.ts index.js adapters.d.ts middleware.d.ts middleware.js",
"build:js": "pnpm generate-providers && tsc && babel --config-file ./config/babel.config.js src --out-dir . --extensions \".tsx,.ts,.js,.jsx\"",
"build:css": "postcss --config config/postcss.config.js src/**/*.css --base src --dir . && node config/wrap-css.js",
"dev": "pnpm clean && pnpm generate-providers && concurrently \"pnpm watch:css\" \"pnpm watch:ts\"",
"watch:ts": "pnpm tsc --project tsconfig.dev.json",
"watch:css": "postcss --config config/postcss.config.js --watch src/**/*.css --base src --dir .",
"test": "jest --config ./config/jest.config.js",
"prepublishOnly": "pnpm build",
"generate-providers": "node ./config/generate-providers.js",
"lint": "eslint src config"
"lint": "eslint src config tests"
},
"files": [
"lib",
Expand Down Expand Up @@ -128,15 +128,5 @@
},
"engines": {
"node": "^12.19.0 || ^14.15.0 || ^16.13.0"
},
"eslintConfig": {
"parserOptions": {
"project": "./tsconfig.eslint.json"
}
},
"eslintIgnore": [
"./*.d.ts",
"**/tests",
"**/__tests__"
]
}
}

0 comments on commit 8104cb1

Please sign in to comment.