ToolJet/frontend/eslint.config.mjs
Nithin David Thomas 4e07c24060
feat(rocket): add AlertDialog, Collapsible, Sheet, Sonner + Dialog overflow border (#15854)
* feat(rocket/alert-dialog): implement AlertDialog component with variants and documentation

* feat(rocket/collapsible): add Rocket Collapsible component

Bordered and ghost variants with animated expand/collapse via CSS grid-rows.
Includes styled trigger with auto-rotating chevron, variant context,
and Storybook stories.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* chore(storybook): fix quote style and centered layout sizing

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* feat(rocket/toaster): implement Sonner toast notification system with documentation and stories

* feat(rocket/sheet): add Rocket Sheet component

Right-side slide-in panel for multi-step forms (e.g. add datasource).
Three sizes (small/default/large), header/body/footer structure mirroring Dialog,
conditional footer overflow border via ResizeObserver context, preventClose support.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* feat(rocket/table): add Rocket Table primitive

Low-level table primitive with 8 sub-components (Table, TableHeader, TableBody,
TableFooter, TableRow, TableHead, TableCell, TableCaption). Density variants
(default 52px / compact 36px) via TableDensityContext. Borderless rows with
rounded pill hover/selected highlights via first/last cell rounded corners.
Header bottom border on cells (border-separate mode). All ToolJet tokens.

Brought forward from PR #14498 with improved organization and Figma-aligned
defaults from the apps list design.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* feat(rocket): add Skeleton primitive + DataTable block

- Skeleton: Rocket primitive with pulsing bg-interactive-hover token
- TableSkeleton: TanStack-agnostic skeleton rows for use inside <Table>
- DataTable: TanStack-driven table block (header, body, loading, empty states)
  brought from PR #14498 with ToolJet token cleanup and proper file structure

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* feat(rocket): add Checkbox and RadioGroup components with specifications and stories

* chore: update dependencies and remove unused packages

- Removed @base-ui/react and cmdk from dependencies.
- Updated various @radix-ui packages to lower versions for compatibility.
- Adjusted versions for @floating-ui packages.
- Cleaned up package-lock.json by removing unnecessary entries.

* feat(rocket): add Spinner and Textarea components with stories and update AlertDialog and Combobox for new props

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-09 16:43:49 +05:30

273 lines
7.9 KiB
JavaScript

import js from '@eslint/js';
import globals from 'globals';
import babelParser from '@babel/eslint-parser';
import pluginReact from 'eslint-plugin-react';
import pluginReactHooks from 'eslint-plugin-react-hooks';
import pluginImportX from 'eslint-plugin-import-x';
import pluginJest from 'eslint-plugin-jest';
import pluginPrettier from 'eslint-plugin-prettier';
import configPrettier from 'eslint-config-prettier';
import pluginStorybook from 'eslint-plugin-storybook';
import tsPlugin from '@typescript-eslint/eslint-plugin';
import tsParser from '@typescript-eslint/parser';
import { fileURLToPath } from 'url';
import { dirname } from 'path';
const __dirname = dirname(fileURLToPath(import.meta.url));
// Remap import-x recommended rules from 'import-x/' prefix to 'import/' prefix
// so they match the plugin namespace and existing eslint-disable directives
function remapImportRules(rules) {
const remapped = {};
for (const [key, value] of Object.entries(rules)) {
remapped[key.replace(/^import-x\//, 'import/')] = value;
}
return remapped;
}
export default [
// Global ignores (replaces .eslintignore)
{
ignores: ['build/**', 'assets/**', 'cypress-tests/**'],
},
// Disable reporting unused eslint-disable directives (ESLint 9 defaults to "warn",
// ESLint 8 defaulted to "off"). This prevents --fix from stripping existing
// eslint-disable comments that plugins no longer flag.
{
linterOptions: {
reportUnusedDisableDirectives: 'off',
},
},
// Main config for JS/JSX files
{
files: ['**/*.js', '**/*.jsx'],
languageOptions: {
parser: babelParser,
parserOptions: {
requireConfigFile: false,
babelOptions: {
configFile: __dirname + '/babel.config.js',
},
ecmaFeatures: {
jsx: true,
},
ecmaVersion: 12,
sourceType: 'module',
},
globals: {
...globals.browser,
...globals.amd,
...globals.node,
...globals.es2021,
...globals.jest,
path: true,
fetch: true,
process: true,
module: true,
__dirname: true,
},
},
plugins: {
react: pluginReact,
'react-hooks': pluginReactHooks,
// Register import-x under the 'import' namespace so existing
// `eslint-disable import/...` directives continue to work
import: pluginImportX,
jest: pluginJest,
prettier: pluginPrettier,
},
settings: {
react: {
version: 'detect',
},
'import-x/resolver': {
node: {
extensions: ['.js', '.jsx', '.ts', '.tsx'],
},
webpack: {
config: new URL('./webpack.config.js', import.meta.url).pathname,
},
},
},
rules: {
// eslint:recommended
...js.configs.recommended.rules,
// react recommended
...pluginReact.configs.recommended.rules,
// react-hooks recommended
...pluginReactHooks.configs.recommended.rules,
// import errors + warnings (remapped from import-x/ to import/ namespace)
...remapImportRules(pluginImportX.configs.recommended.rules),
// prettier recommended (plugin + config)
...pluginPrettier.configs.recommended.rules,
// prettier config (disables conflicting rules)
...configPrettier.rules,
// Re-enable prettier/prettier as error (after configPrettier may disable it)
'prettier/prettier': [
'error',
{
semi: true,
trailingComma: 'es5',
printWidth: 120,
singleQuote: true,
arrowParens: 'always',
proseWrap: 'preserve',
},
],
// Project rules (preserved from .eslintrc.js)
'react/prop-types': 0,
'react/display-name': 'off',
'no-unused-vars': [
'warn',
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
},
],
'react/no-deprecated': 0,
'no-prototype-builtins': 0,
'jest/no-disabled-tests': 'warn',
'jest/no-focused-tests': 'error',
'jest/no-identical-title': 'error',
'jest/prefer-to-have-length': 'warn',
'jest/valid-expect': 'error',
'import/no-unresolved': [
'error',
{
ignore: ['^@/', 'react-hot-toast', 'react-i18next', 'react-loading-skeleton', 'react-spring', 'class-variance-authority', '@radix-ui/'],
},
],
'react/no-unknown-property': 'off',
},
},
// TypeScript config for TS/TSX files
{
files: ['**/*.ts', '**/*.tsx'],
languageOptions: {
parser: tsParser,
parserOptions: {
ecmaFeatures: { jsx: true },
ecmaVersion: 'latest',
sourceType: 'module',
project: __dirname + '/tsconfig.json',
},
globals: {
...globals.browser,
...globals.amd,
...globals.node,
...globals.es2021,
path: true,
fetch: true,
process: true,
module: true,
__dirname: true,
},
},
plugins: {
'@typescript-eslint': tsPlugin,
react: pluginReact,
'react-hooks': pluginReactHooks,
prettier: pluginPrettier,
},
settings: {
react: {
version: 'detect',
},
},
rules: {
// eslint:recommended
...js.configs.recommended.rules,
// @typescript-eslint/recommended rules (from v7 plugin)
// Disable base ESLint rules that conflict with TS equivalents
'no-unused-vars': 'off',
'no-undef': 'off', // TypeScript handles this
'no-redeclare': 'off',
'no-dupe-class-members': 'off',
// @typescript-eslint recommended
'@typescript-eslint/adjacent-overload-signatures': 'error',
'@typescript-eslint/ban-ts-comment': 'error',
'@typescript-eslint/ban-types': 'error',
'@typescript-eslint/no-array-constructor': 'error',
'@typescript-eslint/no-empty-interface': 'error',
'@typescript-eslint/no-extra-non-null-assertion': 'error',
'@typescript-eslint/no-inferrable-types': 'error',
'@typescript-eslint/no-loss-of-precision': 'error',
'@typescript-eslint/no-misused-new': 'error',
'@typescript-eslint/no-namespace': 'error',
'@typescript-eslint/no-non-null-asserted-optional-chain': 'error',
'@typescript-eslint/no-non-null-assertion': 'warn',
'@typescript-eslint/no-this-alias': 'error',
'@typescript-eslint/no-unnecessary-type-constraint': 'error',
'@typescript-eslint/no-var-requires': 'error',
'@typescript-eslint/prefer-as-const': 'error',
'@typescript-eslint/triple-slash-reference': 'error',
// react recommended
...pluginReact.configs.recommended.rules,
// react-hooks recommended
...pluginReactHooks.configs.recommended.rules,
// prettier recommended (plugin + config)
...pluginPrettier.configs.recommended.rules,
// prettier config (disables conflicting rules)
...configPrettier.rules,
// Re-enable prettier/prettier as error
'prettier/prettier': [
'error',
{
semi: true,
trailingComma: 'es5',
printWidth: 120,
singleQuote: true,
arrowParens: 'always',
proseWrap: 'preserve',
},
],
// Project rules
'react/prop-types': 'off',
'react/display-name': 'off',
// Override @typescript-eslint defaults with project preferences
'@typescript-eslint/no-unused-vars': ['warn', { argsIgnorePattern: '^_', varsIgnorePattern: '^_' }],
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/no-explicit-any': 'warn',
'import/no-unresolved': [
'error',
{
ignore: ['^@/', 'react-hot-toast', 'react-i18next', 'react-loading-skeleton', 'react-spring', 'class-variance-authority', '@radix-ui/'],
},
],
'react/no-unknown-property': 'off',
},
},
// Storybook config
...pluginStorybook.configs['flat/recommended'],
];