Skip to content

Commit 1c52591

Browse files
chore(repo): re-enable eslint for @clerk/ui (#9218)
1 parent 656b69b commit 1c52591

61 files changed

Lines changed: 169 additions & 121 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.changeset/tall-donuts-repeat.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@clerk/ui': patch
3+
---
4+
5+
Use logical CSS properties for the organization members footer and the MFA setup task header, so both lay out correctly in right-to-left locales.

eslint.config.mjs

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,7 @@ export default tseslint.config([
323323
'custom-rules': {
324324
rules: {
325325
'no-global-object': noGlobalObject,
326+
'no-navigate-useClerk': noNavigateUseClerk,
326327
'no-unstable-methods': noUnstableMethods,
327328
'no-physical-css-properties': noPhysicalCssProperties,
328329
},
@@ -518,14 +519,6 @@ export default tseslint.config([
518519
{
519520
name: 'packages/clerk-js',
520521
files: ['packages/clerk-js/src/ui/**/*'],
521-
plugins: {
522-
'custom-rules': {
523-
rules: {
524-
'no-navigate-useClerk': noNavigateUseClerk,
525-
'no-unstable-methods': noUnstableMethods,
526-
},
527-
},
528-
},
529522
rules: {
530523
'custom-rules/no-navigate-useClerk': 'error',
531524
'custom-rules/no-unstable-methods': 'error',
@@ -534,15 +527,23 @@ export default tseslint.config([
534527
{
535528
name: 'packages/ui',
536529
files: ['packages/ui/src/**/*'],
530+
// Tests assert on style values they receive; they are not authoring styles.
531+
ignores: ['packages/ui/src/**/__tests__/**', 'packages/ui/src/**/*.test.{ts,tsx}'],
537532
rules: {
538533
'custom-rules/no-physical-css-properties': 'error',
534+
'custom-rules/no-navigate-useClerk': 'error',
535+
'custom-rules/no-unstable-methods': 'error',
539536
},
540537
},
541538
{
542539
name: 'packages/ui/mosaic',
543540
files: ['packages/ui/src/mosaic/**/*'],
544541
ignores: ['packages/ui/src/mosaic/utils.ts', 'packages/ui/src/mosaic/__tests__/**'],
545542
rules: {
543+
// Mosaic renders elements through `render={p => <el {...p} />}`, so children and controls sit on
544+
// the outer component. Both rules only see the empty inner element and always report.
545+
'jsx-a11y/heading-has-content': 'off',
546+
'jsx-a11y/label-has-associated-control': 'off',
546547
'no-restricted-syntax': [
547548
'error',
548549
{
@@ -566,6 +567,19 @@ export default tseslint.config([
566567
files: ['packages/*/src/**/*.test.{ts,tsx}'],
567568
rules: {
568569
'@typescript-eslint/unbound-method': 'off',
570+
// vitest's `importOriginal<typeof import('...')>()` has no type-import equivalent.
571+
'@typescript-eslint/consistent-type-imports': [
572+
'error',
573+
{ prefer: 'type-imports', disallowTypeAnnotations: false, fixStyle: 'separate-type-imports' },
574+
],
575+
},
576+
},
577+
{
578+
name: 'packages - vitest type tests',
579+
files: ['packages/*/src/**/*.test-d.ts'],
580+
rules: {
581+
// Type tests bind values only to read their type back off with `typeof`.
582+
'@typescript-eslint/no-unused-vars': 'off',
569583
},
570584
},
571585
{

packages/testing/src/playwright/__tests__/setupClerkTestingToken.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
44
import { ERROR_MISSING_FRONTEND_API_URL } from '../../common/errors';
55

66
// We need to reset the module-level WeakSet between tests
7-
// eslint-disable-next-line @typescript-eslint/consistent-type-imports
87
let setupClerkTestingToken: (typeof import('../setupClerkTestingToken'))['setupClerkTestingToken'];
98

109
function createMockRoute(

packages/ui/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@
8484
"dev:sandbox:serve": "rspack serve --config rspack.config.js --env devOrigin=http://localhost:${UI_PORT:-4011}",
8585
"format": "node ../../scripts/format-package.mjs",
8686
"format:check": "node ../../scripts/format-package.mjs --check",
87+
"lint": "eslint src",
8788
"lint:attw": "attw --pack . --exclude-entrypoints themes/shadcn.css --profile esm-only",
88-
"lint:disabled": "eslint src",
8989
"lint:publint": "publint",
9090
"showerrors": "tsc",
9191
"test": "vitest run",

packages/ui/src/Components.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ import type {
1212
EnvironmentResource,
1313
GoogleOneTapProps,
1414
OrganizationProfileModalProps,
15-
SignInProps,
1615
SignInModalProps,
17-
SignUpProps,
16+
SignInProps,
1817
SignUpModalProps,
18+
SignUpProps,
1919
UserProfileModalProps,
2020
UserProfileProps,
21-
WaitlistProps,
2221
WaitlistModalProps,
22+
WaitlistProps,
2323
} from '@clerk/shared/types';
2424
import { createDeferredPromise } from '@clerk/shared/utils';
2525
import React, { Suspense, useCallback, useRef, useSyncExternalStore } from 'react';

packages/ui/src/common/__tests__/ProviderIcon.test.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ describe('ProviderIcon', () => {
5656
);
5757

5858
const icon = screen.getByLabelText('Apple icon');
59-
const styles = window.getComputedStyle(icon);
6059

6160
// Check that mask-image is applied (via inline styles)
6261
expect(icon).toHaveStyle({
@@ -225,7 +224,7 @@ describe('ProviderIcon', () => {
225224
id='google'
226225
iconUrl={null}
227226
name='Google'
228-
isLoading={true}
227+
isLoading
229228
/>,
230229
{ wrapper },
231230
);
@@ -242,7 +241,7 @@ describe('ProviderIcon', () => {
242241
id='google'
243242
iconUrl={null}
244243
name='Google'
245-
isDisabled={true}
244+
isDisabled
246245
/>,
247246
{ wrapper },
248247
);
@@ -261,7 +260,7 @@ describe('ProviderIcon', () => {
261260
id='google'
262261
iconUrl='https://example.com/google-icon.svg'
263262
name='Google'
264-
isLoading={true}
263+
isLoading
265264
/>,
266265
{ wrapper },
267266
);
@@ -279,7 +278,7 @@ describe('ProviderIcon', () => {
279278
id='google'
280279
iconUrl='https://example.com/google-icon.svg'
281280
name='Google'
282-
isDisabled={true}
281+
isDisabled
283282
/>,
284283
{ wrapper },
285284
);

packages/ui/src/components/APIKeys/__tests__/APIKeyModal.test.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ describe('APIKeyModal modalRoot behavior', () => {
1515
modalRoot.current = container;
1616
document.body.appendChild(container);
1717

18-
const { container: testContainer } = render(
18+
render(
1919
<AppearanceProvider appearanceKey='signIn'>
2020
<InternalThemeProvider>
2121
<APIKeyModal
@@ -43,7 +43,7 @@ describe('APIKeyModal modalRoot behavior', () => {
4343
modalRoot.current = container;
4444
document.body.appendChild(container);
4545

46-
const { container: testContainer } = render(
46+
render(
4747
<AppearanceProvider appearanceKey='signIn'>
4848
<InternalThemeProvider>
4949
<APIKeyModal
@@ -76,7 +76,7 @@ describe('APIKeyModal modalRoot behavior', () => {
7676

7777
const getContainer = () => container2;
7878

79-
const { container: testContainer } = render(
79+
render(
8080
<AppearanceProvider appearanceKey='signIn'>
8181
<InternalThemeProvider>
8282
<UNSAFE_PortalProvider getContainer={getContainer}>

packages/ui/src/components/AccountCredits/AccountCredits.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { ProfileSection } from '@/ui/elements/Section';
2+
23
import { useCreditBalance, useSubscriberTypeLocalizationRoot } from '../../contexts';
34
import { localizationKeys, Text, useLocalizations } from '../../customizables';
45
import { useRouter } from '../../router';

packages/ui/src/components/Checkout/CheckoutForm.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ import { useMemo, useState } from 'react';
44

55
import { Card } from '@/ui/elements/Card';
66
import { useCardState, withCardStateProvider } from '@/ui/elements/contexts';
7+
import { DevModeOverlay } from '@/ui/elements/DevModeNotice';
78
import { Drawer } from '@/ui/elements/Drawer';
89
import { LineItems } from '@/ui/elements/LineItems';
910
import { SegmentedControl } from '@/ui/elements/SegmentedControl';
1011
import { Select, SelectButton, SelectOptionList } from '@/ui/elements/Select';
11-
import { DevModeOverlay } from '@/ui/elements/DevModeNotice';
1212
import { Tooltip } from '@/ui/elements/Tooltip';
1313
import { toNegativeAmount } from '@/ui/utils/billing';
1414
import {

packages/ui/src/components/ConfigureSSO/elements/Wizard/__tests__/reducer.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { describe, expect, it } from 'vitest';
22

3-
import { isStepReachable, initialState, reduce, type WizardConfig, type WizardState } from '../reducer';
3+
import { initialState, isStepReachable, reduce, type WizardConfig, type WizardState } from '../reducer';
44
import type { WizardStepDescriptor } from '../types';
55

66
const cfg = (descriptors: WizardStepDescriptor[]): WizardConfig => ({ descriptors });

0 commit comments

Comments
 (0)