Skip to content

Commit 554c05b

Browse files
mathiasbynensDevtools-frontend LUCI CQ
authored and
Devtools-frontend LUCI CQ
committed
Convert single-screenshot-assertion-per-test to TypeScript
Bug: chromium:397586315 Change-Id: I41f0bd70e33e4462ff86d7811c95fa71ff7f085e Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6438913 Commit-Queue: Mathias Bynens <mathias@chromium.org> Commit-Queue: Nikolay Vitkov <nvitkov@chromium.org> Auto-Submit: Mathias Bynens <mathias@chromium.org> Reviewed-by: Nikolay Vitkov <nvitkov@chromium.org>
1 parent 5da43d6 commit 554c05b

File tree

2 files changed

+8
-11
lines changed

2 files changed

+8
-11
lines changed

scripts/eslint_rules/lib/single-screenshot-assertion-per-test.js renamed to scripts/eslint_rules/lib/single-screenshot-assertion-per-test.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,12 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
'use strict';
6-
/**
7-
* @type {import('eslint').Rule.RuleModule}
8-
*/
9-
module.exports = {
5+
import {createRule} from './tsUtils.ts';
6+
7+
export default createRule({
8+
name: 'single-screenshot-assertion-per-test',
109
meta: {
1110
type: 'problem',
12-
1311
docs: {
1412
description: 'prevent submitting with variables set to true or false',
1513
category: 'Possible Errors',
@@ -20,6 +18,7 @@ module.exports = {
2018
fixable: 'code',
2119
schema: [] // no options
2220
},
21+
defaultOptions: [],
2322
create: function(context) {
2423
function nodeIsFunctionCallToCheck(node) {
2524
if (node.expression.type === 'CallExpression') {
@@ -83,4 +82,4 @@ module.exports = {
8382
}
8483
};
8584
}
86-
};
85+
});

scripts/eslint_rules/tests/single-screenshot-assertion-per-test.test.js renamed to scripts/eslint_rules/tests/single-screenshot-assertion-per-test.test.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
// Copyright 2023 The Chromium Authors. All rights reserved.
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
4+
import rule from '../lib/single-screenshot-assertion-per-test.ts';
45

5-
'use strict';
6-
const rule = require('../lib/single-screenshot-assertion-per-test.js');
7-
8-
const {RuleTester} = require('./utils/utils.js');
6+
import {RuleTester} from './utils/tsUtils.ts';
97

108
new RuleTester().run('single-screenshot-assertion-per-test', rule, {
119
valid: [

0 commit comments

Comments
 (0)