Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/rules/no-empty-definitions.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,10 @@ export default {
},

messages: {
emptyDefinition: "Unexpected empty definition found.",
emptyDefinition:
"Unexpected empty definition `{{ identifier }}` found.",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To the team: I think using backticks here would be fine, since the similar rule no-unused-definition uses backticks as well.

"Unexpected unused footnote definition `{{ identifier }}` found.",

emptyFootnoteDefinition:
"Unexpected empty footnote definition found.",
"Unexpected empty footnote definition `{{ identifier }}` found.",
},

schema: [
Expand Down Expand Up @@ -114,6 +115,7 @@ export default {
context.report({
loc: node.position,
messageId: "emptyDefinition",
data: { identifier: node.identifier },
});
}
},
Expand All @@ -132,6 +134,7 @@ export default {
context.report({
loc: node.position,
messageId: "emptyFootnoteDefinition",
data: { identifier: node.identifier },
});
}
},
Expand Down
18 changes: 18 additions & 0 deletions tests/rules/no-empty-definitions.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ ruleTester.run("no-empty-definitions", rule, {
errors: [
{
messageId: "emptyDefinition",
data: { identifier: "foo" },
line: 1,
column: 1,
endLine: 1,
Expand All @@ -176,6 +177,7 @@ ruleTester.run("no-empty-definitions", rule, {
errors: [
{
messageId: "emptyDefinition",
data: { identifier: "foo" },
line: 1,
column: 1,
endLine: 1,
Expand All @@ -191,13 +193,15 @@ ruleTester.run("no-empty-definitions", rule, {
errors: [
{
messageId: "emptyDefinition",
data: { identifier: "foo" },
line: 1,
column: 1,
endLine: 1,
endColumn: 9,
},
{
messageId: "emptyDefinition",
data: { identifier: "bar" },
line: 2,
column: 1,
endLine: 2,
Expand All @@ -210,6 +214,7 @@ ruleTester.run("no-empty-definitions", rule, {
errors: [
{
messageId: "emptyFootnoteDefinition",
data: { identifier: "note" },
line: 1,
column: 1,
endLine: 1,
Expand All @@ -222,6 +227,7 @@ ruleTester.run("no-empty-definitions", rule, {
errors: [
{
messageId: "emptyFootnoteDefinition",
data: { identifier: "note" },
line: 1,
column: 1,
endLine: 1,
Expand All @@ -234,6 +240,7 @@ ruleTester.run("no-empty-definitions", rule, {
errors: [
{
messageId: "emptyFootnoteDefinition",
data: { identifier: "note" },
line: 1,
column: 1,
endLine: 1,
Expand All @@ -246,13 +253,15 @@ ruleTester.run("no-empty-definitions", rule, {
errors: [
{
messageId: "emptyFootnoteDefinition",
data: { identifier: "a" },
line: 1,
column: 1,
endLine: 1,
endColumn: 6,
},
{
messageId: "emptyFootnoteDefinition",
data: { identifier: "b" },
line: 2,
column: 1,
endLine: 2,
Expand All @@ -265,13 +274,15 @@ ruleTester.run("no-empty-definitions", rule, {
errors: [
{
messageId: "emptyDefinition",
data: { identifier: "foo" },
line: 1,
column: 1,
endLine: 1,
endColumn: 9,
},
{
messageId: "emptyFootnoteDefinition",
data: { identifier: "note" },
line: 2,
column: 1,
endLine: 2,
Expand All @@ -285,6 +296,7 @@ ruleTester.run("no-empty-definitions", rule, {
errors: [
{
messageId: "emptyDefinition",
data: { identifier: "foo" },
line: 1,
column: 1,
endLine: 1,
Expand All @@ -297,6 +309,7 @@ ruleTester.run("no-empty-definitions", rule, {
errors: [
{
messageId: "emptyFootnoteDefinition",
data: { identifier: "foo" },
line: 1,
column: 1,
endLine: 1,
Expand All @@ -311,6 +324,7 @@ ruleTester.run("no-empty-definitions", rule, {
errors: [
{
messageId: "emptyFootnoteDefinition",
data: { identifier: "foo" },
line: 1,
column: 1,
endLine: 2,
Expand All @@ -325,6 +339,7 @@ ruleTester.run("no-empty-definitions", rule, {
errors: [
{
messageId: "emptyFootnoteDefinition",
data: { identifier: "foo" },
line: 1,
column: 1,
endLine: 2,
Expand All @@ -337,6 +352,7 @@ ruleTester.run("no-empty-definitions", rule, {
errors: [
{
messageId: "emptyDefinition",
data: { identifier: "foo" },
line: 2,
column: 1,
endLine: 2,
Expand All @@ -355,6 +371,7 @@ ruleTester.run("no-empty-definitions", rule, {
errors: [
{
messageId: "emptyDefinition",
data: { identifier: "foo" },
line: 1,
column: 1,
endLine: 1,
Expand All @@ -373,6 +390,7 @@ ruleTester.run("no-empty-definitions", rule, {
errors: [
{
messageId: "emptyFootnoteDefinition",
data: { identifier: "foo" },
line: 1,
column: 1,
endLine: 1,
Expand Down
Loading