chrome-devtools-frontend 1.0.947377 → 1.0.948916

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (124) hide show
  1. package/config/gni/all_devtools_files.gni +1 -6
  2. package/config/gni/devtools_grd_files.gni +5 -12
  3. package/config/gni/devtools_image_files.gni +1 -0
  4. package/front_end/.eslintrc.js +1 -0
  5. package/front_end/Images/src/circled_backslash_icon.svg +3 -0
  6. package/front_end/core/host/UserMetrics.ts +1 -1
  7. package/front_end/core/i18n/locales/en-US.json +32 -44
  8. package/front_end/core/i18n/locales/en-XL.json +32 -44
  9. package/front_end/core/platform/platform.ts +0 -2
  10. package/front_end/core/platform/string-utilities.ts +14 -1
  11. package/front_end/core/platform/utilities.ts +0 -29
  12. package/front_end/core/root/Runtime.ts +4 -207
  13. package/front_end/core/sdk/Cookie.ts +0 -21
  14. package/front_end/core/sdk/RemoteObject.ts +15 -1
  15. package/front_end/core/sdk/sdk-legacy.ts +0 -3
  16. package/front_end/entrypoints/devtools_app/{devtools_app-meta-files.ts → devtools_app.ts} +9 -3
  17. package/front_end/entrypoints/heap_snapshot_worker/HeapSnapshot.ts +2 -1
  18. package/front_end/entrypoints/js_app/{JsMain.ts → js_app.ts} +5 -1
  19. package/front_end/entrypoints/main/MainImpl.ts +0 -1
  20. package/front_end/entrypoints/ndb_app/{ndb_app.js → ndb_app.ts} +0 -2
  21. package/front_end/entrypoints/node_app/node_app.ts +1 -3
  22. package/front_end/entrypoints/shell/{shell.js → shell.ts} +0 -2
  23. package/front_end/entrypoints/visibility.gni +3 -1
  24. package/front_end/entrypoints/worker_app/worker_app.ts +1 -4
  25. package/front_end/generated/InspectorBackendCommands.js +8 -1
  26. package/front_end/generated/protocol-mapping.d.ts +4 -0
  27. package/front_end/generated/protocol-proxy-api.d.ts +6 -0
  28. package/front_end/generated/protocol.d.ts +9 -0
  29. package/front_end/legacy/legacy-defs.d.ts +0 -4
  30. package/front_end/legacy_test_runner/test_runner/TestRunner.js +35 -59
  31. package/front_end/models/issues_manager/AttributionReportingIssue.ts +27 -2
  32. package/front_end/models/issues_manager/CorsIssue.ts +15 -15
  33. package/front_end/models/issues_manager/descriptions/{corsInsecurePrivateNetworkPreflight.md → corsPreflightAllowPrivateNetworkError.md} +1 -1
  34. package/front_end/panels/accessibility/AccessibilitySidebarView.ts +3 -1
  35. package/front_end/panels/application/BackForwardCacheStrings.ts +1 -5
  36. package/front_end/panels/application/BackForwardCacheView.ts +150 -58
  37. package/front_end/panels/application/ResourcesPanel.ts +0 -42
  38. package/front_end/panels/application/application-legacy.ts +0 -3
  39. package/front_end/panels/application/application-meta.ts +0 -13
  40. package/front_end/panels/application/backForwardCacheView.css +44 -6
  41. package/front_end/panels/application/components/FrameDetailsView.ts +3 -3
  42. package/front_end/panels/application/components/OriginTrialTreeView.ts +3 -3
  43. package/front_end/panels/application/components/StackTrace.ts +1 -1
  44. package/front_end/panels/console/ConsolePrompt.ts +0 -4
  45. package/front_end/panels/coverage/CoverageView.ts +1 -1
  46. package/front_end/panels/css_overview/components/cssOverviewStartView.css +1 -0
  47. package/front_end/panels/css_overview/cssOverviewCompletedView.css +1 -1
  48. package/front_end/panels/developer_resources/DeveloperResourcesView.ts +2 -1
  49. package/front_end/panels/elements/AccessibilityTreeUtils.ts +1 -7
  50. package/front_end/panels/elements/ElementsPanel.ts +9 -1
  51. package/front_end/panels/elements/ElementsTreeElement.ts +1 -1
  52. package/front_end/panels/elements/PropertiesWidget.ts +109 -4
  53. package/front_end/panels/elements/components/ElementsBreadcrumbs.ts +1 -1
  54. package/front_end/panels/elements/propertiesWidget.css +34 -0
  55. package/front_end/panels/emulation/DeviceModeToolbar.ts +5 -1
  56. package/front_end/panels/issues/CorsIssueDetailsView.ts +20 -8
  57. package/front_end/panels/network/NetworkWaterfallColumn.ts +2 -0
  58. package/front_end/panels/profiler/CPUProfileFlameChart.ts +3 -1
  59. package/front_end/panels/profiler/ProfileDataGrid.ts +2 -1
  60. package/front_end/panels/settings/components/SyncSection.ts +2 -2
  61. package/front_end/panels/settings/emulation/components/UserAgentClientHintsForm.ts +46 -46
  62. package/front_end/panels/timeline/TimelineTreeView.ts +2 -1
  63. package/front_end/ui/components/diff_view/DiffView.ts +4 -4
  64. package/front_end/ui/components/helpers/component-server-setup.ts +1 -12
  65. package/front_end/ui/components/helpers/helpers.ts +0 -2
  66. package/front_end/ui/components/icon_button/IconButton.ts +1 -1
  67. package/front_end/ui/components/issue_counter/IssueCounter.ts +2 -2
  68. package/front_end/ui/components/linear_memory_inspector/LinearMemoryViewer.ts +3 -3
  69. package/front_end/ui/components/markdown_view/MarkdownView.ts +4 -4
  70. package/front_end/ui/components/panel_feedback/PreviewToggle.ts +98 -0
  71. package/front_end/ui/components/panel_feedback/panel_feedback.ts +1 -0
  72. package/front_end/ui/components/panel_feedback/previewToggle.css +24 -0
  73. package/front_end/ui/components/report_view/ReportView.ts +22 -0
  74. package/front_end/ui/components/report_view/reportSection.css +20 -0
  75. package/front_end/ui/components/request_link_icon/RequestLinkIcon.ts +1 -1
  76. package/front_end/ui/components/settings/SettingCheckbox.ts +2 -2
  77. package/front_end/ui/components/text_editor/config.ts +4 -3
  78. package/front_end/ui/components/text_editor/javascript.ts +8 -4
  79. package/front_end/ui/components/text_prompt/TextPrompt.ts +2 -2
  80. package/front_end/ui/legacy/GlassPane.ts +1 -1
  81. package/front_end/ui/legacy/SearchableView.ts +2 -1
  82. package/front_end/ui/legacy/Treeoutline.ts +1 -1
  83. package/front_end/ui/legacy/Widget.ts +1 -1
  84. package/front_end/ui/legacy/XWidget.ts +0 -5
  85. package/front_end/ui/legacy/components/inline_editor/CSSVarSwatch.ts +2 -2
  86. package/front_end/ui/legacy/components/inline_editor/ColorSwatch.ts +1 -1
  87. package/front_end/ui/legacy/utils/append-style.ts +2 -13
  88. package/front_end/ui/legacy/utils/create-shadow-root-with-core-styles.ts +7 -5
  89. package/package.json +2 -4
  90. package/scripts/build/build_inspector_overlay.py +15 -1
  91. package/scripts/build/rjsmin.py +84 -115
  92. package/scripts/eslint_rules/lib/ban_a_tags_in_lit_html.js +2 -11
  93. package/scripts/eslint_rules/lib/ban_literal_devtools_component_tag_names.js +2 -11
  94. package/scripts/eslint_rules/lib/ban_self_closing_custom_element_tagnames.js +2 -11
  95. package/scripts/eslint_rules/lib/ban_style_tags_in_lit_html.js +2 -11
  96. package/scripts/eslint_rules/lib/lit_html_data_as_type.js +2 -11
  97. package/scripts/eslint_rules/lib/lit_html_no_attribute_quotes.js +89 -0
  98. package/scripts/eslint_rules/lib/lit_no_style_interpolation.js +2 -11
  99. package/scripts/eslint_rules/lib/no_only_eslint_tests.js +53 -0
  100. package/scripts/eslint_rules/lib/static_tag_must_be_static_property.js +2 -11
  101. package/scripts/eslint_rules/lib/utils.js +29 -0
  102. package/scripts/eslint_rules/tests/.eslintrc.js +18 -0
  103. package/scripts/eslint_rules/tests/lit_html_no_attribute_quotes_test.js +45 -0
  104. package/scripts/eslint_rules/tests/no_only_eslint_tests_test.js +94 -0
  105. package/scripts/eslint_rules/tests/utils_test.js +40 -0
  106. package/front_end/entrypoints/devtools_app/devtools_app.js +0 -11
  107. package/front_end/entrypoints/devtools_app/devtools_app.json +0 -4
  108. package/front_end/entrypoints/js_app/js_app.js +0 -12
  109. package/front_end/entrypoints/js_app/js_app.json +0 -3
  110. package/front_end/entrypoints/ndb_app/ndb_app.json +0 -4
  111. package/front_end/entrypoints/startup/RuntimeInstantiator.ts +0 -95
  112. package/front_end/entrypoints/startup/startup.ts +0 -9
  113. package/front_end/panels/help/HelpImpl.ts +0 -141
  114. package/front_end/panels/help/ReleaseNoteText.ts +0 -1496
  115. package/front_end/panels/help/ReleaseNoteView.ts +0 -107
  116. package/front_end/panels/help/help-meta.ts +0 -145
  117. package/front_end/panels/help/help.ts +0 -13
  118. package/front_end/panels/help/releaseNote.css +0 -115
  119. package/front_end/ui/components/helpers/get-stylesheet.ts +0 -45
  120. package/scripts/build/build_release_applications.py +0 -216
  121. package/scripts/build/modular_build.py +0 -184
  122. package/scripts/check_gn.js +0 -119
  123. package/scripts/json_validator/module.schema.json +0 -19
  124. package/scripts/json_validator/validate_module_json.js +0 -44
@@ -3,16 +3,7 @@
3
3
  // found in the LICENSE file.
4
4
  'use strict';
5
5
 
6
- function isLitHtmlTemplateCall(taggedTemplateExpression) {
7
- if (taggedTemplateExpression.name) {
8
- // Call to html`` and we assume that html = LitHtml's html function.
9
- return taggedTemplateExpression.name === 'html';
10
- }
11
-
12
- // Match calls to LitHtml.html``
13
- return taggedTemplateExpression.object && taggedTemplateExpression.object.name === 'LitHtml' &&
14
- taggedTemplateExpression.property.name === 'html';
15
- }
6
+ const {isLitHtmlTemplateCall} = require('./utils.js');
16
7
 
17
8
  module.exports = {
18
9
  meta: {
@@ -28,7 +19,7 @@ module.exports = {
28
19
  create: function(context) {
29
20
  return {
30
21
  TaggedTemplateExpression(node) {
31
- const isLitHtmlCall = isLitHtmlTemplateCall(node.tag);
22
+ const isLitHtmlCall = isLitHtmlTemplateCall(node);
32
23
  if (!isLitHtmlCall) {
33
24
  return;
34
25
  }
@@ -3,16 +3,7 @@
3
3
  // found in the LICENSE file.
4
4
  'use strict';
5
5
 
6
- function isLitHtmlTemplateCall(taggedTemplateExpression) {
7
- if (taggedTemplateExpression.name) {
8
- // Call to html`` and we assume that html = LitHtml's html function.
9
- return taggedTemplateExpression.name === 'html';
10
- }
11
-
12
- // Match calls to LitHtml.html``
13
- return taggedTemplateExpression.object && taggedTemplateExpression.object.name === 'LitHtml' &&
14
- taggedTemplateExpression.property.name === 'html';
15
- }
6
+ const {isLitHtmlTemplateCall} = require('./utils.js');
16
7
 
17
8
  function findIndexOfDataSetterUsageForNode(taggedTemplateExpression) {
18
9
  const dataSetterText = '.data=';
@@ -66,7 +57,7 @@ module.exports = {
66
57
  create: function(context) {
67
58
  return {
68
59
  TaggedTemplateExpression(node) {
69
- const isLitHtmlCall = isLitHtmlTemplateCall(node.tag);
60
+ const isLitHtmlCall = isLitHtmlTemplateCall(node);
70
61
  if (!isLitHtmlCall) {
71
62
  return;
72
63
  }
@@ -0,0 +1,89 @@
1
+ // Copyright 2021 The Chromium Authors. All rights reserved.
2
+ // Use of this source code is governed by a BSD-style license that can be
3
+ // found in the LICENSE file.
4
+ 'use strict';
5
+
6
+ const {isLitHtmlTemplateCall} = require('./utils.js');
7
+
8
+ function templateElementPartStartsWithDoubleQuote(templateElementPartNode) {
9
+ return templateElementPartNode.value.raw.startsWith('"');
10
+ }
11
+ function templateElementPartEndsWithEqualsDoubleQuote(templateElementPartNode) {
12
+ return templateElementPartNode.value.raw.endsWith('="');
13
+ }
14
+
15
+ function removeQuotesFromAttribute({fixer, firstPart, secondPart}) {
16
+ const [, rangeOfOpeningTemplatePartEnd] = firstPart.range;
17
+ // From the first part, we need to remove the last character, which is the double quote.
18
+ // We can do this by fetching the range of the node (range = start and end position on the line)
19
+ // However, for the template part with the opening quote, the range will also contain the ${ of the interpolation:
20
+ // <p class="${
21
+ // ^^^^^^^^^^^^ this is the text covered by the [start, end] range.
22
+ // So what we need to do is remove the quote, and leave the last two characters alone.
23
+ // Therefore we remove the third character back from the end, and only remove a single character, leaving the ${ part alone.
24
+ const startingQuoteRangeToRemove = [rangeOfOpeningTemplatePartEnd - 3, rangeOfOpeningTemplatePartEnd - 2];
25
+
26
+ const [rangeOfClosingTemplatePartStart] = secondPart.range;
27
+ // It's a similar story for the second part where the range includes the }:
28
+ // }">foo</p>
29
+ // ^^^^^^^^^^ this is the range
30
+ // So therefore we get the start of the range, and add one to it, to dodge the } character, and then remove only the quote.
31
+ const endingQuoteRangeToRemove = [rangeOfClosingTemplatePartStart + 1, rangeOfClosingTemplatePartStart + 2];
32
+
33
+ return [fixer.removeRange(startingQuoteRangeToRemove), fixer.removeRange(endingQuoteRangeToRemove)];
34
+ }
35
+
36
+ module.exports = {
37
+ meta: {
38
+ type: 'problem',
39
+
40
+ docs: {
41
+ description: 'ensure no extra quotes around attributes when the value is interpolated',
42
+ category: 'Possible Errors',
43
+ },
44
+ fixable: 'code',
45
+ messages: {
46
+ attributeQuotesNotRequired:
47
+ 'When interpolating a value as an attribute in LitHtml you do not need double quotes around it.',
48
+ },
49
+ schema: [] // no options
50
+ },
51
+ create: function(context) {
52
+ return {
53
+ TaggedTemplateExpression(node) {
54
+ if (!isLitHtmlTemplateCall(node)) {
55
+ return;
56
+ }
57
+
58
+ // quasis here = the static parts of a template expression
59
+ // expressions = the dynamic parts of a template expression
60
+ // For example, given: <p class="${foo}"> we will have:
61
+ // quasis: ['<p class="', '">']
62
+ // expressions: ['foo'] (it's actually an AST node representing ${foo})
63
+ // So what we do is walk through and look for quasi pairs where:
64
+ // 1. the first ends with ="
65
+ // 2. the second begins with "
66
+ // We can then be confident that we have found an attribute with quotes around it.
67
+ node.quasi.quasis.forEach((templateElement, index) => {
68
+ if (templateElementPartEndsWithEqualsDoubleQuote(templateElement)) {
69
+ const nextElement = node.quasi.quasis[index + 1];
70
+ if (nextElement && templateElementPartStartsWithDoubleQuote(nextElement)) {
71
+ const expressionBetweenTheParts = node.quasi.expressions[index];
72
+ context.report({
73
+ node: expressionBetweenTheParts,
74
+ messageId: 'attributeQuotesNotRequired',
75
+ fix(fixer) {
76
+ return removeQuotesFromAttribute({
77
+ fixer,
78
+ firstPart: templateElement,
79
+ secondPart: nextElement,
80
+ });
81
+ }
82
+ });
83
+ }
84
+ }
85
+ });
86
+ },
87
+ };
88
+ }
89
+ };
@@ -3,16 +3,7 @@
3
3
  // found in the LICENSE file.
4
4
  'use strict';
5
5
 
6
- function isLitHtmlTemplateCall(taggedTemplateExpression) {
7
- if (taggedTemplateExpression.name) {
8
- // Call to html`` and we assume that html = LitHtml's html function.
9
- return taggedTemplateExpression.name === 'html';
10
- }
11
-
12
- // Match calls to LitHtml.html``
13
- return taggedTemplateExpression.object && taggedTemplateExpression.object.name === 'LitHtml' &&
14
- taggedTemplateExpression.property.name === 'html';
15
- }
6
+ const {isLitHtmlTemplateCall} = require('./utils.js');
16
7
 
17
8
  function countOccurencesOfSubstring(string, subString) {
18
9
  let count = 0;
@@ -71,7 +62,7 @@ module.exports = {
71
62
  create: function(context) {
72
63
  return {
73
64
  TaggedTemplateExpression(node) {
74
- const isLitHtmlCall = isLitHtmlTemplateCall(node.tag);
65
+ const isLitHtmlCall = isLitHtmlTemplateCall(node);
75
66
  if (!isLitHtmlCall) {
76
67
  return;
77
68
  }
@@ -0,0 +1,53 @@
1
+ // Copyright 2021 The Chromium Authors. All rights reserved.
2
+ // Use of this source code is governed by a BSD-style license that can be
3
+ // found in the LICENSE file.
4
+
5
+ module.exports = {
6
+ meta: {
7
+ type: 'problem',
8
+
9
+ docs: {
10
+ description: 'Usage of only: true in ESLint tests',
11
+ category: 'Possible Errors',
12
+ },
13
+ fixable: 'code',
14
+ messages: {noOnlyInESLintTest: 'You cannot use only: true in an ESLint test.'},
15
+ schema: [] // no options
16
+ },
17
+ create: function(context) {
18
+ function checkForOnlyInTestCases(testCaseObjects) {
19
+ for (const testCase of testCaseObjects) {
20
+ const onlyKeyProp = testCase.properties.find(prop => {
21
+ return prop.key.name === 'only';
22
+ });
23
+ if (onlyKeyProp) {
24
+ context.report({
25
+ node: onlyKeyProp,
26
+ messageId: 'noOnlyInESLintTest'
27
+
28
+ });
29
+ }
30
+ }
31
+ }
32
+
33
+ return {
34
+ // match ruleTester.run('foo', rule, {...})
35
+ 'CallExpression[callee.object.name=\'ruleTester\'][callee.property.name=\'run\']'(node) {
36
+ // first argument = string name
37
+ // second argument = rule itself
38
+ // third argument = the object containing the test cases - what we want!
39
+ const tests = node.arguments[2];
40
+ if (!tests) {
41
+ return;
42
+ }
43
+
44
+ for (const testProperty of tests.properties) {
45
+ // Iterate over the "valid" and "invalid" rules
46
+ // Here .value = the array of test cases, and .elements gets us each
47
+ // object (individual test case) within that array.
48
+ checkForOnlyInTestCases(testProperty.value.elements);
49
+ }
50
+ }
51
+ };
52
+ }
53
+ };
@@ -3,16 +3,7 @@
3
3
  // found in the LICENSE file.
4
4
  'use strict';
5
5
 
6
- function isLitHtmlTemplateCall(taggedTemplateExpression) {
7
- if (taggedTemplateExpression.name) {
8
- // Call to html`` and we assume that html = LitHtml's html function.
9
- return taggedTemplateExpression.name === 'html';
10
- }
11
-
12
- // Match calls to LitHtml.html``
13
- return taggedTemplateExpression.object && taggedTemplateExpression.object.name === 'LitHtml' &&
14
- taggedTemplateExpression.property.name === 'html';
15
- }
6
+ const {isLitHtmlTemplateCall} = require('./utils.js');
16
7
 
17
8
  module.exports = {
18
9
  meta: {
@@ -52,7 +43,7 @@ module.exports = {
52
43
 
53
44
  return {
54
45
  TaggedTemplateExpression(node) {
55
- if (!isLitHtmlTemplateCall(node.tag)) {
46
+ if (!isLitHtmlTemplateCall(node)) {
56
47
  return;
57
48
  }
58
49
 
@@ -0,0 +1,29 @@
1
+ // Copyright 2021 The Chromium Authors. All rights reserved.
2
+ // Use of this source code is governed by a BSD-style license that can be
3
+ // found in the LICENSE file.
4
+
5
+ // This file contains utility functions that are commonly needed in ESLint
6
+ // rules. It does not contain any ESLint rules itself.
7
+
8
+ /**
9
+ * @param taggedTemplateExpressionNode - a TaggedTemplateExpression node from the AST of the parsed code.
10
+ * @returns {boolean} - `true` if the code matches LitHtml.html`` or html``, and false otherwise.
11
+ */
12
+ function isLitHtmlTemplateCall(taggedTemplateExpressionNode) {
13
+ if (taggedTemplateExpressionNode.type !== 'TaggedTemplateExpression') {
14
+ throw new Error('Node of type other than TaggedTemplateExpression passed to isLitHtmlTemplateCall.');
15
+ }
16
+ // Match LitHtml.html``
17
+ const {tag} = taggedTemplateExpressionNode;
18
+ if (!tag) {
19
+ return false;
20
+ }
21
+ // Match LitHtml.html``
22
+ const isLitHtmlDotHtmlCall = tag.object?.name === 'LitHtml' && tag.property?.name === 'html';
23
+ // Match html`` (and guess that it's Lit)
24
+ const isDestructuredHtmlCall = tag.type === 'Identifier' && tag.name === 'html';
25
+
26
+ return isLitHtmlDotHtmlCall || isDestructuredHtmlCall;
27
+ }
28
+
29
+ module.exports = {isLitHtmlTemplateCall};
@@ -0,0 +1,18 @@
1
+ // Copyright 2021 The Chromium Authors. All rights reserved.
2
+ // Use of this source code is governed by a BSD-style license that can be
3
+ // found in the LICENSE file.
4
+
5
+ const path = require('path');
6
+ const rulesDirPlugin = require('eslint-plugin-rulesdir');
7
+
8
+ rulesDirPlugin.RULES_DIR = path.join(__dirname, '..', 'lib');
9
+
10
+ module.exports = {
11
+ 'rules': {
12
+ 'rulesdir/no_only_eslint_tests': 2,
13
+ // errors on it('test') with no body
14
+ 'mocha/no-pending-tests': 2,
15
+ // errors on {describe, it}.only
16
+ 'mocha/no-exclusive-tests': 2,
17
+ }
18
+ };
@@ -0,0 +1,45 @@
1
+ // Copyright 2021 The Chromium Authors. All rights reserved.
2
+ // Use of this source code is governed by a BSD-style license that can be
3
+ // found in the LICENSE file.
4
+ 'use strict';
5
+
6
+ const rule = require('../lib/lit_html_no_attribute_quotes.js');
7
+ const ruleTester = new (require('eslint').RuleTester)({
8
+ parserOptions: {ecmaVersion: 9, sourceType: 'module'},
9
+ parser: require.resolve('@typescript-eslint/parser'),
10
+ });
11
+
12
+ ruleTester.run('lit_html_no_attribute_quotes', rule, {
13
+ valid: [
14
+ {
15
+ code: 'LitHtml.html`<p class=${foo}>foo</p>`',
16
+ filename: 'front_end/components/datagrid.ts',
17
+ },
18
+ {
19
+ code: 'LitHtml.html`<p class=${foo}>"${someOutput}"</p>`',
20
+ filename: 'front_end/components/datagrid.ts',
21
+ },
22
+ {
23
+ code: 'html`<p class=${foo}>"${someOutput}"</p>`',
24
+ filename: 'front_end/components/datagrid.ts',
25
+ },
26
+ {
27
+ code: 'html`<p class="my-${fooClassName}">"${someOutput}"</p>`',
28
+ filename: 'front_end/components/datagrid.ts',
29
+ },
30
+ ],
31
+ invalid: [
32
+ {
33
+ code: 'LitHtml.html`<p class="${foo}">foo</p>`',
34
+ filename: 'front_end/components/datagrid.ts',
35
+ errors: [{messageId: 'attributeQuotesNotRequired', column: 26, line: 1}],
36
+ output: 'LitHtml.html`<p class=${foo}>foo</p>`',
37
+ },
38
+ {
39
+ code: 'html`<p class="${foo}">foo</p>`',
40
+ filename: 'front_end/components/datagrid.ts',
41
+ errors: [{messageId: 'attributeQuotesNotRequired'}],
42
+ output: 'html`<p class=${foo}>foo</p>`',
43
+ },
44
+ ]
45
+ });
@@ -0,0 +1,94 @@
1
+ // Copyright 2021 The Chromium Authors. All rights reserved.
2
+ // Use of this source code is governed by a BSD-style license that can be
3
+ // found in the LICENSE file.
4
+
5
+ const rule = require('../lib/no_only_eslint_tests.js');
6
+ const ruleTester = new (require('eslint').RuleTester)({
7
+ parserOptions: {ecmaVersion: 9, sourceType: 'module'},
8
+ });
9
+
10
+ ruleTester.run('no_only_eslint_tests', rule, {
11
+ valid: [
12
+ {
13
+ code: `ruleTester.run('my_eslint_rule', rule, {
14
+ valid: [{
15
+ code: 'foo',
16
+ filename: 'foo.ts',
17
+ }]
18
+ })`,
19
+ filename: 'scripts/eslint_rules/tests/foo_test.js',
20
+ },
21
+ {
22
+ code: `ruleTester.run('my_eslint_rule', rule, {
23
+ invalid: [{
24
+ code: 'foo',
25
+ filename: 'foo.ts',
26
+ }]
27
+ })`,
28
+ filename: 'scripts/eslint_rules/tests/foo_test.js',
29
+ },
30
+ ],
31
+
32
+ invalid: [
33
+ {
34
+ code: `ruleTester.run('my_eslint_rule', rule, {
35
+ valid: [{
36
+ only: true,
37
+ code: 'foo',
38
+ filename: 'foo.ts',
39
+ }]
40
+ })`,
41
+ filename: 'scripts/eslint_rules/tests/foo_test.js',
42
+ errors: [{messageId: 'noOnlyInESLintTest'}],
43
+ },
44
+ {
45
+ code: `ruleTester.run('my_eslint_rule', rule, {
46
+ invalid: [{
47
+ only: true,
48
+ code: 'foo',
49
+ filename: 'foo.ts',
50
+ errors: [{ messagId: 'foo' }]
51
+ }]
52
+ })`,
53
+ filename: 'scripts/eslint_rules/tests/foo_test.js',
54
+ errors: [{messageId: 'noOnlyInESLintTest'}],
55
+ },
56
+ {
57
+ code: `ruleTester.run('my_eslint_rule', rule, {
58
+ valid: [{
59
+ only: true,
60
+ code: 'foo',
61
+ filename: 'foo.ts',
62
+ }],
63
+ invalid: [{
64
+ only: true,
65
+ code: 'foo',
66
+ filename: 'foo.ts',
67
+ errors: [{ messagId: 'foo' }]
68
+ }]
69
+ })`,
70
+ filename: 'scripts/eslint_rules/tests/foo_test.js',
71
+ errors: [{messageId: 'noOnlyInESLintTest'}, {messageId: 'noOnlyInESLintTest'}],
72
+ },
73
+ {
74
+ code: `ruleTester.run('my_eslint_rule', rule, {
75
+ valid: [{
76
+ only: true,
77
+ code: 'foo',
78
+ filename: 'foo.ts',
79
+ }, {
80
+ code: 'foo',
81
+ filename: 'foo.ts',
82
+ }],
83
+ invalid: [{
84
+ only: true,
85
+ code: 'foo',
86
+ filename: 'foo.ts',
87
+ errors: [{ messagId: 'foo' }]
88
+ }]
89
+ })`,
90
+ filename: 'scripts/eslint_rules/tests/foo_test.js',
91
+ errors: [{messageId: 'noOnlyInESLintTest'}, {messageId: 'noOnlyInESLintTest'}],
92
+ },
93
+ ]
94
+ });
@@ -0,0 +1,40 @@
1
+ // Copyright 2021 The Chromium Authors. All rights reserved.
2
+ // Use of this source code is governed by a BSD-style license that can be
3
+ // found in the LICENSE file.
4
+
5
+ const parser = require('@typescript-eslint/parser');
6
+
7
+ const utils = require('../lib/utils.js');
8
+ const {assert} = require('chai');
9
+
10
+ describe('eslint utils', () => {
11
+ describe('isLitHtmlTemplateCall', () => {
12
+ it('returns true if the code is LitHtml.html``', () => {
13
+ const code = 'LitHtml.html`<span>foo</span>`';
14
+ const parsed = parser.parse(code);
15
+ const result = utils.isLitHtmlTemplateCall(parsed.body[0].expression);
16
+ assert.strictEqual(result, true);
17
+ });
18
+
19
+ it('returns true if the code is html``', () => {
20
+ const code = 'html`<span>foo</span>`';
21
+ const parsed = parser.parse(code);
22
+ const result = utils.isLitHtmlTemplateCall(parsed.body[0].expression);
23
+ assert.strictEqual(result, true);
24
+ });
25
+
26
+ it('returns false if the code is LitHtml.somethingElse``', () => {
27
+ const code = 'LitHtml.somethingElse`<span>foo</span>`';
28
+ const parsed = parser.parse(code);
29
+ const result = utils.isLitHtmlTemplateCall(parsed.body[0].expression);
30
+ assert.strictEqual(result, false);
31
+ });
32
+
33
+ it('returns false if the code is another tagged template function``', () => {
34
+ const code = 'notLitHtml`<span>foo</span>`';
35
+ const parsed = parser.parse(code);
36
+ const result = utils.isLitHtmlTemplateCall(parsed.body[0].expression);
37
+ assert.strictEqual(result, false);
38
+ });
39
+ });
40
+ });
@@ -1,11 +0,0 @@
1
- // Copyright 2018 The Chromium Authors. All rights reserved.
2
- // Use of this source code is governed by a BSD-style license that can be
3
- // found in the LICENSE file.
4
- import '../shell/shell.js';
5
- import './devtools_app-meta-files.js';
6
-
7
- import * as Main from '../main/main.js';
8
- import * as Startup from '../startup/startup.js';
9
-
10
- new Main.MainImpl.MainImpl();
11
- Startup.RuntimeInstantiator.startApplication('devtools_app');
@@ -1,4 +0,0 @@
1
- {
2
- "modules" : [
3
- ]
4
- }
@@ -1,12 +0,0 @@
1
- // Copyright 2018 The Chromium Authors. All rights reserved.
2
- // Use of this source code is governed by a BSD-style license that can be
3
- // found in the LICENSE file.
4
- import '../shell/shell.js';
5
- import '../../panels/js_profiler/js_profiler-meta.js';
6
- import './JsMain.js';
7
-
8
- import * as Main from '../main/main.js';
9
- import * as Startup from '../startup/startup.js';
10
-
11
- new Main.MainImpl.MainImpl();
12
- Startup.RuntimeInstantiator.startApplication('js_app');
@@ -1,3 +0,0 @@
1
- {
2
- "modules" : []
3
- }
@@ -1,4 +0,0 @@
1
- {
2
- "modules" : [
3
- ]
4
- }
@@ -1,95 +0,0 @@
1
- /*
2
- * Copyright (C) 2014 Google Inc. All rights reserved.
3
- *
4
- * Redistribution and use in source and binary forms, with or without
5
- * modification, are permitted provided that the following conditions are
6
- * met:
7
- *
8
- * * Redistributions of source code must retain the above copyright
9
- * notice, this list of conditions and the following disclaimer.
10
- * * Redistributions in binary form must reproduce the above
11
- * copyright notice, this list of conditions and the following disclaimer
12
- * in the documentation and/or other materials provided with the
13
- * distribution.
14
- * * Neither the name of Google Inc. nor the names of its
15
- * contributors may be used to endorse or promote products derived from
16
- * this software without specific prior written permission.
17
- *
18
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
- */
30
-
31
- import '../../core/root/root-legacy.js';
32
-
33
- import * as RootModule from '../../core/root/root.js';
34
-
35
- // Legacy runtime namespace definitions
36
- // @ts-ignore
37
- self.Runtime = self.Runtime || {};
38
- // @ts-ignore
39
- Runtime = Runtime || {};
40
- // The following two variables are initialized in `build_release_applications`
41
- // @ts-ignore
42
- Root.allDescriptors = Root.allDescriptors || [];
43
- // @ts-ignore
44
- Root.applicationDescriptor = Root.applicationDescriptor || undefined;
45
-
46
- export async function startApplication(_appName: string): Promise<void> {
47
- console.timeStamp('Root.Runtime.startApplication');
48
-
49
- const allDescriptorsByName: {
50
- [x: string]: RootModule.Runtime.ModuleDescriptor,
51
- } = {};
52
- // TODO(crbug.com/1172300) Ignored during the jsdoc to ts migration
53
- // @ts-ignore
54
- for (let i = 0; i < Root.allDescriptors.length; ++i) {
55
- // TODO(crbug.com/1172300) Ignored during the jsdoc to ts migration
56
- // @ts-ignore
57
- const d = Root.allDescriptors[i];
58
- allDescriptorsByName[d['name']] = d;
59
- }
60
-
61
- // TODO(crbug.com/1172300) Ignored during the jsdoc to ts migration
62
- // @ts-ignore
63
- const configuration = Root.applicationDescriptor.modules;
64
- const moduleDescriptors = [];
65
- const coreModuleNames = [];
66
- for (let i = 0; i < configuration.length; ++i) {
67
- const descriptor = configuration[i];
68
- const name = descriptor['name'];
69
- moduleDescriptors.push(allDescriptorsByName[name]);
70
- if (descriptor['type'] === 'autostart') {
71
- coreModuleNames.push(name);
72
- }
73
- }
74
-
75
- for (let i = 0; i < moduleDescriptors.length; ++i) {
76
- moduleDescriptors[i].name = configuration[i]['name'];
77
- moduleDescriptors[i].condition = configuration[i]['condition'];
78
- }
79
- const runtimeInstance = RootModule.Runtime.Runtime.instance({forceNew: true, moduleDescriptors});
80
- // @ts-ignore Exposed for legacy layout tests
81
- self.runtime = runtimeInstance;
82
- if (coreModuleNames) {
83
- await runtimeInstance.loadAutoStartModules(coreModuleNames);
84
- }
85
- RootModule.Runtime.appStartedPromiseCallback();
86
- }
87
-
88
- export async function startWorker(appName: string): Promise<void> {
89
- return startApplication(appName).then(sendWorkerReady);
90
-
91
- function sendWorkerReady(): void {
92
- // @ts-ignore
93
- self.postMessage('workerReady');
94
- }
95
- }
@@ -1,9 +0,0 @@
1
- // Copyright 2019 The Chromium Authors. All rights reserved.
2
- // Use of this source code is governed by a BSD-style license that can be
3
- // found in the LICENSE file.
4
-
5
- import * as RuntimeInstantiator from './RuntimeInstantiator.js';
6
-
7
- export {
8
- RuntimeInstantiator,
9
- };