Skip to content

Commit

Permalink
Add prettier and esling config
Browse files Browse the repository at this point in the history
  • Loading branch information
jakubknejzlik committed Jun 11, 2024
1 parent f1ed6b8 commit 9953fb4
Show file tree
Hide file tree
Showing 6 changed files with 98 additions and 8 deletions.
10 changes: 10 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
root = true

[*]
end_of_line = lf
insert_final_newline = true

[*.{js,jsx,json,ts,tsx,cjs,mjs}]
charset = utf-8
indent_style = tab
indent_size=2
8 changes: 8 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
node_modules
coverage
.next
.open-next
.sst

package-lock.json

66 changes: 66 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
module.exports = {
extends: [
'plugin:react/recommended',
'plugin:@microsoft/eslint-plugin-sdl/node',
'plugin:@microsoft/eslint-plugin-sdl/common',
'plugin:@microsoft/eslint-plugin-sdl/react',
'plugin:security/recommended-legacy'
],
parserOptions: {
ecmaVersion: 13,
sourceType: 'module'
},
settings: {
react: {
version: '18.2'
}
},
plugins: [
'prettier',
'simple-import-sort',
'react-hooks',
'@microsoft/eslint-plugin-sdl'
],
rules: {
'prettier/prettier': 'error',
'react-hooks/exhaustive-deps': 'warn',
'react-hooks/rules-of-hooks': 'error',
'react/prop-types': ['off'],
'simple-import-sort/exports': 'error',
'simple-import-sort/imports': 'error',
'react/react-in-jsx-scope': 'off'
},
overrides: [
{
files: ['*.ts', '*.tsx'],
parser: '@typescript-eslint/parser',
extends: ['plugin:@microsoft/eslint-plugin-sdl/typescript'],
parserOptions: {
project: [
'./tsconfig.json',
'./services/**/tsconfig.json',
'./packages/**/tsconfig.json'
]
},
plugins: ['@typescript-eslint'],
rules: {
'@typescript-eslint/ban-ts-comment': [
'error',
{
'ts-expect-error': 'allow-with-description',
'ts-ignore': 'allow-with-description',
'ts-nocheck': true,
'ts-check': false
}
],
'@typescript-eslint/ban-types': ['off'],
'@typescript-eslint/explicit-function-return-type': 'error',
'@typescript-eslint/no-explicit-any': ['warn'],
'@typescript-eslint/no-unused-vars': 'error',
'@typescript-eslint/no-use-before-define': ['warn'],
'@typescript-eslint/no-non-null-assertion': ['warn'],
'@typescript-eslint/consistent-type-imports': 'error'
}
}
]
}
6 changes: 6 additions & 0 deletions prettier.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
semi: false,
singleQuote: true,
useTabs: true,
trailingComma: 'none'
}
4 changes: 2 additions & 2 deletions src/assistant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type OpenAI from 'openai'

import { getDefaultOpenAIClient } from './openai-client'

interface AssistantOptions {
export interface AssistantOpts {
id?: string
params?: Partial<OpenAI.Beta.Assistants.AssistantCreateParams>
client?: OpenAI
Expand All @@ -17,7 +17,7 @@ export class Assistant {

constructor(
public name: string,
opts: AssistantOptions = {}
opts: AssistantOpts = {}
) {
this.id = opts.id
this.client = opts.client || getDefaultOpenAIClient()
Expand Down
12 changes: 6 additions & 6 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export { Assistant } from "./assistant";
export { promptWithPick } from "./chains/prompt-with-pick";
export { promptWithRetry } from "./chains/prompt-with-retry";
export { createChatCompletionFunction } from "./function";
export { createOpenAIClient, getDefaultOpenAIClient } from "./openai-client";
export { Thread } from "./thread";
export { Assistant, AssistantOpts } from './assistant'
export { promptWithPick } from './chains/prompt-with-pick'
export { promptWithRetry } from './chains/prompt-with-retry'
export { createChatCompletionFunction } from './function'
export { createOpenAIClient, getDefaultOpenAIClient } from './openai-client'
export { Thread, ThreadPromptWithFunctionOpts } from './thread'

0 comments on commit 9953fb4

Please sign in to comment.