豆豆友情提示:这是一个非官方 GitHub 代理镜像,主要用于网络测试或访问加速。请勿在此进行登录、注册或处理任何敏感信息。进行这些操作请务必访问官方网站 github.com。 Raw 内容也通过此代理提供。
Skip to content

Commit f028f8c

Browse files
zyzyzyryxyPiotr Paulski
andauthored
chore: Update eslint rule to require empty line after license notice. (#784)
We should make sure there is always an empty line after license notice, otherwise it gets dropped during build if it happens to be before import statement. --------- Co-authored-by: Piotr Paulski <piotrpaulski@chromium.org>
1 parent 6e52e66 commit f028f8c

File tree

12 files changed

+28
-0
lines changed

12 files changed

+28
-0
lines changed

rollup.config.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
* See the License for the specific language governing permissions and
1515
* limitations under the License.
1616
*/
17+
1718
/**
1819
* @fileoverview take from {@link https://github.com/GoogleChromeLabs/chromium-bidi/blob/main/rollup.config.mjs | chromium-bidi}
1920
* and modified to specific requirement.

scripts/eslint_rules/check-license-rule.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ export default {
2424
schema: [],
2525
messages: {
2626
licenseRule: 'Add license header.',
27+
emptyLine: 'Add empty line after license header.',
2728
},
2829
},
2930
defaultOptions: [],
@@ -64,6 +65,22 @@ export default {
6465
header.value.includes('License') ||
6566
header.value.includes('Copyright'))
6667
) {
68+
const nextToken = sourceCode.getTokenAfter(header, {
69+
includeComments: true,
70+
});
71+
if (
72+
nextToken &&
73+
nextToken.loc.start.line === header.loc.end.line + 1
74+
) {
75+
context.report({
76+
node: node,
77+
loc: header.loc,
78+
messageId: 'emptyLine',
79+
fix(fixer) {
80+
return fixer.insertTextAfter(header, '\n');
81+
},
82+
});
83+
}
6784
return;
6885
}
6986

scripts/eval_scenarios/console_test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* Copyright 2026 Google LLC
44
* SPDX-License-Identifier: Apache-2.0
55
*/
6+
67
import assert from 'node:assert';
78

89
import type {TestScenario} from '../eval_gemini.ts';

scripts/eval_scenarios/emulation_test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* Copyright 2026 Google LLC
44
* SPDX-License-Identifier: Apache-2.0
55
*/
6+
67
import assert from 'node:assert';
78

89
import type {TestScenario} from '../eval_gemini.ts';

scripts/eval_scenarios/input_test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* Copyright 2026 Google LLC
44
* SPDX-License-Identifier: Apache-2.0
55
*/
6+
67
import assert from 'node:assert';
78

89
import type {TestScenario} from '../eval_gemini.ts';

scripts/eval_scenarios/navigation_test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* Copyright 2026 Google LLC
44
* SPDX-License-Identifier: Apache-2.0
55
*/
6+
67
import assert from 'node:assert';
78

89
import type {TestScenario} from '../eval_gemini.ts';

scripts/eval_scenarios/network_test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* Copyright 2026 Google LLC
44
* SPDX-License-Identifier: Apache-2.0
55
*/
6+
67
import assert from 'node:assert';
78

89
import type {TestScenario} from '../eval_gemini.ts';

scripts/eval_scenarios/performance_test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* Copyright 2026 Google LLC
44
* SPDX-License-Identifier: Apache-2.0
55
*/
6+
67
import assert from 'node:assert';
78

89
import type {TestScenario} from '../eval_gemini.ts';

scripts/eval_scenarios/snapshot_test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* Copyright 2026 Google LLC
44
* SPDX-License-Identifier: Apache-2.0
55
*/
6+
67
import assert from 'node:assert';
78

89
import type {TestScenario} from '../eval_gemini.ts';

src/formatters/SnapshotFormatter.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* Copyright 2025 Google LLC
44
* SPDX-License-Identifier: Apache-2.0
55
*/
6+
67
import type {TextSnapshot, TextSnapshotNode} from '../McpContext.js';
78

89
export class SnapshotFormatter {

0 commit comments

Comments
 (0)