/

  • Analyticsnpmv16.0.0

    • Overview
  • Apollonpmv15.2.1ESM

    • Overview
  • Browserslist-confignpmv15.2.1

    • Overview
  • CMSnpmv16.0.0

    • Overview
    • ContentBuilder
    • InviteUserForm
    • LoginForm
    • RenewPasswordForm
    • WysiwygInput
  • Corenpmv15.2.1

    • Overview
  • Core-Reactnpmv16.0.0

    • Overview
  • DataGridnpmv16.0.0

    • Overview
    • DataGrid
    • DataGridCustomExample
    • ExportButton
    • FilterList
    • Filters
    • FiltersButton
    • FulltextInput
    • HiddenColumns
    • HiddenColumnsButton
    • Pagination
    • RowCounts
    • RowsPerPageSelect
    • SelectedRowsToolbar
    • TableV2
    • ToolbarControl
    • ToolbarCustoms
    • ToolbarTabs
  • Datepickernpmv16.0.0

    • Overview
  • DnDnpmv15.2.1

    • Overview
  • E2E-Playwrightnpmv16.0.0

    • Overview
  • Eslint-confignpmv15.2.1

    • Overview
  • Formnpmv16.0.0

    • Overview
    • AvatarFileInput
    • CheckboxButton
    • CheckboxInput
    • CheckboxList
    • ColorRadioGroup
    • Combobox
    • DatePickerInput
    • DateRangePickerInput
    • DatetimePickerInput
    • Dropzone
    • FileInput
    • Form
    • FormRenderer
    • GpsInput
    • MoneyInput
    • MultiCombobox
    • MultiSelect
    • NumberInput
    • PasswordInput
    • RadioGroup
    • Select
    • TextInput
    • Textarea
    • TimePickerInput
    • Toggle
  • Icons-generatornpmv15.2.1

    • Overview
  • Localizenpmv16.0.0

    • Overview
  • Mailingnpmv15.2.1

    • Overview
  • Oxc-confignpmv16.0.2

    • Overview
  • Page-Buildernpmv15.3.0ESM

    • Overview
  • Page-Builder-CMSnpmv16.0.0ESM

    • Overview
  • Page-Builder-Webnpmv16.0.0ESM

    • Overview
  • Resizernpmv15.2.1

    • Overview
  • Routernpmv16.0.0ESM

    • Overview
  • Scriptsnpmv16.0.2

    • Overview
  • Sentrynpmv15.2.1ESM

    • Overview
  • Smart-addressnpmv15.2.1

    • Overview
  • Stylesnpmv15.2.1

    • Overview
  • UInpmv16.0.0

    • Overview
    • Accordion
    • AlertBubble
    • AnnouncementBar
    • Avatar
    • AvatarFileInput
    • Badge
    • Button
    • ButtonGroup
    • ButtonList
    • Calendar
    • Checkbox
    • CheckboxButton
    • CheckboxInput
    • CheckboxList
    • Chip
    • ColorRadio
    • ColorRadioGroup
    • Combobox
    • DatePicker
    • DatePickerInput
    • DateRangePicker
    • DateRangePickerInput
    • DatetimePicker
    • DatetimePickerInput
    • Dialog
    • Dropdown
    • Dropzone
    • ErrorMessage
    • FileInput
    • FlashMessages
    • FormComponent
    • Icon
    • IconButton
    • ImageGallery
    • InfoBox
    • Input
    • Label
    • Layout
    • Lightbox
    • ListItem
    • Loader
    • Lozenge
    • Menu
    • Message
    • Modal
    • ModalDialog
    • ModalHeader
    • MultiCombobox
    • MultiSelect
    • Pagination
    • Paper
    • Popover
    • Radio
    • RadioGroup
    • RasterImage
    • Select
    • Switch
    • Tabs
    • TextInput
    • TextLink
    • Textarea
    • TimePicker
    • TimePickerInput
    • Toggle
    • Tooltip
    • Typography
  • Wysiwygnpmv16.0.0

    • Overview
Previous← Mailing overviewNextPage-Builder overview →

@uxf/oxc-config

npm

Shared oxlint config layers, the UXF oxlint rules and a reference oxfmt config for UXF frontend projects.

Status

Preview, not yet a replacement for @uxf/eslint-config. This is step 1 of docs/proposals/oxc-toolchain-migration.md in the fe-monorepo. The layers carry:

  • the rules @uxf/eslint-config names explicitly and oxlint implements natively, with the same options and severities (a rule that is WARNING there, i.e. off in CI, is warn here),
  • oxlint's default correctness rules of every plugin a layer enables,
  • the uxf plugin (below), which ports the no-restricted-syntax selectors verbatim,
  • compat/compat and n/no-deprecated-api from eslint-plugin-compat and eslint-plugin-n through jsPlugins, with the settings of @uxf/eslint-config (below).

Not here yet, each a later step of the proposal: the presets @uxf/eslint-config spreads (js and typescript-eslint recommended, react recommended, jsx-a11y strict), eslint-plugin-tailwindcss and react/destructuring-assignment through jsPlugins, boolean naming, restricted paths, the type-aware rules (oxlint-tsgolint). Until then a project that switches loses those checks.

Installation

yarn add -D @uxf/oxc-config @uxf/browserslist-config oxlint

oxlint and @uxf/browserslist-config are peer dependencies (yarn dependencies:fix installs them in a project with @uxf/scripts). eslint-plugin-compat and eslint-plugin-n are dependencies of this package; they declare eslint as a peer, so npm installs ESLint along and Yarn 1 warns about it, but oxlint does not need it to run them.

Usage

A project inherits exactly one layer. extends takes a path relative to the config file, not a package name:

// .oxlintrc.json
{
    "extends": ["./node_modules/@uxf/oxc-config/oxlintrc/next.json"],
    "rules": {
        "no-console": "off",
    },
}

Rules set in the project config override the inherited ones, including the uxf/* rules.

LayerExtendsAddsFor
baseplugins typescript, unicorn, oxc, import, uxf, nplain TypeScript
nodebaseplugin node, no-console offscripts/, API, code generators
e2ebaseno-console offe2e/ (Playwright)
react-corebaseplugin react with the hooks and React Compiler rulesshared by react and email
reactreact-coreplugins jsx-a11y, compatReact code
nextreactplugin nextjsweb/, backoffice/
emailreact-corenothing: React without jsx-a11yreact-email templates

How the layers compose

These are oxlint's rules for extends, verified with oxlint 1.93:

  • plugins, jsPlugins, rules and overrides are inherited and merge, so a layer only lists what it adds. A layer cannot remove what it inherits, which is why react and email share react-core instead of email being "react minus jsx-a11y".
  • env, globals and settings are not inherited. oxlint reads them only from the config file it loads, i.e. the project's. base therefore sets its globals in an overrides entry for all files, which is inherited: browser, Node.js and Jest globals in every layer, as in @uxf/eslint-config. A project's own env adds to them and cannot remove them. Without env.node, Buffer would not be a known global and n/no-deprecated-api would miss new Buffer(). settings cannot go into overrides, so compat/compat gets its settings from the plugin itself (below).
  • oxlint --print-config does not list inherited jsPlugins, although they run.
  • A JS plugin is loaded only when the active config declares it.

Nested configs

oxlint looks for a .oxlintrc.json in every directory and merges a parent config into the child ones. In a project with web/, backoffice/ and e2e/, either give each directory its own config and put none in the root, or run oxlint with --disable-nested-config.

The uxf plugin

plugins/uxf.mjs, loaded by base through jsPlugins. The rules are the three no-restricted-syntax entries of @uxf/eslint-config, with the same selectors and messages, split into separate rules so that a project can turn one off by name.

RuleReportsUse instead
uxf/prefer-atlist[0]: index access with a numeric literallist.at(0)
uxf/no-record-stringRecord<string, T> outside PartialPartial<Record<string, T>> or a union key
uxf/no-partial-record-anyPartial<Record<string, any>>AnyObject from @uxf/core/types

All three are warn. The plugin uses the ESLint rule API, so it loads into ESLint too.

Browser support and deprecated Node.js APIs

react (and so next) runs compat/compat as an error: a web API (URLPattern, requestIdleCallback, ClipboardItem …) or an ES built-in on a global (Intl.Segmenter) that a supported browser lacks. plugins/compat.mjs loads eslint-plugin-compat under its own name, so the rule and its disable comments stay compat/compat, and gives it the settings of @uxf/eslint-config:

SettingValueWhy
browsersthe list from @uxf/browserslist-configthe check holds even in a project without a browserslist
lintAllEsApistruea project that keeps a Babel config is checked for ES APIs
polyfills["CookieStore"]kept from @uxf/eslint-config, so new CookieStore() is not reported

A key in the project's settings replaces the default, so a project that sets its own polyfills repeats "CookieStore". A green lint is no proof of support: the plugin's API data is frozen at about the end of 2024 (Promise.try, URL.parse, Iterator.from pass), instance methods (arr.toSorted()) are not checked, and only an if counts as a feature check (a ternary or ?. is still reported).

base runs n/no-deprecated-api as an error: url.parse, new Buffer(), fs.exists and other deprecated Node.js APIs. Node.js is kept on the latest LTS, so the version-range rules of eslint-plugin-n are not enabled.

Both plugins run in oxlint's JS runtime: on the 2,000 files of the fe-monorepo each adds 1.1–1.3 s.

oxfmt

oxfmtrc.json is a reference, copied into the project root as .oxfmtrc.json, not extended: oxfmt has no extends and ignores keys it does not know, so an extends key does nothing. It keeps the Prettier settings of UXF projects and adds:

  • sortImports in the order @uxf/eslint-config's import/order uses (external, internal, parent, sibling, index, one block without blank lines), which replaces npm run eslint:fix-imports,
  • sortTailwindcss with the cn, cx and cxa helpers, like prettier-plugin-tailwindcss,
  • sortPackageJson: false, because oxfmt sorts package.json keys by default.

Keep it a JSON file: the code style importer of the JetBrains plugin "Oxc" reads only JSON. In a project whose Tailwind config is not tailwind.config.js in the root, set sortTailwindcss.config.