fix(app): allow comments at SFC <script> block start

WS-3 session 1b-iii Task 2.

In Vue SFCs, the lines-around-comment rule conflicted with
vue/block-tag-newline at the <script setup>/comment boundary:
- lines-around-comment wants a blank line BEFORE the comment.
- vue/block-tag-newline wants exactly 1 line break after <script>.

Both can't be satisfied simultaneously when a script-block opens with
a leading comment. The session 1b-ii experiment (adding then reverting
blank lines) confirmed empirically these are mutually exclusive.

Resolution: per-*.vue override on lines-around-comment with
beforeBlockComment: false and beforeLineComment: false. Vue SFC
script blocks may now open with a leading comment without requiring
a preceding blank line. The base rule's allowBlockStart: true does
not help here because the <script> tag is not a JS block-start as
far as the AST sees it. All other rule options preserved
(allowBlockStart, allowClassStart, allowObjectStart, allowArrayStart,
ignorePattern: !SECTION).

Resolves the 3 items in PortalLayout.vue, PublicLayout.vue,
AppKpiCard.vue. Base rule remains in force for *.ts files.

Lint baseline: 6 → 3.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-04-29 18:46:21 +02:00
parent f4e0de0e4e
commit 2fc2a569e7

View File

@@ -207,4 +207,27 @@ module.exports = {
typescript: {},
},
},
overrides: [
// Vue SFCs: the base lines-around-comment rule conflicts with
// vue/block-tag-newline at the <script setup>/comment boundary
// (the <script> tag isn't a JS block-start so allowBlockStart
// doesn't kick in, while vue/block-tag-newline forbids the blank
// line that lines-around-comment wants). Disable both
// beforeBlockComment and beforeLineComment for *.vue so a leading
// comment in <script setup> is allowed without a preceding blank.
{
files: ['*.vue'],
rules: {
'lines-around-comment': ['error', {
beforeBlockComment: false,
beforeLineComment: false,
allowBlockStart: true,
allowClassStart: true,
allowObjectStart: true,
allowArrayStart: true,
ignorePattern: '!SECTION',
}],
},
},
],
}