Skip to content

Commit 996b395

Browse files
committed
feat: Update to Prisma v5
1 parent cd98f18 commit 996b395

25 files changed

+6485
-2454
lines changed

core/.eslintrc.js

+90
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
module.exports = {
2+
root: true,
3+
'env': {
4+
'browser': true,
5+
'es2021': true,
6+
},
7+
"settings": {
8+
"import/parsers": {
9+
"@typescript-eslint/parser": [".ts"]
10+
},
11+
"import/resolver": {
12+
"typescript": {},
13+
"node": {
14+
"moduleDirectory": ["node_modules", "./"]
15+
}
16+
},
17+
},
18+
'extends': [
19+
'plugin:@typescript-eslint/recommended',
20+
'airbnb',
21+
'plugin:@typescript-eslint/recommended-requiring-type-checking',
22+
"plugin:import/errors",
23+
"plugin:import/warnings",
24+
"plugin:import/typescript",
25+
],
26+
'parser': '@typescript-eslint/parser',
27+
'parserOptions': {
28+
'ecmaFeatures': {
29+
'jsx': false
30+
},
31+
'ecmaVersion': 'latest',
32+
'sourceType': 'module',
33+
'tsconfigRootDir': __dirname,
34+
'project': ['./tsconfig.json']
35+
},
36+
'plugins': [
37+
'@typescript-eslint',
38+
'import',
39+
],
40+
'rules': {
41+
'semi': 'off',
42+
'@typescript-eslint/semi': ['error'],
43+
'linebreak-style': 'off',
44+
'no-unused-vars': 'off',
45+
'@typescript-eslint/no-unused-vars': ['error'],
46+
'import/extensions': [
47+
'error',
48+
{
49+
'js': 'never',
50+
'ts': 'never',
51+
'json': 'always',
52+
}
53+
],
54+
'no-nested-ternary': 'off',
55+
"object-curly-newline": ["error", {
56+
"ImportDeclaration": "never",
57+
}],
58+
'import/order': 'off',
59+
"import/no-unresolved": "error",
60+
"import/no-named-default": "off",
61+
"no-console": ["warn", { allow: ["warn", "error"] }],
62+
"@typescript-eslint/no-inferrable-types": "off",
63+
"@typescript-eslint/no-misused-promises": [
64+
"error",
65+
{
66+
"checksVoidReturn": {
67+
"properties": false,
68+
"attributes": false
69+
}
70+
}
71+
],
72+
"@typescript-eslint/no-floating-promises": [
73+
"error",
74+
{ ignoreIIFE: true }
75+
],
76+
"max-len": ["error", {
77+
"code": 100,
78+
"ignoreComments": true,
79+
"ignoreStrings": true,
80+
"ignoreTemplateLiterals": true,
81+
}],
82+
"prefer-promise-reject-errors": 'off',
83+
'comma-dangle': 'off',
84+
'eol-last': 'off',
85+
"no-use-before-define": "off",
86+
"@typescript-eslint/no-use-before-define": ["error"],
87+
'no-plusplus': 'off',
88+
"no-restricted-syntax": "off"
89+
},
90+
};

core/src/index.ts

+8
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
import ExpectedError from './utils/ExpectedError';
2+
import pad from './utils/pad';
3+
4+
export {
5+
ExpectedError,
6+
pad,
7+
};
8+
19
export const LANGUAGES = ['en', 'fr'] as const;
210
export const DEFAULT_LANGUAGE = LANGUAGES[0];
311
export type Language = typeof LANGUAGES[number];

core/src/utils/ExpectedError.ts

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
class ExpectedError extends Error {
2+
constructor(message = '') {
3+
super(message);
4+
}
5+
}
6+
7+
export default ExpectedError;

core/src/utils/pad.ts

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/**
2+
* Pad a number
3+
* @param n Nmber to pad
4+
* @param width Pad width
5+
* @param z Fill character
6+
* @returns Padded number
7+
*/
8+
const pad = (n: number, width: number, z = '0') => {
9+
const nString = `${n}`;
10+
return nString.length >= width
11+
? nString
12+
: new Array(width - nString.length + 1).join(z) + n.toString();
13+
};
14+
15+
export default pad;

0 commit comments

Comments
 (0)