diff --git a/rules/text-encoding-identifier-case.js b/rules/text-encoding-identifier-case.js
index 23a76531f2..5902de5647 100644
--- a/rules/text-encoding-identifier-case.js
+++ b/rules/text-encoding-identifier-case.js
@@ -39,6 +39,20 @@ const create = () => ({
return;
}
+ if (
+ node.value === 'utf-8'
+ && node.parent.type === 'JSXAttribute'
+ && node.parent.value === node
+ && node.parent.name.type === 'JSXIdentifier'
+ && node.parent.name.name.toLowerCase() === 'charset'
+ && node.parent.parent.type === 'JSXOpeningElement'
+ && node.parent.parent.attributes.includes(node.parent)
+ && node.parent.parent.name.type === 'JSXIdentifier'
+ && node.parent.parent.name.name.toLowerCase() === 'meta'
+ ) {
+ return;
+ }
+
const {raw} = node;
const value = raw.slice(1, -1);
diff --git a/test/snapshots/text-encoding-identifier-case.mjs.md b/test/snapshots/text-encoding-identifier-case.mjs.md
index de592321d8..3889dc16eb 100644
--- a/test/snapshots/text-encoding-identifier-case.mjs.md
+++ b/test/snapshots/text-encoding-identifier-case.mjs.md
@@ -279,3 +279,59 @@ Generated by [AVA](https://avajs.dev).
> 1 | whatever.readFile(file, "UTF-8",)␊
| ^^^^^^^ Prefer \`utf8\` over \`UTF-8\`.␊
`
+
+## Invalid #1
+ 1 |
+
+> Error 1/1
+
+ `␊
+ > 1 | ␊
+ | ^^^^^^^ Prefer \`utf8\` over \`utf-8\`.␊
+ ␊
+ --------------------------------------------------------------------------------␊
+ Suggestion 1/1: Replace \`utf-8\` with \`utf8\`.␊
+ 1 | ␊
+ `
+
+## Invalid #2
+ 1 |
+
+> Error 1/1
+
+ `␊
+ > 1 | ␊
+ | ^^^^^^^ Prefer \`utf8\` over \`utf-8\`.␊
+ ␊
+ --------------------------------------------------------------------------------␊
+ Suggestion 1/1: Replace \`utf-8\` with \`utf8\`.␊
+ 1 | ␊
+ `
+
+## Invalid #3
+ 1 |
+
+> Error 1/1
+
+ `␊
+ > 1 | ␊
+ | ^^^^^^^ Prefer \`ascii\` over \`ASCII\`.␊
+ ␊
+ --------------------------------------------------------------------------------␊
+ Suggestion 1/1: Replace \`ASCII\` with \`ascii\`.␊
+ 1 | ␊
+ `
+
+## Invalid #4
+ 1 |
+
+> Error 1/1
+
+ `␊
+ > 1 | ␊
+ | ^^^^^^^ Prefer \`ascii\` over \`ASCII\`.␊
+ ␊
+ --------------------------------------------------------------------------------␊
+ Suggestion 1/1: Replace \`ASCII\` with \`ascii\`.␊
+ 1 | ␊
+ `
diff --git a/test/snapshots/text-encoding-identifier-case.mjs.snap b/test/snapshots/text-encoding-identifier-case.mjs.snap
index a3d0ae8d8e..bfe80c846b 100644
Binary files a/test/snapshots/text-encoding-identifier-case.mjs.snap and b/test/snapshots/text-encoding-identifier-case.mjs.snap differ
diff --git a/test/text-encoding-identifier-case.mjs b/test/text-encoding-identifier-case.mjs
index 155641af6e..a3cd946bce 100644
--- a/test/text-encoding-identifier-case.mjs
+++ b/test/text-encoding-identifier-case.mjs
@@ -35,3 +35,24 @@ test.snapshot({
'whatever.readFile(file, "UTF-8",)',
],
});
+
+// JSX
+test.snapshot({
+ testerOptions: {
+ parserOptions: {
+ ecmaFeatures: {
+ jsx: true,
+ },
+ },
+ },
+ valid: [
+ '',
+ '',
+ ],
+ invalid: [
+ '',
+ '',
+ '',
+ '',
+ ],
+});