Skip to main content
Skip to Content
interlace
Plugin: react-featuresRules

jsx-pascal-case

Enforce PascalCase for user-defined JSX components

Next step

jsx-pascal-case ships in eslint-plugin-react-features, with 11 of its 68 rules in the recommended preset.

Install
npm install -D eslint-plugin-react-features
eslint.config.js
import { configs } from 'eslint-plugin-react-features';

export default [configs.recommended];

Plugin pagenpmSource on GitHub

A JSX tag that starts with a capital letter is a component reference, and the convention is PascalCase: <MyComponent />, not <my_component /> or <Foo_bar />. This rule is part of eslint-plugin-react-features and follows eslint-plugin-react/jsx-pascal-case in behaviour and options. Its upstream test cases (eslint-plugin-react 7.37.5, MIT) run against it: 85 of 85 agree.

Quick Summary

AspectDetails
SeverityWarning (style)
Auto-Fix❌ No auto-fix
CategoryReact
ESLint MCP✅ Optimized for ESLint MCP integration
Best ForProjects that name components in PascalCase

Rule Details

Intrinsic elements (<div />, <svg:rect />) start with a lower-case letter and are never checked, and neither is a single-letter name (<T />), which cannot be told from a type parameter. Every other tag name must be PascalCase: an upper-case first letter, letters and digits only, and at least one lower-case letter or digit (<YMCA /> is not PascalCase, unless allowAllCaps is on). For <Foo.Bar /> and <Foo:Bar /> each part is checked, unless allowNamespace limits the check to the first.

Letters are judged by Unicode case, so <Año /> and <Éurströmming /> pass.

Examples

❌ Incorrect

<Test_component />

<TEST_COMPONENT />

<Styled.h1 />

✅ Correct

<div />

<TestComponent />

<Test1Component />

<Modal.Header />

<T />

Options

OptionTypeDefaultDescription
allowAllCapsbooleanfalseAlso accept SCREAMING_SNAKE_CASE: <TEST_COMPONENT />, <YMCA />
allowLeadingUnderscorebooleanfalseIgnore one leading _ before judging the name: <_TestComponent />
allowNamespacebooleanfalseJudge only the first part of <Foo.bar />, so a lower-case member such as <Styled.h1 /> passes
ignorestring[][]Names to leave alone, each a name or a glob (*, ?, [ab], {a,b}, +(a|b)). A part is matched on its own, not the whole A.B
'react-features/jsx-pascal-case': ['error', { allowAllCaps: true, ignore: [] }]

The ignore globs are matched by a small matcher inside the package (the package has no runtime dependencies), written to agree with minimatch for the patterns a component name can meet.

Use this rule

npm install -D eslint-plugin-react-features
eslint.config.js
import reactFeatures from 'eslint-plugin-react-features';export default [  {    plugins: { 'react-features': reactFeatures },    rules: {      'react-features/jsx-pascal-case': 'error'    },  },];
npm install -D oxlint-plugin-react-features
.oxlintrc.json
{  "jsPlugins": ["oxlint-plugin-react-features"],  "rules": {    "react-features/jsx-pascal-case": "error"  }}
vite.config.ts
import { defineConfig } from 'vite-plus';export default defineConfig({  lint: {    jsPlugins: ['oxlint-plugin-react-features'],    rules: {      'react-features/jsx-pascal-case': 'error',    },  },});

oxlint-plugin-react-features re-exports eslint-plugin-react-features/oxlint: the same rules under the same IDs, and no ESLint install. Why oxlint.

Did this rule catch something? Star the repo to get new CWE coverage as we ship it — or follow the AI-code-security benchmarks behind these rules.