Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
100 changes: 100 additions & 0 deletions ui/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
import js from '@eslint/js';
import tseslint from 'typescript-eslint';
import pluginReact from 'eslint-plugin-react';
import pluginReactHooks from 'eslint-plugin-react-hooks';
import pluginReactRefresh from 'eslint-plugin-react-refresh';
import jsxA11y from 'eslint-plugin-jsx-a11y';
import eslintConfigPrettier from 'eslint-config-prettier';
import pluginPrettier from 'eslint-plugin-prettier';
import { fileURLToPath } from 'url';
import path from 'path';

const __dirname = path.dirname(fileURLToPath(import.meta.url));

export default tseslint.config(
{
ignores: ['dist/**', 'node_modules/**', '**/*.js', '**/*.cjs', '**/*.mjs'],
},
js.configs.recommended,
eslintConfigPrettier,
{
files: ['vite.config.ts'],
extends: [...tseslint.configs.recommended],
languageOptions: {
parserOptions: {
tsconfigRootDir: __dirname,
project: ['./tsconfig.node.json'],
},
},
},
{
files: ['src/**/*.ts', 'src/**/*.tsx', 'e2e/**/*.ts', 'playwright.config.ts'],
extends: [...tseslint.configs.recommendedTypeChecked],
plugins: {
react: pluginReact,
'react-hooks': pluginReactHooks,
'react-refresh': pluginReactRefresh,
'jsx-a11y': jsxA11y,
prettier: pluginPrettier,
},
languageOptions: {
ecmaVersion: 2021,
sourceType: 'module',
parserOptions: {
tsconfigRootDir: __dirname,
project: ['./tsconfig.json'],
},
},
settings: {
react: {
version: 'detect',
},
},
rules: {
'prettier/prettier': 'error',
// React
'react/react-in-jsx-scope': 'off',
'react/jsx-uses-react': 'off',
'react/jsx-filename-extension': ['error', { extensions: ['.ts', '.tsx'] }],
// General
'no-console': ['error', { allow: ['warn', 'error'] }],
'no-use-before-define': 'off',
'no-undef': 'off',
'no-shadow': 'off',
// Import (no import plugin, just turn off)
'import/named': 'off',
'import/namespace': 'off',
'import/default': 'off',
'import/no-named-as-default-member': 'off',
// TypeScript
'@typescript-eslint/no-use-before-define': ['error'],
'@typescript-eslint/restrict-template-expressions': 'off',
'@typescript-eslint/no-unsafe-assignment': 'off',
'@typescript-eslint/no-unnecessary-type-assertion': 'off',
'@typescript-eslint/no-unused-vars': [
'error',
{ argsIgnorePattern: '^_', caughtErrors: 'none' },
],
'@typescript-eslint/no-require-imports': 'off',
'@typescript-eslint/no-unused-expressions': 'off',
'@typescript-eslint/prefer-promise-reject-errors': 'off',
'@typescript-eslint/no-base-to-string': 'off',
'@typescript-eslint/only-throw-error': 'off',
'@typescript-eslint/no-unsafe-member-access': 'off',
'@typescript-eslint/no-misused-promises': 'off',
'@typescript-eslint/no-unsafe-call': 'off',
'@typescript-eslint/no-unsafe-argument': 'off',
'@typescript-eslint/no-unsafe-return': 'off',
'@typescript-eslint/require-await': 'off',
'@typescript-eslint/no-floating-promises': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-unnecessary-condition': 'off',
'@typescript-eslint/unbound-method': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/consistent-type-exports': 'error',
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/no-shadow': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
},
},
);
31 changes: 31 additions & 0 deletions ui/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,37 @@ export default {
},
modulePaths: ["<rootDir>"],
transform: {
<<<<<<< HEAD
"^.+\\.tsx?$": "ts-jest",
},
=======
'^.+\\.tsx?$': [
'ts-jest',
{
isolatedModules: true,
tsconfig: {
module: 'commonjs',
moduleResolution: 'node',
allowImportingTsExtensions: false,
},
},
],
},
transformIgnorePatterns: [
'/node_modules/(?!react-markdown|remark-gfm|jose|@opencode-ai/sdk|lodash-es)/',
],
testPathIgnorePatterns: ['/node_modules/', '/e2e/'],
collectCoverageFrom: [
'src/**/*.{ts,tsx}',
'!src/**/*.test.{ts,tsx}',
'!src/**/*.spec.{ts,tsx}',
'!src/**/*.d.ts',
'!src/**/__tests__/**',
'!src/**/__mocks__/**',
// Exclude files that use import.meta.env (Vite-specific, not Jest compatible)
'!src/app-signal.ts',
'!src/App.tsx',
'!src/enterprise/utils/generateLogoUrl.ts',
],
>>>>>>> 749f0e956 (fix(CE): solve snyk vulnerabilites for the UI (#1857))
};
Loading
Loading