Skip to content

Commit

Permalink
Update error message for aphrodite-add-style-variable-name rule (#1096)
Browse files Browse the repository at this point in the history
## Summary:
Updating the error message so it is more useful (noticed this after testing with the demo project)

Previously: `Variable name "div" does not match tag name "div". Variable name should be "StyledDiv"`

<img width="1203" alt="Screenshot 2024-12-13 at 2 26 27 PM" src="https://github.com/user-attachments/assets/1d3fd862-461f-4afd-b4bf-10c4ae7368be" />



New: `Variable name "div" does not match the expected naming convention. Expected: "StyledDiv"` 

Issue: FEI-5952

## Test plan:
- Tests continue to pass
- Will integrate with the demo project once this update is released!

Author: beaesguerra

Reviewers: kevinb-khan

Required Reviewers:

Approved By: kevinb-khan

Checks: ✅ Test (macos-latest, 20.x), ✅ CodeQL, ✅ gerald, ✅ Lint, typecheck, and coverage check (ubuntu-latest, 20.x), ✅ Prime node_modules cache for primary configuration (ubuntu-latest, 20.x), ✅ Analyze (javascript), ✅ gerald, ⏭️  dependabot

Pull Request URL: #1096
  • Loading branch information
beaesguerra authored Dec 13, 2024
1 parent 8f4b545 commit afc8d77
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 10 deletions.
5 changes: 5 additions & 0 deletions .changeset/perfect-cycles-fry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@khanacademy/eslint-plugin": patch
---

Update error message for `aphrodite-add-style-variable-name` rule
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const createRule = ESLintUtils.RuleCreator<MyPluginDocs>(
type Options = [];
type MessageIds = "errorString";

const message = `Variable name "{{ variableName }}" does not match tag name "{{ tagName }}". Variable name should be "{{ expectedName }}"`;
const message = `Variable name "{{ variableName }}" does not match the expected naming convention. Expected: "{{ expectedName }}"`;

/**
* Converts a string into PascalCase.
Expand Down Expand Up @@ -99,7 +99,6 @@ export default createRule<Options, MessageIds>({
messageId: "errorString",
data: {
variableName,
tagName,
expectedName,
},
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ ruleTester.run(ruleName, rule, {
messageId: "errorString",
data: {
variableName: "foo",
tagName: "div",
expectedName: "StyledDiv",
},
},
Expand All @@ -93,7 +92,6 @@ ruleTester.run(ruleName, rule, {
messageId: "errorString",
data: {
variableName: "div",
tagName: "div",
expectedName: "StyledDiv",
},
},
Expand All @@ -106,7 +104,6 @@ ruleTester.run(ruleName, rule, {
messageId: "errorString",
data: {
variableName: "span",
tagName: "span",
expectedName: "StyledSpan",
},
},
Expand All @@ -119,7 +116,6 @@ ruleTester.run(ruleName, rule, {
messageId: "errorString",
data: {
variableName: "p",
tagName: "p",
expectedName: "StyledP",
},
},
Expand All @@ -132,7 +128,6 @@ ruleTester.run(ruleName, rule, {
messageId: "errorString",
data: {
variableName: "styledDiv",
tagName: "div",
expectedName: "StyledDiv",
},
},
Expand All @@ -145,7 +140,6 @@ ruleTester.run(ruleName, rule, {
messageId: "errorString",
data: {
variableName: "FooBar",
tagName: "foo-bar",
expectedName: "StyledFooBar",
},
},
Expand All @@ -158,7 +152,6 @@ ruleTester.run(ruleName, rule, {
messageId: "errorString",
data: {
variableName: "FooBar",
tagName: "foo_bar",
expectedName: "StyledFooBar",
},
},
Expand All @@ -171,7 +164,6 @@ ruleTester.run(ruleName, rule, {
messageId: "errorString",
data: {
variableName: "FooBar",
tagName: "FooBar",
expectedName: "StyledFooBar",
},
},
Expand Down

0 comments on commit afc8d77

Please sign in to comment.