ci(backend-review.yml): add linter step to the backend review workflow (#625)

* ci(backend-review.yml): add linter step to the backend review workflow

* chore(backend-review.yml): remove prettier from lint-action configuration

* chore: apply new linting workflow

* chore(lint-staged.config.js): reorder lint-staged tasks for JavaScript and TypeScript files

* chore(eslint): update ignorePatterns in .eslintrc.js
chore(lint-action): remove prettier option in backend-review.yml
chore(package.json): add lint and lint:fix scripts

* chore(lint-staged.config.js): remove prettier --write command for js, jsx, ts, tsx files

* chore(titleConvo.js): remove unnecessary console.log statement
chore(titleConvo.js): add missing comma in options object

* chore: apply linting to all files

* chore(lint-staged.config.js): update lint-staged configuration to include prettier formatting
This commit is contained in:
Danny Avila 2023-07-14 09:36:49 -04:00 committed by GitHub
parent 637bb6bc11
commit e5336039fc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
231 changed files with 1688 additions and 1526 deletions

View file

@ -40,7 +40,7 @@ function AnthropicOptions() {
update[param] = newValue;
setConversation((prevState) => ({
...prevState,
...update
...update,
}));
};
@ -63,14 +63,14 @@ function AnthropicOptions() {
showLabel={false}
className={cn(
cardStyle,
'min-w-48 z-50 flex h-[40px] w-48 flex-none items-center justify-center px-4 ring-0 hover:cursor-pointer hover:bg-slate-50 focus:ring-0 focus:ring-offset-0 data-[state=open]:bg-slate-50 dark:bg-gray-700 dark:hover:bg-gray-600 dark:data-[state=open]:bg-gray-600'
'min-w-48 z-50 flex h-[40px] w-48 flex-none items-center justify-center px-4 ring-0 hover:cursor-pointer hover:bg-slate-50 focus:ring-0 focus:ring-offset-0 data-[state=open]:bg-slate-50 dark:bg-gray-700 dark:hover:bg-gray-600 dark:data-[state=open]:bg-gray-600',
)}
/>
<Button
type="button"
className={cn(
cardStyle,
'min-w-4 z-50 flex h-[40px] flex-none items-center justify-center px-4 hover:bg-slate-50 focus:ring-0 focus:ring-offset-0 dark:hover:bg-gray-600'
'min-w-4 z-50 flex h-[40px] flex-none items-center justify-center px-4 hover:bg-slate-50 focus:ring-0 focus:ring-offset-0 dark:hover:bg-gray-600',
)}
onClick={triggerAdvancedMode}
>

View file

@ -36,7 +36,7 @@ function BingAIOptions({ show }) {
update[param] = newValue;
setConversation((prevState) => ({
...prevState,
...update
...update,
}));
};
@ -46,7 +46,7 @@ function BingAIOptions({ show }) {
'p-2 rounded-md min-w-[75px] font-normal bg-white/[.60] dark:bg-gray-700 text-black text-xs';
const defaultSelected = cn(
defaultClasses,
'font-medium data-[state=active]:text-white text-xs text-white'
'font-medium data-[state=active]:text-white text-xs text-white',
);
const selectedClass = (val) => val + '-tab ' + defaultSelected;
@ -69,7 +69,7 @@ function BingAIOptions({ show }) {
className={cn(
cardStyle,
'min-w-36 z-50 flex h-[40px] w-36 flex-none items-center justify-center px-4 ring-0 hover:cursor-pointer hover:bg-slate-50 focus:ring-0 focus:ring-offset-0 data-[state=open]:bg-slate-50 dark:bg-gray-700 dark:hover:bg-gray-600 dark:data-[state=open]:bg-gray-600',
show ? 'hidden' : null
show ? 'hidden' : null,
)}
/>
@ -113,7 +113,7 @@ function BingAIOptions({ show }) {
className={cn(
cardStyle,
'min-w-4 z-50 flex h-[40px] flex-none items-center justify-center px-4 hover:bg-slate-50 focus:ring-0 focus:ring-offset-0 dark:hover:bg-gray-600',
show ? 'hidden' : null
show ? 'hidden' : null,
)}
onClick={triggerAdvancedMode}
>

View file

@ -21,7 +21,7 @@ function ChatGPTOptions() {
update[param] = newValue;
setConversation((prevState) => ({
...prevState,
...update
...update,
}));
};
@ -38,7 +38,7 @@ function ChatGPTOptions() {
showLabel={false}
className={cn(
cardStyle,
'z-50 flex h-[40px] w-[260px] min-w-[260px] flex-none items-center justify-center px-4 ring-0 hover:cursor-pointer hover:bg-slate-50 focus:ring-0 focus:ring-offset-0 data-[state=open]:bg-slate-50 dark:bg-gray-700 dark:hover:bg-gray-600 dark:data-[state=open]:bg-gray-600'
'z-50 flex h-[40px] w-[260px] min-w-[260px] flex-none items-center justify-center px-4 ring-0 hover:cursor-pointer hover:bg-slate-50 focus:ring-0 focus:ring-offset-0 data-[state=open]:bg-slate-50 dark:bg-gray-700 dark:hover:bg-gray-600 dark:data-[state=open]:bg-gray-600',
)}
/>
</div>

View file

@ -44,7 +44,7 @@ function GoogleOptions() {
update[param] = newValue;
setConversation((prevState) => ({
...prevState,
...update
...update,
}));
};
@ -57,7 +57,7 @@ function GoogleOptions() {
update.examples = current;
setConversation((prevState) => ({
...prevState,
...update
...update,
}));
};
@ -68,7 +68,7 @@ function GoogleOptions() {
update.examples = current;
setConversation((prevState) => ({
...prevState,
...update
...update,
}));
};
@ -79,7 +79,7 @@ function GoogleOptions() {
update.examples = [{ input: { content: '' }, output: { content: '' } }];
setConversation((prevState) => ({
...prevState,
...update
...update,
}));
return;
}
@ -87,7 +87,7 @@ function GoogleOptions() {
update.examples = current;
setConversation((prevState) => ({
...prevState,
...update
...update,
}));
};
@ -111,14 +111,14 @@ function GoogleOptions() {
showLabel={false}
className={cn(
cardStyle,
'min-w-48 z-50 flex h-[40px] w-48 flex-none items-center justify-center px-4 ring-0 hover:cursor-pointer hover:bg-slate-50 focus:ring-0 focus:ring-offset-0 data-[state=open]:bg-slate-50 dark:bg-gray-700 dark:hover:bg-gray-600 dark:data-[state=open]:bg-gray-600'
'min-w-48 z-50 flex h-[40px] w-48 flex-none items-center justify-center px-4 ring-0 hover:cursor-pointer hover:bg-slate-50 focus:ring-0 focus:ring-offset-0 data-[state=open]:bg-slate-50 dark:bg-gray-700 dark:hover:bg-gray-600 dark:data-[state=open]:bg-gray-600',
)}
/>
<Button
type="button"
className={cn(
cardStyle,
'min-w-4 z-50 flex h-[40px] flex-none items-center justify-center px-4 hover:bg-slate-50 focus:ring-0 focus:ring-offset-0 dark:hover:bg-gray-600'
'min-w-4 z-50 flex h-[40px] flex-none items-center justify-center px-4 hover:bg-slate-50 focus:ring-0 focus:ring-offset-0 dark:hover:bg-gray-600',
)}
onClick={triggerAdvancedMode}
>
@ -156,7 +156,7 @@ function GoogleOptions() {
label: (showExamples ? 'Hide' : 'Show') + ' Examples',
buttonClass: isCodeChat ? 'disabled' : '',
handler: triggerExamples,
icon: <MessagesSquared className="mr-1 w-[14px]" />
icon: <MessagesSquared className="mr-1 w-[14px]" />,
}}
/>
<SaveAsPresetDialog

View file

@ -17,7 +17,7 @@ export default function ModelItem({ endpoint, value, isSelected }) {
endpoint,
error: false,
className: 'mr-2',
message: false
message: false,
});
const isUserProvided = endpointsConfig?.[endpoint]?.userProvide;
@ -29,7 +29,7 @@ export default function ModelItem({ endpoint, value, isSelected }) {
value={value}
className={cn(
'group dark:font-semibold dark:text-gray-100 dark:hover:bg-gray-800',
isSelected && 'dark:bg-gray-800 bg-gray-50 active'
isSelected && 'dark:bg-gray-800 bg-gray-50 active',
)}
id={endpoint}
>
@ -45,7 +45,7 @@ export default function ModelItem({ endpoint, value, isSelected }) {
<button
className={cn(
'invisible m-0 mr-1 flex-initial rounded-md p-0 text-xs font-medium text-gray-400 hover:text-gray-700 group-hover:visible dark:font-normal dark:text-gray-400 dark:hover:text-gray-200',
isSelected && 'visible text-gray-700 dark:text-gray-200'
isSelected && 'visible text-gray-700 dark:text-gray-200',
)}
onClick={(e) => {
e.preventDefault();

View file

@ -4,7 +4,13 @@ export default function EndpointItems({ endpoints, onSelect, selectedEndpoint })
return (
<>
{endpoints.map((endpoint) => (
<EndpointItem isSelected={selectedEndpoint === endpoint} key={endpoint} value={endpoint} onSelect={onSelect} endpoint={endpoint} />
<EndpointItem
isSelected={selectedEndpoint === endpoint}
key={endpoint}
value={endpoint}
onSelect={onSelect}
endpoint={endpoint}
/>
))}
</>
);

View file

@ -19,7 +19,7 @@ const FileUpload: React.FC<FileUploadProps> = ({
invalidText = null,
validator = null,
text = null,
id = '1'
id = '1',
}) => {
const [statusColor, setStatusColor] = useState<string>('text-gray-600');
const [status, setStatus] = useState<null | string>(null);
@ -52,7 +52,7 @@ const FileUpload: React.FC<FileUploadProps> = ({
htmlFor={`file-upload-${id}`}
className={cn(
'mr-1 flex h-auto cursor-pointer items-center rounded bg-transparent px-2 py-1 text-xs font-medium font-normal transition-colors hover:bg-slate-200 hover:text-green-700 dark:bg-transparent dark:text-gray-300 dark:hover:bg-gray-800 dark:hover:text-green-500',
statusColor
statusColor,
)}
>
<FileUp className="mr-1 flex w-[22px] items-center stroke-1" />

View file

@ -11,7 +11,7 @@ export default function PresetItem({ preset = {}, value, onChangePreset, onDelet
endpoint: preset?.endpoint,
model: preset?.model,
error: false,
className: 'mr-2'
className: 'mr-2',
});
const getPresetTitle = () => {
@ -28,7 +28,7 @@ export default function PresetItem({ preset = {}, value, onChangePreset, onDelet
} else if (endpoint === 'bingAI') {
const { jailbreak, toneStyle } = preset;
if (toneStyle) _title += `: ${toneStyle}`;
if (jailbreak) _title += ` as Sydney`;
if (jailbreak) _title += ' as Sydney';
} else if (endpoint === 'chatGPTBrowser') {
const { model } = preset;
if (model) _title += `: ${model}`;

View file

@ -20,7 +20,7 @@ import {
DropdownMenuTrigger,
DialogTemplate,
Dialog,
DialogTrigger
DialogTrigger,
} from '../../ui/';
import { cn } from '~/utils/';
@ -54,8 +54,8 @@ export default function NewConversationMenu() {
},
onError: (error) => {
console.error('Error uploading the preset:', error);
}
}
},
},
);
};
@ -79,7 +79,7 @@ export default function NewConversationMenu() {
const lastSelectedModel = JSON.parse(localStorage.getItem('lastSelectedModel')) || {};
localStorage.setItem(
'lastSelectedModel',
JSON.stringify({ ...lastSelectedModel, [endpoint]: conversation.model })
JSON.stringify({ ...lastSelectedModel, [endpoint]: conversation.model }),
);
localStorage.setItem('lastConversationSetup', JSON.stringify(conversation));
}
@ -89,7 +89,7 @@ export default function NewConversationMenu() {
const { jailbreak, toneStyle } = conversation;
localStorage.setItem(
'lastBingSettings',
JSON.stringify({ ...lastBingSettings, jailbreak, toneStyle })
JSON.stringify({ ...lastBingSettings, jailbreak, toneStyle }),
);
}
}, [conversation]);
@ -112,7 +112,7 @@ export default function NewConversationMenu() {
const currentConvo = getDefaultConversation({
conversation,
endpointsConfig,
preset: newPreset
preset: newPreset,
});
setConversation(currentConvo);
@ -145,7 +145,7 @@ export default function NewConversationMenu() {
...conversation,
isCreatedByUser: false,
error: false,
button: true
button: true,
});
return (
@ -155,7 +155,7 @@ export default function NewConversationMenu() {
<Button
id="new-conversation-menu"
variant="outline"
className={`group relative mb-[-12px] ml-0 mt-[-8px] items-center rounded-md border-0 p-1 outline-none focus:ring-0 focus:ring-offset-0 dark:data-[state=open]:bg-opacity-50 md:left-1 md:ml-[-12px] md:pl-1`}
className={'group relative mb-[-12px] ml-0 mt-[-8px] items-center rounded-md border-0 p-1 outline-none focus:ring-0 focus:ring-offset-0 dark:data-[state=open]:bg-opacity-50 md:left-1 md:ml-[-12px] md:pl-1'}
>
{icon}
<span className="max-w-0 overflow-hidden whitespace-nowrap px-0 text-slate-600 transition-all group-hover:max-w-[80px] group-hover:px-2 group-data-[state=open]:max-w-[80px] group-data-[state=open]:px-2 dark:text-slate-300">
@ -224,7 +224,7 @@ export default function NewConversationMenu() {
selection={{
selectHandler: clearAllPresets,
selectClasses: 'bg-red-600 hover:bg-red-700 dark:hover:bg-red-800 text-white',
selectText: 'Clear'
selectText: 'Clear',
}}
/>
</Dialog>
@ -234,7 +234,7 @@ export default function NewConversationMenu() {
onValueChange={onSelectPreset}
className={cn(
'overflow-y-auto overflow-x-hidden',
showEndpoints ? 'max-h-[210px]' : 'max-h-[315px]'
showEndpoints ? 'max-h-[210px]' : 'max-h-[315px]',
)}
>
{showPresets &&

View file

@ -23,7 +23,7 @@ function OpenAIOptions() {
temperature,
top_p,
presence_penalty,
frequency_penalty
frequency_penalty,
} = conversation;
const endpointsConfig = useRecoilValue(store.endpointsConfig);
@ -49,7 +49,7 @@ function OpenAIOptions() {
update[param] = newValue;
setConversation((prevState) => ({
...prevState,
...update
...update,
}));
};
@ -72,14 +72,14 @@ function OpenAIOptions() {
showLabel={false}
className={cn(
cardStyle,
'min-w-48 z-50 flex h-[40px] w-48 flex-none items-center justify-center px-4 ring-0 hover:cursor-pointer hover:bg-slate-50 focus:ring-0 focus:ring-offset-0 data-[state=open]:bg-slate-50 dark:bg-gray-700 dark:hover:bg-gray-600 dark:data-[state=open]:bg-gray-600'
'min-w-48 z-50 flex h-[40px] w-48 flex-none items-center justify-center px-4 ring-0 hover:cursor-pointer hover:bg-slate-50 focus:ring-0 focus:ring-offset-0 data-[state=open]:bg-slate-50 dark:bg-gray-700 dark:hover:bg-gray-600 dark:data-[state=open]:bg-gray-600',
)}
/>
<Button
type="button"
className={cn(
cardStyle,
'min-w-4 z-50 flex h-[40px] flex-none items-center justify-center px-4 hover:bg-slate-50 focus:ring-0 focus:ring-offset-0 dark:hover:bg-gray-600'
'min-w-4 z-50 flex h-[40px] flex-none items-center justify-center px-4 hover:bg-slate-50 focus:ring-0 focus:ring-offset-0 dark:hover:bg-gray-600',
)}
onClick={triggerAdvancedMode}
>

View file

@ -6,7 +6,7 @@ import {
PluginStoreDialog,
MultiSelectDropDown,
Button,
GPTIcon
GPTIcon,
} from '~/components';
import EndpointOptionsPopover from '../../Endpoints/EndpointOptionsPopover';
import SaveAsPresetDialog from '../../Endpoints/SaveAsPresetDialog';
@ -83,7 +83,7 @@ function PluginsOptions() {
update[param] = newValue;
setConversation((prevState) => ({
...prevState,
...update
...update,
}));
};
@ -94,7 +94,7 @@ function PluginsOptions() {
agentOptions[param] = newValue;
setConversation((prevState) => ({
...prevState,
agentOptions
agentOptions,
}));
};
@ -115,7 +115,7 @@ function PluginsOptions() {
localStorage.setItem('lastSelectedTools', JSON.stringify(update.tools));
setConversation((prevState) => ({
...prevState,
...update
...update,
}));
};
@ -143,14 +143,14 @@ function PluginsOptions() {
type="button"
className={cn(
cardStyle,
'min-w-4 z-40 flex h-[40px] flex-none items-center justify-center px-4 hover:bg-white focus:ring-0 focus:ring-offset-0 dark:hover:bg-gray-700'
'min-w-4 z-40 flex h-[40px] flex-none items-center justify-center px-4 hover:bg-white focus:ring-0 focus:ring-offset-0 dark:hover:bg-gray-700',
)}
onClick={() => setVisibility((prev) => !prev)}
>
<ChevronDownIcon
className={cn(
!visibile ? 'rotate-180 transform' : '',
'w-4 text-gray-600 dark:text-white'
'w-4 text-gray-600 dark:text-white',
)}
/>
</Button>
@ -175,7 +175,7 @@ function PluginsOptions() {
className={cn(
cardStyle,
'min-w-4 z-50 flex h-[40px] flex-none items-center justify-center px-4 hover:bg-slate-50 focus:ring-0 focus:ring-offset-0 dark:hover:bg-gray-600',
!visibile && 'hidden'
!visibile && 'hidden',
)}
onClick={triggerAdvancedMode}
>
@ -220,7 +220,7 @@ function PluginsOptions() {
additionalButton={{
label: `Show ${showAgentSettings ? 'Completion' : 'Agent'} Settings`,
handler: triggerAgentSettings,
icon: <GPTIcon className="mr-1 mt-[2px] w-[14px]" size={14} />
icon: <GPTIcon className="mr-1 mt-[2px] w-[14px]" size={14} />,
}}
/>
<SaveAsPresetDialog

View file

@ -72,7 +72,7 @@ function HelpText({ endpoint } : { endpoint: string }) {
{`. Make sure to click 'Create and Continue' to give at least the 'Vertex AI User' role.
Lastly, create a JSON key to import here.`}
</small>
)
),
};

View file

@ -27,7 +27,7 @@ const InputWithLabel: FC<InputWithLabelProps> = ({ value, onChange, label, id })
placeholder={`Enter ${label}`}
className={cn(
defaultTextProps,
'flex h-10 max-h-10 w-full resize-none px-3 py-2 focus:outline-none focus:ring-0 focus:ring-opacity-0 focus:ring-offset-0'
'flex h-10 max-h-10 w-full resize-none px-3 py-2 focus:outline-none focus:ring-0 focus:ring-opacity-0 focus:ring-offset-0',
)}
/>
</>

View file

@ -21,7 +21,7 @@ const SetTokenDialog = ({ open, onOpenChange, endpoint }) => {
'openAI': OpenAIConfig,
'azureOpenAI': OpenAIConfig,
'gptPlugins': OpenAIConfig,
'default': OtherConfig
'default': OtherConfig,
};
const EndpointComponent = endpointComponents[endpoint] || endpointComponents['default'];
@ -42,7 +42,7 @@ const SetTokenDialog = ({ open, onOpenChange, endpoint }) => {
selection={{
selectHandler: submit,
selectClasses: 'bg-green-600 hover:bg-green-700 dark:hover:bg-green-800 text-white',
selectText: 'Submit'
selectText: 'Submit',
}}
/>
</Dialog>

View file

@ -10,7 +10,7 @@ export default function SubmitButton({
handleStopGenerating,
disabled,
isSubmitting,
endpointsConfig
endpointsConfig,
}) {
const [setTokenDialogOpen, setSetTokenDialogOpen] = useState(false);
const { getToken } = store.useToken(endpoint);