Skip to content

Commit d0f65d7

Browse files
authored
chore(mosaic,swingset): Migrate to Oxlint, TS7, and Next.js v16 (#10651)
1 parent 805c158 commit d0f65d7

106 files changed

Lines changed: 2738 additions & 1405 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.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"@clerk/mosaic": patch
3+
---
4+
5+
- Fixed an issue where an outgoing Flow step could show content from an update that never appeared on screen.
6+
- Fixed an issue where adding a tag while a controlled TagInput update was still pending could use the pending tag list instead of the list shown on screen.

‎eslint.config.mjs‎

Lines changed: 2 additions & 149 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import fs from 'node:fs';
22
import path from 'node:path';
33

4-
import pluginEslintComments from '@eslint-community/eslint-plugin-eslint-comments';
54
import eslint from '@eslint/js';
65
import configPrettier from 'eslint-config-prettier';
76
import configTurbo from 'eslint-config-turbo/flat';
@@ -11,9 +10,7 @@ import pluginJsxA11y from 'eslint-plugin-jsx-a11y';
1110
import pluginPlaywright from 'eslint-plugin-playwright';
1211
import pluginReact from 'eslint-plugin-react';
1312
import pluginReactHooks from 'eslint-plugin-react-hooks';
14-
import pluginStylex from '@stylexjs/eslint-plugin';
1513
import pluginSimpleImportSort from 'eslint-plugin-simple-import-sort';
16-
import pluginSonarjs from 'eslint-plugin-sonarjs';
1714
import pluginTurbo from 'eslint-plugin-turbo';
1815
import pluginUnusedImports from 'eslint-plugin-unused-imports';
1916
import pluginYml from 'eslint-plugin-yml';
@@ -312,12 +309,6 @@ const noPhysicalCssProperties = {
312309
},
313310
};
314311

315-
const noLeakedConditionalJsx = {
316-
selector: ":matches(JSXElement, JSXFragment) > JSXExpressionContainer > LogicalExpression[operator='&&']",
317-
message:
318-
'Use a ternary (`condition ? <Element /> : null`) for conditional JSX; `&&` renders a falsy left-hand value such as `0`.',
319-
};
320-
321312
export default tseslint.config([
322313
{
323314
name: 'repo/ignores',
@@ -343,6 +334,8 @@ export default tseslint.config([
343334
'eslint.config.mjs',
344335
'typedoc.config.mjs',
345336
'vitest.workspace.mjs',
337+
'packages/mosaic/**',
338+
'packages/swingset/**',
346339
// package specific ignores
347340
'packages/astro/src/astro-components/**/*.ts',
348341
'packages/backend/src/runtime/**/*',
@@ -615,134 +608,6 @@ export default tseslint.config([
615608
'custom-rules/no-unstable-methods': 'error',
616609
},
617610
},
618-
{
619-
name: 'packages/mosaic',
620-
files: ['packages/mosaic/src/**/*'],
621-
// Tests assert on style values they receive; they are not authoring styles.
622-
ignores: ['packages/mosaic/src/__tests__/**', 'packages/mosaic/src/**/*.test.{ts,tsx}'],
623-
plugins: {
624-
'@eslint-community/eslint-comments': pluginEslintComments,
625-
'@stylexjs': pluginStylex,
626-
sonarjs: pluginSonarjs,
627-
},
628-
rules: {
629-
'@eslint-community/eslint-comments/require-description': ['error', { ignore: ['eslint-enable'] }],
630-
'sonarjs/cognitive-complexity': ['error', 15],
631-
'sonarjs/no-collapsible-if': 'error',
632-
'sonarjs/no-identical-functions': 'error',
633-
'sonarjs/no-redundant-jump': 'error',
634-
'sonarjs/prefer-single-boolean-return': 'error',
635-
'@typescript-eslint/consistent-type-assertions': ['error', { assertionStyle: 'never' }],
636-
'@typescript-eslint/switch-exhaustiveness-check': 'error',
637-
'@typescript-eslint/await-thenable': 'error',
638-
'@typescript-eslint/ban-ts-comment': 'error',
639-
'@typescript-eslint/no-explicit-any': 'error',
640-
'@typescript-eslint/no-floating-promises': 'error',
641-
'@typescript-eslint/no-misused-promises': 'error',
642-
'@typescript-eslint/no-unsafe-argument': 'error',
643-
'@typescript-eslint/no-unsafe-assignment': 'error',
644-
'@typescript-eslint/no-unsafe-call': 'error',
645-
'@typescript-eslint/no-unsafe-member-access': 'error',
646-
'@typescript-eslint/no-unsafe-return': 'error',
647-
'@typescript-eslint/only-throw-error': 'error',
648-
'@typescript-eslint/prefer-promise-reject-errors': 'error',
649-
'@typescript-eslint/use-unknown-in-catch-callback-variable': 'error',
650-
'react-hooks/exhaustive-deps': 'error',
651-
'react-hooks/rules-of-hooks': 'error',
652-
'max-lines': ['error', { max: 1000, skipBlankLines: true, skipComments: true }],
653-
'no-restricted-properties': [
654-
'error',
655-
{ object: 'Reflect', property: 'get', message: 'Use typed property access or parse at the boundary.' },
656-
{ object: 'Reflect', property: 'apply', message: 'Call the function directly.' },
657-
],
658-
'@stylexjs/enforce-extension': 'error',
659-
'@stylexjs/no-legacy-contextual-styles': 'error',
660-
'@stylexjs/no-lookahead-selectors': 'error',
661-
'@stylexjs/no-nonstandard-styles': 'error',
662-
'@stylexjs/no-conflicting-props': 'error',
663-
'@stylexjs/no-unused': 'error',
664-
'@stylexjs/sort-keys': 'error',
665-
'@stylexjs/valid-shorthands': 'error',
666-
'@stylexjs/valid-styles': 'error',
667-
'no-restricted-syntax': [
668-
'error',
669-
{
670-
selector: "Property > Literal.key[value='&:hover']",
671-
message: "Use hover() from mosaic/utils instead of bare '&:hover'.",
672-
},
673-
noLeakedConditionalJsx,
674-
{
675-
selector: "JSXOpeningElement[name.name='form']",
676-
message: 'Use `Form` from mosaic/primitives/form, which turns off the browser validation popup.',
677-
},
678-
{
679-
selector: "Property > Literal.key[value='@media (hover: hover)']",
680-
message: "Use hover() from mosaic/utils instead of raw '@media (hover: hover)'.",
681-
},
682-
{
683-
selector: "Property > Literal.key[value='@media (prefers-reduced-motion: no-preference)']",
684-
message:
685-
"Use motionSafe() from mosaic/utils instead of raw '@media (prefers-reduced-motion: no-preference)'.",
686-
},
687-
// A Mosaic part takes `xstyle`, not `className`/`style`; its prop types already reject the pair,
688-
// this names the replacement. Native elements (lowercase) are unaffected.
689-
{
690-
selector:
691-
"JSXOpeningElement[name.type='JSXIdentifier'][name.name=/^[A-Z]/] > JSXAttribute[name.name=/^(className|style)$/]",
692-
message: 'Mosaic parts take `xstyle` (StyleX atoms) instead of `className`/`style`.',
693-
},
694-
{
695-
selector:
696-
"JSXOpeningElement[name.type='JSXMemberExpression'] > JSXAttribute[name.name=/^(className|style)$/]",
697-
message: 'Mosaic parts take `xstyle` (StyleX atoms) instead of `className`/`style`.',
698-
},
699-
// `{...stylex.props(x)}` is the same pair by another route; the types miss it because a
700-
// spread's optional keys skip excess-property checks.
701-
{
702-
selector:
703-
"JSXOpeningElement[name.type='JSXIdentifier'][name.name=/^[A-Z]/] > JSXSpreadAttribute > CallExpression[callee.object.name='stylex'][callee.property.name='props']",
704-
message: 'Mosaic parts take the atoms as `xstyle`, not a `stylex.props(...)` spread.',
705-
},
706-
{
707-
selector:
708-
"JSXOpeningElement[name.type='JSXMemberExpression'] > JSXSpreadAttribute > CallExpression[callee.object.name='stylex'][callee.property.name='props']",
709-
message: 'Mosaic parts take the atoms as `xstyle`, not a `stylex.props(...)` spread.',
710-
},
711-
],
712-
},
713-
},
714-
{
715-
name: 'packages/mosaic/jsx-a11y',
716-
files: ['packages/mosaic/src/**/*'],
717-
rules: {
718-
// Mosaic renders elements through `render={p => <el {...p} />}`, so children and controls sit on
719-
// the outer component. Both rules only see the empty inner element and always report.
720-
'jsx-a11y/heading-has-content': 'off',
721-
'jsx-a11y/label-has-associated-control': 'off',
722-
},
723-
},
724-
{
725-
// StyleX `create()` files author conditions raw (`@media (hover: hover)`, `:hover`) — StyleX
726-
// is compile-time and cannot inline a `hover()`/`motionSafe()` helper imported into `create`,
727-
// so the media-query restrictions above (an Emotion-runtime convention) can't apply here. The
728-
// `@stylexjs/*` rules from the mosaic block still cover these files.
729-
name: 'packages/mosaic - stylex styles',
730-
files: ['packages/mosaic/src/**/*.styles.ts'],
731-
rules: {
732-
'no-restricted-syntax': 'off',
733-
},
734-
},
735-
{
736-
// Primitives are unstyled and take `className`/`style` like any other headless component; the
737-
// `xstyle`-only rule targets styled Mosaic parts and otherwise false-positives on things like
738-
// `<FloatingOverlay style={...}>`, a third-party component, not a Mosaic part.
739-
name: 'packages/mosaic - primitives',
740-
files: ['packages/mosaic/src/primitives/**/*'],
741-
ignores: ['packages/mosaic/src/**/*.test.{ts,tsx}'],
742-
rules: {
743-
'no-restricted-syntax': ['error', noLeakedConditionalJsx],
744-
},
745-
},
746611
{
747612
name: 'packages - vitest',
748613
files: ['packages/*/src/**/*.test.{ts,tsx}'],
@@ -819,18 +684,6 @@ export default tseslint.config([
819684
],
820685
},
821686
},
822-
{
823-
name: 'packages/swingset',
824-
files: ['packages/swingset/src/**/*'],
825-
rules: {
826-
'turbo/no-undeclared-env-vars': [
827-
'error',
828-
{
829-
allowList: ['SWINGSET_DASHBOARD_URL'],
830-
},
831-
],
832-
},
833-
},
834687
{
835688
name: 'packages/upgrade',
836689
files: ['packages/upgrade/src/**/*'],

0 commit comments

Comments
 (0)