* Done! All eslint-disable comments are now banned and the codebase is clean. **Summary of changes:** 1. **Installed** `eslint-plugin-eslint-comments` 2. **Updated** [frontend/.eslintrc.cjs](file:///private/var/folders/m1/9q_ct1913z10v6wbnv54j25r0000gn/T/vibe-kanban/worktrees/2550-disable-eslint-d/frontend/.eslintrc.cjs) to enforce the ban 3. **Fixed 3 files** by refactoring code instead of suppressing rules: - [FeatureShowcaseModal.tsx](file:///private/var/folders/m1/9q_ct1913z10v6wbnv54j25r0000gn/T/vibe-kanban/worktrees/2550-disable-eslint-d/frontend/src/components/showcase/FeatureShowcaseModal.tsx): Added ref to track activeScopes snapshot - [ShareDialog.tsx](file:///private/var/folders/m1/9q_ct1913z10v6wbnv54j25r0000gn/T/vibe-kanban/worktrees/2550-disable-eslint-d/frontend/src/components/dialogs/tasks/ShareDialog.tsx): Added shareTask object to dependencies - [wysiwyg.tsx](file:///private/var/folders/m1/9q_ct1913z10v6wbnv54j25r0000gn/T/vibe-kanban/worktrees/2550-disable-eslint-d/frontend/src/components/ui/wysiwyg.tsx): Added didInit ref guard for run-once effect All checks pass ✓ * lint fix
139 lines
4.0 KiB
JavaScript
139 lines
4.0 KiB
JavaScript
const i18nCheck = process.env.LINT_I18N === 'true';
|
|
|
|
module.exports = {
|
|
root: true,
|
|
env: {
|
|
browser: true,
|
|
es2020: true,
|
|
},
|
|
extends: [
|
|
'eslint:recommended',
|
|
'plugin:@typescript-eslint/recommended',
|
|
'plugin:react-hooks/recommended',
|
|
'plugin:i18next/recommended',
|
|
'plugin:eslint-comments/recommended',
|
|
'prettier',
|
|
],
|
|
ignorePatterns: ['dist', '.eslintrc.cjs'],
|
|
parser: '@typescript-eslint/parser',
|
|
plugins: ['react-refresh', '@typescript-eslint', 'unused-imports', 'i18next', 'eslint-comments'],
|
|
parserOptions: {
|
|
ecmaVersion: 'latest',
|
|
sourceType: 'module',
|
|
project: './tsconfig.json',
|
|
},
|
|
rules: {
|
|
'eslint-comments/no-use': ['error', { allow: [] }],
|
|
'react-refresh/only-export-components': 'off',
|
|
'unused-imports/no-unused-imports': 'error',
|
|
'unused-imports/no-unused-vars': [
|
|
'error',
|
|
{
|
|
vars: 'all',
|
|
args: 'after-used',
|
|
ignoreRestSiblings: false,
|
|
},
|
|
],
|
|
'@typescript-eslint/no-explicit-any': 'warn',
|
|
'@typescript-eslint/switch-exhaustiveness-check': 'error',
|
|
// Enforce typesafe modal pattern
|
|
'no-restricted-imports': [
|
|
'error',
|
|
{
|
|
paths: [
|
|
{
|
|
name: '@ebay/nice-modal-react',
|
|
importNames: ['default'],
|
|
message:
|
|
'Import NiceModal only in lib/modals.ts or dialog component files. Use DialogName.show(props) instead.',
|
|
},
|
|
{
|
|
name: '@/lib/modals',
|
|
importNames: ['showModal', 'hideModal', 'removeModal'],
|
|
message:
|
|
'Do not import showModal/hideModal/removeModal. Use DialogName.show(props) and DialogName.hide() instead.',
|
|
},
|
|
],
|
|
},
|
|
],
|
|
'no-restricted-syntax': [
|
|
'error',
|
|
{
|
|
selector:
|
|
'CallExpression[callee.object.name="NiceModal"][callee.property.name="show"]',
|
|
message:
|
|
'Do not use NiceModal.show() directly. Use DialogName.show(props) instead.',
|
|
},
|
|
{
|
|
selector:
|
|
'CallExpression[callee.object.name="NiceModal"][callee.property.name="register"]',
|
|
message:
|
|
'Do not use NiceModal.register(). Dialogs are registered automatically.',
|
|
},
|
|
{
|
|
selector: 'CallExpression[callee.name="showModal"]',
|
|
message:
|
|
'Do not use showModal(). Use DialogName.show(props) instead.',
|
|
},
|
|
{
|
|
selector: 'CallExpression[callee.name="hideModal"]',
|
|
message: 'Do not use hideModal(). Use DialogName.hide() instead.',
|
|
},
|
|
{
|
|
selector: 'CallExpression[callee.name="removeModal"]',
|
|
message: 'Do not use removeModal(). Use DialogName.remove() instead.',
|
|
},
|
|
],
|
|
// i18n rule - only active when LINT_I18N=true
|
|
'i18next/no-literal-string': i18nCheck
|
|
? [
|
|
'warn',
|
|
{
|
|
markupOnly: true,
|
|
ignoreAttribute: [
|
|
'data-testid',
|
|
'to',
|
|
'href',
|
|
'id',
|
|
'key',
|
|
'type',
|
|
'role',
|
|
'className',
|
|
'style',
|
|
'aria-describedby',
|
|
],
|
|
'jsx-components': {
|
|
exclude: ['code'],
|
|
},
|
|
},
|
|
]
|
|
: 'off',
|
|
},
|
|
overrides: [
|
|
{
|
|
files: ['**/*.test.{ts,tsx}', '**/*.stories.{ts,tsx}'],
|
|
rules: {
|
|
'i18next/no-literal-string': 'off',
|
|
},
|
|
},
|
|
{
|
|
// Disable type-aware linting for config files
|
|
files: ['*.config.{ts,js,cjs,mjs}', '.eslintrc.cjs'],
|
|
parserOptions: {
|
|
project: null,
|
|
},
|
|
rules: {
|
|
'@typescript-eslint/switch-exhaustiveness-check': 'off',
|
|
},
|
|
},
|
|
{
|
|
// Allow NiceModal usage in lib/modals.ts, App.tsx (for Provider), and dialog component files
|
|
files: ['src/lib/modals.ts', 'src/App.tsx', 'src/components/dialogs/**/*.{ts,tsx}'],
|
|
rules: {
|
|
'no-restricted-imports': 'off',
|
|
'no-restricted-syntax': 'off',
|
|
},
|
|
},
|
|
],
|
|
};
|