Skip to content

Commit

Permalink
Merge branch 'main' into chore/additional-cockroachdb-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jkomyno committed Jun 4, 2022
2 parents d8b3f50 + 0f4f2ff commit cda37d5
Show file tree
Hide file tree
Showing 46 changed files with 835 additions and 359 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ byline.ts
prism.ts
charm.ts
pnpm-lock.yaml
generated-dmmf.ts

# client
packages/client/generator-build/
Expand Down
167 changes: 64 additions & 103 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,3 @@
const globby = require('globby')
const fs = require('fs')
const path = require('path')

const ignoreFiles = globby.sync('packages/*/.eslintignore')

const ignorePatterns = flatten(
flatten(
ignoreFiles.map((f) => {
const dir = path.dirname(f)
return fs
.readFileSync(f, 'utf-8')
.split('\n')
.filter((l) => l.trim().length > 0)
.map((l) => [l, `/${path.join(dir, l)}`])
}),
),
)

module.exports = {
root: true,
parser: '@typescript-eslint/parser',
Expand All @@ -25,102 +6,82 @@ module.exports = {
node: true,
es6: true,
},
extends: ['eslint:recommended', 'plugin:eslint-comments/recommended', 'plugin:jest/recommended'],
parserOptions: {
ecmaVersion: 2020,
sourceType: 'module',
project: ['./tsconfig.json', './packages/*/tsconfig.json'],
// debugLevel: true,
project: ['./tsconfig.json'],
},
ignorePatterns,
overrides: [
{
files: ['*.ts'],
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/recommended-requiring-type-checking',
'plugin:prettier/recommended',
'plugin:jest/recommended',
],
rules: {
'prettier/prettier': 'warn',
'@typescript-eslint/no-use-before-define': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'no-useless-escape': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-var-requires': 'off',
'@typescript-eslint/no-unsafe-return': 'off',
// added at 2020/11/26
'@typescript-eslint/no-unsafe-call': 'off',
'@typescript-eslint/no-unsafe-member-access': 'off',
'@typescript-eslint/no-unsafe-assignment': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/no-empty-function': 'off',
'eslint-comments/no-unlimited-disable': 'off',
'eslint-comments/disable-enable-pair': 'off',
'@typescript-eslint/no-misused-promises': 'off',
'jest/expect-expect': 'off',
'no-empty': 'off',
'no-restricted-properties': [
'error',
{
property: 'substr',
message: 'Deprecated: Use .slice() instead of .substr().',
},
],
'jest/valid-title': 'off',
'@typescript-eslint/no-unnecessary-type-assertion': 'off',
// low hanging fruits:
// to unblock eslint dep update in https://github.com/prisma/prisma/pull/9692
'@typescript-eslint/no-unsafe-argument': 'warn',
'@typescript-eslint/ban-types': 'off',
'@typescript-eslint/restrict-plus-operands': 'off',
'@typescript-eslint/restrict-template-expressions': 'off',
'jest/no-conditional-expect': 'off',
'jest/no-export': 'off',
'@typescript-eslint/no-empty-interface': 'off',
// Allow the `testIf`/`describeIf` pattern.
// TODO: it's not exactly correct to have `describeIf` in `additionalTestBlockFunctions`,
// but it's better than disabling the rule completely for files that need `describeIf`.
// Ideally, a new option like `additionalDescribeBlockFunctions` should be implemented in the rule.
'jest/no-standalone-expect': [
'error',
{
additionalTestBlockFunctions: ['testIf', 'describeIf'],
},
],
// https://github.com/lydell/eslint-plugin-simple-import-sort
'simple-import-sort/imports': 'error',
'simple-import-sort/exports': 'error',
'import/first': 'error',
'import/newline-after-import': 'error',
'import/no-duplicates': 'error',
},
},
],
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/recommended-requiring-type-checking',
'plugin:prettier/recommended',
'plugin:jest/recommended',
],
rules: {
'prettier/prettier': 'warn',
'@typescript-eslint/no-use-before-define': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'no-useless-escape': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-var-requires': 'off',
'@typescript-eslint/no-unsafe-return': 'off',
// added at 2020/11/26
'@typescript-eslint/no-unsafe-call': 'off',
'@typescript-eslint/no-unsafe-member-access': 'off',
'@typescript-eslint/no-unsafe-assignment': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/no-empty-function': 'off',
'eslint-comments/no-unlimited-disable': 'off',
'eslint-comments/disable-enable-pair': 'off',
'@typescript-eslint/no-misused-promises': 'off',
'jest/expect-expect': 'off',
'no-empty': 'off',
'no-restricted-properties': [
'error',
{
property: 'substr',
message: 'Deprecated: Use .slice() instead of .substr().',
},
],
'jest/valid-title': 'off',
'@typescript-eslint/no-unnecessary-type-assertion': 'off',
// low hanging fruits:
// to unblock eslint dep update in https://github.com/prisma/prisma/pull/9692
'@typescript-eslint/no-unsafe-argument': 'warn',
'@typescript-eslint/ban-types': 'off',
'@typescript-eslint/restrict-plus-operands': 'off',
'@typescript-eslint/restrict-template-expressions': 'off',
'jest/no-conditional-expect': 'off',
'jest/no-export': 'off',
'@typescript-eslint/no-empty-interface': 'off',
// Allow the `testIf`/`describeIf` pattern.
// TODO: it's not exactly correct to have `describeIf` in `additionalTestBlockFunctions`,
// but it's better than disabling the rule completely for files that need `describeIf`.
// Ideally, a new option like `additionalDescribeBlockFunctions` should be implemented in the rule.
'jest/no-standalone-expect': [
'error',
{
additionalTestBlockFunctions: ['testIf', 'describeIf'],
},
],
// https://github.com/lydell/eslint-plugin-simple-import-sort
'simple-import-sort/imports': 'error',
'simple-import-sort/exports': 'error',
'import/first': 'error',
'import/newline-after-import': 'error',
'import/no-duplicates': 'error',
},
settings: {
jest: {
version: 27,
},
},
}

function flatten(input) {
const stack = [...input]
const res = []
while (stack.length) {
// pop value from stack
const next = stack.pop()
if (Array.isArray(next)) {
// push back array items, won't modify the original input
stack.push(...next)
} else {
res.push(next)
}
}
// reverse to restore input order
return res.reverse()
}
2 changes: 1 addition & 1 deletion .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
steps:
- uses: actions/checkout@v3

- uses: pnpm/action-setup@v2.2.1
- uses: pnpm/action-setup@v2.2.2
with:
version: 6

Expand Down
20 changes: 10 additions & 10 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ jobs:
steps:
- uses: actions/checkout@v3

- uses: pnpm/action-setup@v2.2.1
- uses: pnpm/action-setup@v2.2.2
with:
version: 6

Expand Down Expand Up @@ -140,7 +140,7 @@ jobs:
- run: docker-compose -f docker/docker-compose.yml up --detach postgres postgres_isolated mysql mysql_isolated mssql mongo cockroachdb

- uses: pnpm/action-setup@v2.2.1
- uses: pnpm/action-setup@v2.2.2
with:
version: 6

Expand Down Expand Up @@ -194,7 +194,7 @@ jobs:
steps:
- uses: actions/checkout@v3

- uses: pnpm/action-setup@v2.2.1
- uses: pnpm/action-setup@v2.2.2
with:
version: 6

Expand Down Expand Up @@ -251,7 +251,7 @@ jobs:
- run: docker-compose -f docker/docker-compose.yml up --detach postgres mysql mariadb mssql

- uses: pnpm/action-setup@v2.2.1
- uses: pnpm/action-setup@v2.2.2
with:
version: 6

Expand Down Expand Up @@ -316,7 +316,7 @@ jobs:
run: |
echo "PRISMA_CLIENT_ENGINE_TYPE=${{ matrix.queryEngine }}" >> $GITHUB_ENV
- uses: pnpm/action-setup@v2.2.1
- uses: pnpm/action-setup@v2.2.2
with:
version: 6

Expand Down Expand Up @@ -378,7 +378,7 @@ jobs:
run: |
echo "PRISMA_CLIENT_ENGINE_TYPE=${{ matrix.queryEngine }}" >> $GITHUB_ENV
- uses: pnpm/action-setup@v2.2.1
- uses: pnpm/action-setup@v2.2.2
with:
version: 6

Expand Down Expand Up @@ -447,7 +447,7 @@ jobs:
run: |
echo "PRISMA_CLIENT_ENGINE_TYPE=${{ matrix.queryEngine }}" >> $GITHUB_ENV
- uses: pnpm/action-setup@v2.2.1
- uses: pnpm/action-setup@v2.2.2
with:
version: 6

Expand Down Expand Up @@ -494,7 +494,7 @@ jobs:
steps:
- uses: actions/checkout@v3

- uses: pnpm/action-setup@v2.2.1
- uses: pnpm/action-setup@v2.2.2
with:
version: 6

Expand Down Expand Up @@ -602,7 +602,7 @@ jobs:
- name: Set up MySQL
run: bash .github/workflows/scripts/setup-mysql.sh

- uses: pnpm/action-setup@v2.2.1
- uses: pnpm/action-setup@v2.2.2
with:
version: 6

Expand Down Expand Up @@ -773,7 +773,7 @@ jobs:
- name: Set up MySQL
run: bash .github/workflows/scripts/setup-mysql.sh

- uses: pnpm/action-setup@v2.2.1
- uses: pnpm/action-setup@v2.2.2
with:
version: 6

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/update-engines-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- uses: actions/checkout@v3

- uses: pnpm/action-setup@v2.2.1
- uses: pnpm/action-setup@v2.2.2
with:
version: 6

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/update-studio-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
steps:
- uses: actions/checkout@v3

- uses: pnpm/action-setup@v2.2.1
- uses: pnpm/action-setup@v2.2.2
with:
version: 6

Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"eslint-config-prettier": "8.5.0",
"eslint-plugin-eslint-comments": "3.2.0",
"eslint-plugin-import": "2.26.0",
"eslint-plugin-jest": "26.1.5",
"eslint-plugin-jest": "26.4.6",
"eslint-plugin-prettier": "4.0.0",
"eslint-plugin-simple-import-sort": "7.0.0",
"eventemitter3": "4.0.7",
Expand Down Expand Up @@ -83,7 +83,7 @@
"ts-node": "10.8.0",
"ts-toolbelt": "9.6.0",
"tty-browserify": "0.0.1",
"typescript": "4.6.4",
"typescript": "4.7.2",
"util": "0.12.4"
},
"lint-staged": {
Expand Down
14 changes: 7 additions & 7 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,18 +68,18 @@
"devDependencies": {
"@prisma/client": "workspace:*",
"@prisma/debug": "workspace:*",
"@prisma/fetch-engine": "3.15.0-11.1c05d2fd02981d04d5367319e82f44e1c44ec0b7",
"@prisma/fetch-engine": "3.15.0-28.436b66b7726f12400ec41433029e49d8c97f72f2",
"@prisma/generator-helper": "workspace:*",
"@prisma/get-platform": "3.15.0-11.1c05d2fd02981d04d5367319e82f44e1c44ec0b7",
"@prisma/get-platform": "3.15.0-28.436b66b7726f12400ec41433029e49d8c97f72f2",
"@prisma/migrate": "workspace:*",
"@prisma/sdk": "workspace:*",
"@prisma/studio": "0.460.0",
"@prisma/studio-server": "0.460.0",
"@prisma/studio": "0.462.0",
"@prisma/studio-server": "0.462.0",
"@swc/core": "1.2.189",
"@swc/jest": "0.2.21",
"@types/debug": "4.1.7",
"@types/fs-extra": "9.0.13",
"@types/jest": "27.5.0",
"@types/jest": "28.1.0",
"@types/rimraf": "3.0.2",
"@types/ws": "8.5.3",
"chalk": "4.1.2",
Expand Down Expand Up @@ -108,7 +108,7 @@
"strip-ansi": "6.0.1",
"tempy": "1.0.1",
"ts-pattern": "4.0.2",
"typescript": "4.6.4"
"typescript": "4.7.2"
},
"scripts": {
"dev": "DEV=true node -r esbuild-register helpers/build.ts",
Expand All @@ -120,7 +120,7 @@
"prepublishOnly": "pnpm run build"
},
"dependencies": {
"@prisma/engines": "3.15.0-11.1c05d2fd02981d04d5367319e82f44e1c44ec0b7"
"@prisma/engines": "3.15.0-28.436b66b7726f12400ec41433029e49d8c97f72f2"
},
"sideEffects": false
}
1 change: 0 additions & 1 deletion packages/cli/src/Generate.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable eslint-comments/disable-enable-pair, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-assignment, @typescript-eslint/restrict-template-expressions */
import { enginesVersion } from '@prisma/engines'
import { getSchemaPathAndPrint } from '@prisma/migrate'
import {
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/__tests__/commands/Version.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@ function cleanSnapshot(str: string, versionOverride?: string): string {
const currentEngineCommit = currentEngineVersion.split('.').pop().split('-').pop()
const defaultEngineVersion = packageJson.dependencies['@prisma/engines']
const defaultEngineHash = defaultEngineVersion.split('.').pop()
str = str.replace(new RegExp(currentEngineCommit, 'g'), 'ENGINE_VERSION')
str = str.replace(new RegExp(defaultEngineHash, 'g'), 'ENGINE_VERSION')
str = str.replace(new RegExp(currentEngineCommit, 'g'), 'ENGINE_VERSION')

// replace studio version
str = str.replace(packageJson.devDependencies['@prisma/studio-server'], 'STUDIO_VERSION')
Expand Down

0 comments on commit cda37d5

Please sign in to comment.