Skip to content

Commit 21c9721

Browse files
committed
Add line/column info to jsx-dollar test errors
1 parent 4450bd3 commit 21c9721

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

packages/plugins/eslint-plugin-react-x/src/rules/jsx-dollar.spec.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ ruleTester.run(RULE_NAME, rule, {
1212
errors: [
1313
{
1414
messageId: "jsxDollar",
15+
column: 35,
16+
endColumn: 36,
17+
endLine: 1,
18+
line: 1,
1519
suggestions: [
1620
{
1721
messageId: "removeDollarSign",
@@ -32,6 +36,10 @@ ruleTester.run(RULE_NAME, rule, {
3236
errors: [
3337
{
3438
messageId: "jsxDollar",
39+
column: 23,
40+
endColumn: 24,
41+
endLine: 2,
42+
line: 2,
3543
suggestions: [
3644
{
3745
messageId: "removeDollarSign",
@@ -54,6 +62,10 @@ ruleTester.run(RULE_NAME, rule, {
5462
errors: [
5563
{
5664
messageId: "jsxDollar",
65+
column: 17,
66+
endColumn: 18,
67+
endLine: 2,
68+
line: 2,
5769
suggestions: [
5870
{
5971
messageId: "removeDollarSign",
@@ -76,6 +88,10 @@ ruleTester.run(RULE_NAME, rule, {
7688
errors: [
7789
{
7890
messageId: "jsxDollar",
91+
column: 23,
92+
endColumn: 24,
93+
endLine: 2,
94+
line: 2,
7995
suggestions: [
8096
{
8197
messageId: "removeDollarSign",

packages/plugins/eslint-plugin-react-x/src/rules/jsx-dollar.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export function create(context: RuleContext<MessageID, []>): RuleListener {
5656
line: pos.line,
5757
},
5858
start: {
59-
column: child.loc.start.column + child.value.length - 1,
59+
column: pos.column - 1,
6060
line: pos.line,
6161
},
6262
},

0 commit comments

Comments
 (0)