mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-09-21 21:50:49 +02:00
🧹 chore: Migrate to Flat ESLint Config & Update Prettier Settings (#5737)
* chore: migrated eslint v8 to v9 * chore: migrated eslint v8 to v9 * ESLint only checks the files that have changed in the pull request. * fix: ESLint only checks the files that have changed in the pull request. * refactor: eslint only on changed files * refactor: eslint only on changed files or added files * refactor: eslint only on changed files or added files * refactor: eslint only on changed files or added files but only include files that are not deleted (ACMRTUXB: A, C, M, R, T, U, X, B). * whoops missed something
This commit is contained in:
parent
aae413cc71
commit
86134415e9
10 changed files with 2710 additions and 1738 deletions
213
.eslintrc.js
213
.eslintrc.js
|
@ -1,213 +0,0 @@
|
|||
module.exports = {
|
||||
env: {
|
||||
browser: true,
|
||||
es2021: true,
|
||||
node: true,
|
||||
commonjs: true,
|
||||
es6: true,
|
||||
},
|
||||
extends: [
|
||||
'eslint:recommended',
|
||||
'plugin:react/recommended',
|
||||
'plugin:react-hooks/recommended',
|
||||
'plugin:jest/recommended',
|
||||
'prettier',
|
||||
'plugin:jsx-a11y/recommended',
|
||||
],
|
||||
ignorePatterns: [
|
||||
'client/dist/**/*',
|
||||
'client/public/**/*',
|
||||
'e2e/playwright-report/**/*',
|
||||
'packages/mcp/types/**/*',
|
||||
'packages/mcp/dist/**/*',
|
||||
'packages/mcp/test_bundle/**/*',
|
||||
'api/demo/**/*',
|
||||
'packages/data-provider/types/**/*',
|
||||
'packages/data-provider/dist/**/*',
|
||||
'packages/data-provider/test_bundle/**/*',
|
||||
'data-node/**/*',
|
||||
'meili_data/**/*',
|
||||
'node_modules/**/*',
|
||||
],
|
||||
parser: '@typescript-eslint/parser',
|
||||
parserOptions: {
|
||||
ecmaVersion: 'latest',
|
||||
sourceType: 'module',
|
||||
ecmaFeatures: {
|
||||
jsx: true,
|
||||
},
|
||||
},
|
||||
plugins: ['react', 'react-hooks', '@typescript-eslint', 'import', 'jsx-a11y'],
|
||||
rules: {
|
||||
'react/react-in-jsx-scope': 'off',
|
||||
'@typescript-eslint/ban-ts-comment': ['error', { 'ts-ignore': 'allow' }],
|
||||
indent: ['error', 2, { SwitchCase: 1 }],
|
||||
'max-len': [
|
||||
'error',
|
||||
{
|
||||
code: 120,
|
||||
ignoreStrings: true,
|
||||
ignoreTemplateLiterals: true,
|
||||
ignoreComments: true,
|
||||
},
|
||||
],
|
||||
'linebreak-style': 0,
|
||||
curly: ['error', 'all'],
|
||||
semi: ['error', 'always'],
|
||||
'object-curly-spacing': ['error', 'always'],
|
||||
'no-multiple-empty-lines': ['error', { max: 1 }],
|
||||
'no-trailing-spaces': 'error',
|
||||
'comma-dangle': ['error', 'always-multiline'],
|
||||
// "arrow-parens": [2, "as-needed", { requireForBlockBody: true }],
|
||||
// 'no-plusplus': ['error', { allowForLoopAfterthoughts: true }],
|
||||
'no-console': 'off',
|
||||
'import/no-cycle': 'error',
|
||||
'import/no-self-import': 'error',
|
||||
'import/extensions': 'off',
|
||||
'no-promise-executor-return': 'off',
|
||||
'no-param-reassign': 'off',
|
||||
'no-continue': 'off',
|
||||
'no-restricted-syntax': 'off',
|
||||
'react/prop-types': ['off'],
|
||||
'react/display-name': ['off'],
|
||||
'no-nested-ternary': 'error',
|
||||
'no-unused-vars': ['error', { varsIgnorePattern: '^_' }],
|
||||
quotes: ['error', 'single'],
|
||||
},
|
||||
overrides: [
|
||||
{
|
||||
files: ['**/*.ts', '**/*.tsx'],
|
||||
rules: {
|
||||
'no-unused-vars': 'off', // off because it conflicts with '@typescript-eslint/no-unused-vars'
|
||||
'react/display-name': 'off',
|
||||
'@typescript-eslint/no-unused-vars': 'warn',
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ['rollup.config.js', '.eslintrc.js', 'jest.config.js'],
|
||||
env: {
|
||||
node: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
files: [
|
||||
'**/*.test.js',
|
||||
'**/*.test.jsx',
|
||||
'**/*.test.ts',
|
||||
'**/*.test.tsx',
|
||||
'**/*.spec.js',
|
||||
'**/*.spec.jsx',
|
||||
'**/*.spec.ts',
|
||||
'**/*.spec.tsx',
|
||||
'setupTests.js',
|
||||
],
|
||||
env: {
|
||||
jest: true,
|
||||
node: true,
|
||||
},
|
||||
rules: {
|
||||
'react/display-name': 'off',
|
||||
'react/prop-types': 'off',
|
||||
'react/no-unescaped-entities': 'off',
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ['**/*.ts', '**/*.tsx'],
|
||||
parser: '@typescript-eslint/parser',
|
||||
parserOptions: {
|
||||
project: './client/tsconfig.json',
|
||||
},
|
||||
plugins: ['@typescript-eslint/eslint-plugin', 'jest'],
|
||||
extends: [
|
||||
'plugin:@typescript-eslint/eslint-recommended',
|
||||
'plugin:@typescript-eslint/recommended',
|
||||
],
|
||||
rules: {
|
||||
'@typescript-eslint/no-explicit-any': 'error',
|
||||
'@typescript-eslint/no-unnecessary-condition': 'warn',
|
||||
'@typescript-eslint/strict-boolean-expressions': 'warn',
|
||||
},
|
||||
},
|
||||
{
|
||||
files: './packages/data-provider/**/*.ts',
|
||||
overrides: [
|
||||
{
|
||||
files: '**/*.ts',
|
||||
parser: '@typescript-eslint/parser',
|
||||
parserOptions: {
|
||||
project: './packages/data-provider/tsconfig.json',
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
files: './api/demo/**/*.ts',
|
||||
overrides: [
|
||||
{
|
||||
files: '**/*.ts',
|
||||
parser: '@typescript-eslint/parser',
|
||||
parserOptions: {
|
||||
project: './packages/data-provider/tsconfig.json',
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
files: './packages/mcp/**/*.ts',
|
||||
overrides: [
|
||||
{
|
||||
files: '**/*.ts',
|
||||
parser: '@typescript-eslint/parser',
|
||||
parserOptions: {
|
||||
project: './packages/mcp/tsconfig.json',
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
files: './config/translations/**/*.ts',
|
||||
parser: '@typescript-eslint/parser',
|
||||
parserOptions: {
|
||||
project: './config/translations/tsconfig.json',
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ['./packages/data-provider/specs/**/*.ts'],
|
||||
parserOptions: {
|
||||
project: './packages/data-provider/tsconfig.spec.json',
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ['./api/demo/specs/**/*.ts'],
|
||||
parserOptions: {
|
||||
project: './packages/data-provider/tsconfig.spec.json',
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ['./packages/mcp/specs/**/*.ts'],
|
||||
parserOptions: {
|
||||
project: './packages/mcp/tsconfig.spec.json',
|
||||
},
|
||||
},
|
||||
],
|
||||
settings: {
|
||||
react: {
|
||||
createClass: 'createReactClass', // Regex for Component Factory to use,
|
||||
// default to "createReactClass"
|
||||
pragma: 'React', // Pragma to use, default to "React"
|
||||
fragment: 'Fragment', // Fragment to use (may be a property of <pragma>), default to "Fragment"
|
||||
version: 'detect', // React version. "detect" automatically picks the version you have installed.
|
||||
},
|
||||
'import/parsers': {
|
||||
'@typescript-eslint/parser': ['.ts', '.tsx'],
|
||||
},
|
||||
'import/resolver': {
|
||||
typescript: {
|
||||
project: ['./client/tsconfig.json'],
|
||||
},
|
||||
node: {
|
||||
project: ['./client/tsconfig.json'],
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
9
.github/workflows/backend-review.yml
vendored
9
.github/workflows/backend-review.yml
vendored
|
@ -38,7 +38,7 @@ jobs:
|
|||
|
||||
- name: Install MCP Package
|
||||
run: npm run build:mcp
|
||||
|
||||
|
||||
- name: Create empty auth.json file
|
||||
run: |
|
||||
mkdir -p api/data
|
||||
|
@ -61,9 +61,4 @@ jobs:
|
|||
run: cd api && npm run test:ci
|
||||
|
||||
- name: Run librechat-data-provider unit tests
|
||||
run: cd packages/data-provider && npm run test:ci
|
||||
|
||||
- name: Run linters
|
||||
uses: wearerequired/lint-action@v2
|
||||
with:
|
||||
eslint: true
|
||||
run: cd packages/data-provider && npm run test:ci
|
96
.github/workflows/eslint-ci.yml
vendored
Normal file
96
.github/workflows/eslint-ci.yml
vendored
Normal file
|
@ -0,0 +1,96 @@
|
|||
name: ESLint Code Quality Checks
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
- dev
|
||||
- release/*
|
||||
|
||||
jobs:
|
||||
eslint_checks:
|
||||
name: Run ESLint Linting
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
security-events: write
|
||||
actions: read
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Set up Node.js 20.x
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20
|
||||
cache: npm
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
|
||||
# Use a paths filter (v3) to detect changes in JavaScript/TypeScript files,
|
||||
# but only consider files that are added or modified (ignoring deleted files).
|
||||
- name: Filter changed files for ESLint
|
||||
id: file_filter
|
||||
uses: dorny/paths-filter@v3
|
||||
with:
|
||||
filters: |
|
||||
eslint:
|
||||
- added|modified: '**/*.js'
|
||||
- added|modified: '**/*.jsx'
|
||||
- added|modified: '**/*.ts'
|
||||
- added|modified: '**/*.tsx'
|
||||
|
||||
# Run ESLint only if relevant files have been added or modified.
|
||||
- name: Run ESLint on changed files
|
||||
if: steps.file_filter.outputs.eslint == 'true'
|
||||
env:
|
||||
SARIF_ESLINT_IGNORE_SUPPRESSED: "true"
|
||||
run: |
|
||||
# Extract the base commit SHA from the pull_request event payload.
|
||||
BASE_SHA=$(jq --raw-output .pull_request.base.sha "$GITHUB_EVENT_PATH")
|
||||
echo "Base commit SHA: $BASE_SHA"
|
||||
|
||||
# List files changed between the base commit and current HEAD,
|
||||
# but only include files that are not deleted (ACMRTUXB: A, C, M, R, T, U, X, B).
|
||||
CHANGED_FILES=$(git diff --name-only --diff-filter=ACMRTUXB "$BASE_SHA" HEAD | grep -E '\.(js|jsx|ts|tsx)$')
|
||||
echo "Files to lint:"
|
||||
echo "$CHANGED_FILES"
|
||||
|
||||
# Run ESLint on the changed files.
|
||||
npx eslint --no-error-on-unmatched-pattern \
|
||||
--config eslint.config.mjs \
|
||||
--format @microsoft/eslint-formatter-sarif \
|
||||
--output-file eslint-results.sarif $CHANGED_FILES || true
|
||||
|
||||
# If no JavaScript/TypeScript files were added or modified,
|
||||
# create a valid (non-empty) SARIF file containing one run.
|
||||
- name: Create empty SARIF results file
|
||||
if: steps.file_filter.outputs.eslint != 'true'
|
||||
run: |
|
||||
cat << 'EOF' > eslint-results.sarif
|
||||
{
|
||||
"version": "2.1.0",
|
||||
"$schema": "https://json.schemastore.org/sarif-2.1.0.json",
|
||||
"runs": [
|
||||
{
|
||||
"tool": {
|
||||
"driver": {
|
||||
"name": "ESLint",
|
||||
"informationUri": "https://eslint.org",
|
||||
"version": "0.0.0",
|
||||
"rules": []
|
||||
}
|
||||
},
|
||||
"results": []
|
||||
}
|
||||
]
|
||||
}
|
||||
EOF
|
||||
|
||||
- name: Upload analysis results to GitHub
|
||||
uses: github/codeql-action/upload-sarif@v3
|
||||
with:
|
||||
sarif_file: eslint-results.sarif
|
||||
wait-for-processing: true
|
19
.prettierrc
Normal file
19
.prettierrc
Normal file
|
@ -0,0 +1,19 @@
|
|||
{
|
||||
"tailwindConfig": "./client/tailwind.config.cjs",
|
||||
"printWidth": 100,
|
||||
"tabWidth": 2,
|
||||
"useTabs": false,
|
||||
"semi": true,
|
||||
"singleQuote": true,
|
||||
"trailingComma": "all",
|
||||
"arrowParens": "always",
|
||||
"embeddedLanguageFormatting": "auto",
|
||||
"insertPragma": false,
|
||||
"proseWrap": "preserve",
|
||||
"quoteProps": "as-needed",
|
||||
"requirePragma": false,
|
||||
"rangeStart": 0,
|
||||
"endOfLine": "auto",
|
||||
"jsxSingleQuote": false,
|
||||
"plugins": ["prettier-plugin-tailwindcss"]
|
||||
}
|
|
@ -129,7 +129,7 @@
|
|||
"babel-plugin-root-import": "^6.6.0",
|
||||
"babel-plugin-transform-import-meta": "^2.2.1",
|
||||
"babel-plugin-transform-vite-meta-env": "^1.0.3",
|
||||
"eslint-plugin-jest": "^27.2.1",
|
||||
"eslint-plugin-jest": "^28.11.0",
|
||||
"identity-obj-proxy": "^3.0.0",
|
||||
"jest": "^29.5.0",
|
||||
"jest-canvas-mock": "^2.5.1",
|
||||
|
|
|
@ -28,7 +28,14 @@
|
|||
},
|
||||
"types": ["node", "jest", "@testing-library/jest-dom"],
|
||||
"exclude": ["node_modules", "vite.config.ts"],
|
||||
"include": ["src/**/*", "test/**/*", "../e2e/**/*", "setupTests.js", "env.d.ts"],
|
||||
"include": [
|
||||
"src/**/*",
|
||||
"test/**/*",
|
||||
"../e2e/**/*",
|
||||
"test/setupTests.js",
|
||||
"env.d.ts",
|
||||
"../config/translations/**/*.ts"
|
||||
],
|
||||
"references": [
|
||||
{
|
||||
"path": "./tsconfig.node.json"
|
||||
|
|
362
eslint.config.mjs
Normal file
362
eslint.config.mjs
Normal file
|
@ -0,0 +1,362 @@
|
|||
import { fileURLToPath } from 'node:url';
|
||||
import path from 'node:path';
|
||||
import typescriptEslintEslintPlugin from '@typescript-eslint/eslint-plugin';
|
||||
import { fixupConfigRules, fixupPluginRules } from '@eslint/compat';
|
||||
// import perfectionist from 'eslint-plugin-perfectionist';
|
||||
import reactHooks from 'eslint-plugin-react-hooks';
|
||||
import tsParser from '@typescript-eslint/parser';
|
||||
import importPlugin from 'eslint-plugin-import';
|
||||
import { FlatCompat } from '@eslint/eslintrc';
|
||||
import jsxA11Y from 'eslint-plugin-jsx-a11y';
|
||||
import react from 'eslint-plugin-react';
|
||||
import jest from 'eslint-plugin-jest';
|
||||
import globals from 'globals';
|
||||
import js from '@eslint/js';
|
||||
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
const __dirname = path.dirname(__filename);
|
||||
const compat = new FlatCompat({
|
||||
baseDirectory: __dirname,
|
||||
recommendedConfig: js.configs.recommended,
|
||||
allConfig: js.configs.all,
|
||||
});
|
||||
|
||||
export default [
|
||||
{
|
||||
ignores: [
|
||||
'client/dist/**/*',
|
||||
'client/public/**/*',
|
||||
'client/coverage/**/*',
|
||||
'e2e/playwright-report/**/*',
|
||||
'packages/mcp/types/**/*',
|
||||
'packages/mcp/dist/**/*',
|
||||
'packages/mcp/test_bundle/**/*',
|
||||
'api/demo/**/*',
|
||||
'packages/data-provider/types/**/*',
|
||||
'packages/data-provider/dist/**/*',
|
||||
'packages/data-provider/test_bundle/**/*',
|
||||
'data-node/**/*',
|
||||
'meili_data/**/*',
|
||||
'**/node_modules/**/*',
|
||||
],
|
||||
},
|
||||
...fixupConfigRules(
|
||||
compat.extends(
|
||||
'eslint:recommended',
|
||||
'plugin:react/recommended',
|
||||
'plugin:react-hooks/recommended',
|
||||
'plugin:jest/recommended',
|
||||
'prettier',
|
||||
'plugin:jsx-a11y/recommended',
|
||||
),
|
||||
),
|
||||
{
|
||||
plugins: {
|
||||
react: fixupPluginRules(react),
|
||||
'react-hooks': fixupPluginRules(reactHooks),
|
||||
'@typescript-eslint': typescriptEslintEslintPlugin,
|
||||
import: importPlugin,
|
||||
'jsx-a11y': fixupPluginRules(jsxA11Y),
|
||||
'import/parsers': tsParser,
|
||||
// perfectionist,
|
||||
},
|
||||
|
||||
languageOptions: {
|
||||
globals: {
|
||||
...globals.browser,
|
||||
...globals.node,
|
||||
...globals.commonjs,
|
||||
},
|
||||
parser: tsParser,
|
||||
ecmaVersion: 'latest',
|
||||
sourceType: 'module',
|
||||
parserOptions: {
|
||||
ecmaFeatures: {
|
||||
jsx: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
settings: {
|
||||
react: {
|
||||
createClass: 'createReactClass',
|
||||
pragma: 'React',
|
||||
fragment: 'Fragment',
|
||||
version: 'detect',
|
||||
},
|
||||
'import/parsers': {
|
||||
'@typescript-eslint/parser': ['.ts', '.tsx'],
|
||||
},
|
||||
'import/resolver': {
|
||||
typescript: {
|
||||
project: ['./client/tsconfig.json'],
|
||||
},
|
||||
node: {
|
||||
project: ['./client/tsconfig.json'],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
rules: {
|
||||
'react/react-in-jsx-scope': 'off',
|
||||
|
||||
'@typescript-eslint/ban-ts-comment': [
|
||||
'error',
|
||||
{
|
||||
'ts-ignore': false,
|
||||
},
|
||||
],
|
||||
// Disable a11y features to be enabled later on.
|
||||
'jsx-a11y/no-static-element-interactions': 'off',
|
||||
'jsx-a11y/click-events-have-key-events': 'off',
|
||||
'jsx-a11y/alt-text': 'off',
|
||||
'jsx-a11y/img-redundant-alt': 'off',
|
||||
'jsx-a11y/no-noninteractive-tabindex': 'off',
|
||||
// common rules
|
||||
'no-nested-ternary': 'warn',
|
||||
'no-constant-binary-expression': 'warn',
|
||||
// Also disable the core no-unused-vars rule globally.
|
||||
'no-unused-vars': 'warn',
|
||||
|
||||
indent: ['error', 2, { SwitchCase: 1 }],
|
||||
'max-len': [
|
||||
'error',
|
||||
{
|
||||
code: 120,
|
||||
ignoreStrings: true,
|
||||
ignoreTemplateLiterals: true,
|
||||
ignoreComments: true,
|
||||
},
|
||||
],
|
||||
'linebreak-style': 0,
|
||||
curly: ['error', 'all'],
|
||||
semi: ['error', 'always'],
|
||||
'object-curly-spacing': ['error', 'always'],
|
||||
'no-multiple-empty-lines': [
|
||||
'error',
|
||||
{
|
||||
max: 1,
|
||||
},
|
||||
],
|
||||
'no-trailing-spaces': 'error',
|
||||
'comma-dangle': ['error', 'always-multiline'],
|
||||
'no-console': 'off',
|
||||
'import/no-cycle': 'error',
|
||||
'import/no-self-import': 'error',
|
||||
'import/extensions': 'off',
|
||||
'no-promise-executor-return': 'off',
|
||||
'no-param-reassign': 'off',
|
||||
'no-continue': 'off',
|
||||
'no-restricted-syntax': 'off',
|
||||
'react/prop-types': 'off',
|
||||
'react/display-name': 'off',
|
||||
quotes: ['error', 'single'],
|
||||
'key-spacing': ['error', { beforeColon: false, afterColon: true }],
|
||||
|
||||
// 'perfectionist/sort-imports': [
|
||||
// 'error',
|
||||
// {
|
||||
// type: 'line-length',
|
||||
// order: 'desc',
|
||||
// newlinesBetween: 'never',
|
||||
// customGroups: {
|
||||
// value: {
|
||||
// react: ['^react$'],
|
||||
// // react: ['^react$', '^fs', '^zod', '^path'],
|
||||
// local: ['^(\\.{1,2}|~)/', '^librechat-data-provider'],
|
||||
// },
|
||||
// },
|
||||
// groups: [
|
||||
// 'react',
|
||||
// 'builtin',
|
||||
// 'external',
|
||||
// ['builtin-type', 'external-type'],
|
||||
// ['internal-type'],
|
||||
// 'local',
|
||||
// ['parent', 'sibling', 'index'],
|
||||
// 'object',
|
||||
// 'unknown',
|
||||
// ],
|
||||
// },
|
||||
// ],
|
||||
|
||||
// 'perfectionist/sort-named-imports': [
|
||||
// 'error',
|
||||
// {
|
||||
// type: 'line-length',
|
||||
// order: 'asc',
|
||||
// ignoreAlias: false,
|
||||
// ignoreCase: true,
|
||||
// specialCharacters: 'keep',
|
||||
// groupKind: 'mixed',
|
||||
// partitionByNewLine: false,
|
||||
// partitionByComment: false,
|
||||
// },
|
||||
// ],
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ['api/**/*.js', 'config/**/*.js'],
|
||||
rules: {
|
||||
// API
|
||||
// TODO: maybe later to error.
|
||||
'no-unused-const': 'off',
|
||||
'no-unused-vars': 'off',
|
||||
'no-async-promise-executor': 'off',
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ['client/src/**/*.tsx', 'client/src/**/*.ts', 'client/src/**/*.jsx', 'client/src/**/*.js'],
|
||||
rules: {
|
||||
// Client a11y
|
||||
// TODO: maybe later to error.
|
||||
'jsx-a11y/no-noninteractive-element-interactions': 'off',
|
||||
'jsx-a11y/label-has-associated-control': 'off',
|
||||
'jsx-a11y/no-static-element-interactions': 'off',
|
||||
'jsx-a11y/click-events-have-key-events': 'off',
|
||||
'jsx-a11y/interactive-supports-focus': 'off',
|
||||
'jsx-a11y/no-noninteractive-tabindex': 'off',
|
||||
'jsx-a11y/img-redundant-alt': 'off',
|
||||
'jsx-a11y/media-has-caption': 'off',
|
||||
'jsx-a11y/no-autofocus': 'off',
|
||||
'jsx-a11y/alt-text': 'off',
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ['**/rollup.config.js', '**/.eslintrc.js', '**/jest.config.js'],
|
||||
languageOptions: {
|
||||
globals: {
|
||||
...globals.node,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
files: [
|
||||
'**/*.test.js',
|
||||
'**/*.test.jsx',
|
||||
'**/*.test.ts',
|
||||
'**/*.test.tsx',
|
||||
'**/*.spec.js',
|
||||
'**/*.spec.jsx',
|
||||
'**/*.spec.ts',
|
||||
'**/*.spec.tsx',
|
||||
'**/setupTests.js',
|
||||
],
|
||||
languageOptions: {
|
||||
globals: {
|
||||
...globals.jest,
|
||||
...globals.node,
|
||||
},
|
||||
},
|
||||
rules: {
|
||||
// TEST
|
||||
'react/display-name': 'off',
|
||||
'react/prop-types': 'off',
|
||||
'jest/no-commented-out-tests': 'off',
|
||||
'react/no-unescaped-entities': 'off',
|
||||
'jest/no-conditional-expect': 'off',
|
||||
'jest/no-disabled-tests': 'off',
|
||||
'@typescript-eslint/no-unused-vars': 'off',
|
||||
},
|
||||
},
|
||||
...compat
|
||||
.extends(
|
||||
'plugin:@typescript-eslint/eslint-recommended',
|
||||
'plugin:@typescript-eslint/recommended',
|
||||
)
|
||||
.map((config) => ({
|
||||
...config,
|
||||
files: ['**/*.ts', '**/*.tsx'],
|
||||
})),
|
||||
{
|
||||
files: ['**/*.ts', '**/*.tsx'],
|
||||
plugins: {
|
||||
'@typescript-eslint': typescriptEslintEslintPlugin,
|
||||
jest: fixupPluginRules(jest),
|
||||
},
|
||||
languageOptions: {
|
||||
parser: tsParser,
|
||||
ecmaVersion: 5,
|
||||
sourceType: 'script',
|
||||
parserOptions: {
|
||||
project: './client/tsconfig.json',
|
||||
},
|
||||
},
|
||||
rules: {
|
||||
// TODO: maybe later to error.
|
||||
'@typescript-eslint/no-unused-expressions': 'off',
|
||||
'@typescript-eslint/no-unused-vars': 'off',
|
||||
'@typescript-eslint/no-explicit-any': 'off',
|
||||
'@typescript-eslint/no-unnecessary-condition': 'off',
|
||||
'@typescript-eslint/strict-boolean-expressions': 'off',
|
||||
'@typescript-eslint/ban-ts-comment': 'off',
|
||||
// React
|
||||
'react/no-unknown-property': 'warn',
|
||||
'react-hooks/rules-of-hooks': 'off',
|
||||
'react-hooks/exhaustive-deps': 'off',
|
||||
// General
|
||||
'no-constant-binary-expression': 'off',
|
||||
'import/no-cycle': 'off',
|
||||
'no-nested-ternary': 'off',
|
||||
},
|
||||
},
|
||||
{
|
||||
// **Data-provider specific configuration block**
|
||||
files: ['./packages/data-provider/**/*.ts'],
|
||||
languageOptions: {
|
||||
parser: tsParser,
|
||||
ecmaVersion: 'latest',
|
||||
sourceType: 'module',
|
||||
parserOptions: {
|
||||
project: './packages/data-provider/tsconfig.json',
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ['./api/demo/**/*.ts'],
|
||||
},
|
||||
{
|
||||
files: ['./packages/mcp/**/*.ts'],
|
||||
},
|
||||
{
|
||||
files: ['./config/translations/**/*.ts'],
|
||||
languageOptions: {
|
||||
parser: tsParser,
|
||||
ecmaVersion: 5,
|
||||
sourceType: 'script',
|
||||
parserOptions: {
|
||||
project: './config/translations/tsconfig.json',
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ['./packages/data-provider/specs/**/*.ts'],
|
||||
languageOptions: {
|
||||
ecmaVersion: 5,
|
||||
sourceType: 'script',
|
||||
parserOptions: {
|
||||
project: './packages/data-provider/tsconfig.spec.json',
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ['./api/demo/specs/**/*.ts'],
|
||||
languageOptions: {
|
||||
ecmaVersion: 5,
|
||||
sourceType: 'script',
|
||||
parserOptions: {
|
||||
project: './packages/data-provider/tsconfig.spec.json',
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ['./packages/mcp/specs/**/*.ts'],
|
||||
languageOptions: {
|
||||
ecmaVersion: 5,
|
||||
sourceType: 'script',
|
||||
parserOptions: {
|
||||
project: './packages/mcp/tsconfig.spec.json',
|
||||
},
|
||||
},
|
||||
},
|
||||
];
|
3674
package-lock.json
generated
3674
package-lock.json
generated
File diff suppressed because it is too large
Load diff
44
package.json
44
package.json
|
@ -56,7 +56,7 @@
|
|||
"e2e:report": "npx playwright show-report e2e/playwright-report",
|
||||
"lint:fix": "eslint --fix \"{,!(node_modules|venv)/**/}*.{js,jsx,ts,tsx}\"",
|
||||
"lint": "eslint \"{,!(node_modules|venv)/**/}*.{js,jsx,ts,tsx}\"",
|
||||
"format": "prettier-eslint --write \"{,!(node_modules|venv)/**/}*.{js,jsx,ts,tsx}\"",
|
||||
"format": "npx prettier --write \"{,!(node_modules|venv)/**/}*.{js,jsx,ts,tsx}\"",
|
||||
"b:api": "NODE_ENV=production bun run api/server/index.js",
|
||||
"b:api-inspect": "NODE_ENV=production bun --inspect run api/server/index.js",
|
||||
"b:api:dev": "NODE_ENV=production bun run --watch api/server/index.js",
|
||||
|
@ -80,29 +80,33 @@
|
|||
},
|
||||
"homepage": "https://librechat.ai/",
|
||||
"devDependencies": {
|
||||
"@axe-core/playwright": "^4.9.1",
|
||||
"@playwright/test": "^1.38.1",
|
||||
"@axe-core/playwright": "^4.10.1",
|
||||
"@eslint/compat": "^1.2.6",
|
||||
"@eslint/eslintrc": "^3.2.0",
|
||||
"@eslint/js": "^9.20.0",
|
||||
"@playwright/test": "^1.50.1",
|
||||
"@types/react-virtualized": "^9.22.0",
|
||||
"@typescript-eslint/eslint-plugin": "^5.62.0",
|
||||
"@typescript-eslint/parser": "^5.62.0",
|
||||
"@microsoft/eslint-formatter-sarif": "^3.1.0",
|
||||
"cross-env": "^7.0.3",
|
||||
"eslint": "^8.41.0",
|
||||
"eslint-config-airbnb-base": "^15.0.0",
|
||||
"eslint-config-prettier": "^8.9.0",
|
||||
"eslint-import-resolver-typescript": "^3.5.5",
|
||||
"eslint-plugin-import": "^2.28.0",
|
||||
"eslint-plugin-jest": "^27.2.1",
|
||||
"eslint-plugin-jsx-a11y": "^6.9.0",
|
||||
"eslint-plugin-prettier": "^4.2.1",
|
||||
"eslint-plugin-react": "^7.32.2",
|
||||
"eslint-plugin-react-hooks": "^4.6.0",
|
||||
"eslint": "^9.20.0",
|
||||
"eslint-config-prettier": "^10.0.1",
|
||||
"eslint-import-resolver-typescript": "^3.7.0",
|
||||
"eslint-plugin-import": "^2.31.0",
|
||||
"eslint-plugin-jest": "^28.11.0",
|
||||
"eslint-plugin-jsx-a11y": "^6.10.2",
|
||||
"eslint-plugin-perfectionist": "^4.8.0",
|
||||
"eslint-plugin-prettier": "^5.2.3",
|
||||
"eslint-plugin-react": "^7.37.4",
|
||||
"eslint-plugin-react-hooks": "^5.1.0",
|
||||
"eslint-plugin-simple-import-sort": "^12.1.1",
|
||||
"globals": "^15.14.0",
|
||||
"husky": "^8.0.0",
|
||||
"jest": "^29.5.0",
|
||||
"lint-staged": "^15.2.10",
|
||||
"prettier": "^2.8.8",
|
||||
"prettier-eslint": "^15.0.1",
|
||||
"prettier-eslint-cli": "^7.1.0",
|
||||
"prettier-plugin-tailwindcss": "^0.2.2"
|
||||
"lint-staged": "^15.4.3",
|
||||
"prettier": "^3.4.2",
|
||||
"prettier-eslint": "^16.3.0",
|
||||
"prettier-plugin-tailwindcss": "^0.6.11",
|
||||
"typescript-eslint": "^8.23.0"
|
||||
},
|
||||
"overrides": {
|
||||
"mdast-util-gfm-autolink-literal": "2.0.0",
|
||||
|
|
|
@ -1,20 +0,0 @@
|
|||
// v0.7.6
|
||||
module.exports = {
|
||||
tailwindConfig: './client/tailwind.config.cjs',
|
||||
printWidth: 100,
|
||||
tabWidth: 2,
|
||||
useTabs: false,
|
||||
semi: true,
|
||||
singleQuote: true,
|
||||
trailingComma: 'all',
|
||||
arrowParens: 'always',
|
||||
embeddedLanguageFormatting: 'auto',
|
||||
insertPragma: false,
|
||||
proseWrap: 'preserve',
|
||||
quoteProps: 'as-needed',
|
||||
requirePragma: false,
|
||||
rangeStart: 0,
|
||||
endOfLine: 'auto',
|
||||
jsxSingleQuote: false,
|
||||
plugins: ['prettier-plugin-tailwindcss'],
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue