Skip to content

Commit

Permalink
Add the missing handlings for the closing script and style tags and t…
Browse files Browse the repository at this point in the history
…wo tests
  • Loading branch information
FlorentinBouchendhomme committed Jan 16, 2025
1 parent 1fbd81f commit 014ab12
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/eslint-plugin/lib/rules/indent/indent.js
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,7 @@ module.exports = {
},
OpenScriptTagStart: checkIndent,
OpenScriptTagEnd: checkIndent,
CloseScriptTag: checkIndent,
StyleTag(node) {
indentLevel.indent(node);
},
Expand All @@ -279,6 +280,7 @@ module.exports = {
},
OpenStyleTagStart: checkIndent,
OpenStyleTagEnd: checkIndent,
CloseStyleTag: checkIndent,
OpenTagStart: checkIndent,
OpenTagEnd(node) {
checkIndent(node);
Expand Down
23 changes: 23 additions & 0 deletions packages/eslint-plugin/tests/rules/indent.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,14 @@ function createTests() {
},
],
},
{
code: `
<style>
</style>
<script>
</script>
`
}
],
invalid: [
{
Expand Down Expand Up @@ -1053,6 +1061,21 @@ id="bar"
},
],
},
{
code: `
<style>
</style>
<script>
</script>
`,
output: `
<style>
</style>
<script>
</script>
`,
errors: wrongIndentErrors(2),
}
],
};
}
Expand Down

0 comments on commit 014ab12

Please sign in to comment.