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.
npm install -D eslint-plugin-react-featuresimport { configs } from 'eslint-plugin-react-features';
export default [configs.recommended];
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
| Aspect | Details |
|---|---|
| Severity | Warning (style) |
| Auto-Fix | ❌ No auto-fix |
| Category | React |
| ESLint MCP | ✅ Optimized for ESLint MCP integration |
| Best For | Projects 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
| Option | Type | Default | Description |
|---|---|---|---|
allowAllCaps | boolean | false | Also accept SCREAMING_SNAKE_CASE: <TEST_COMPONENT />, <YMCA /> |
allowLeadingUnderscore | boolean | false | Ignore one leading _ before judging the name: <_TestComponent /> |
allowNamespace | boolean | false | Judge only the first part of <Foo.bar />, so a lower-case member such as <Styled.h1 /> passes |
ignore | string[] | [] | 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-featuresimport 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{ "jsPlugins": ["oxlint-plugin-react-features"], "rules": { "react-features/jsx-pascal-case": "error" }}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.