chrome-devtools-frontend 1.0.945884 → 1.0.948295

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 (259) hide show
  1. package/.eslintrc.js +1 -0
  2. package/config/gni/all_devtools_files.gni +1 -20
  3. package/config/gni/devtools_grd_files.gni +9 -48
  4. package/config/gni/devtools_image_files.gni +1 -0
  5. package/front_end/.eslintrc.js +6 -1
  6. package/front_end/Images/src/circled_backslash_icon.svg +3 -0
  7. package/front_end/core/host/InspectorFrontendHost.ts +0 -3
  8. package/front_end/core/host/InspectorFrontendHostAPI.ts +0 -1
  9. package/front_end/core/host/UserMetrics.ts +1 -23
  10. package/front_end/core/i18n/locales/en-US.json +41 -41
  11. package/front_end/core/i18n/locales/en-XL.json +41 -41
  12. package/front_end/core/platform/platform.ts +0 -2
  13. package/front_end/core/platform/string-utilities.ts +14 -1
  14. package/front_end/core/platform/utilities.ts +0 -29
  15. package/front_end/core/root/Runtime.ts +4 -212
  16. package/front_end/core/sdk/AccessibilityModel.ts +0 -2
  17. package/front_end/core/sdk/CSSProperty.ts +16 -11
  18. package/front_end/core/sdk/CSSRule.ts +0 -2
  19. package/front_end/core/sdk/Cookie.ts +0 -25
  20. package/front_end/core/sdk/EmulationModel.ts +0 -2
  21. package/front_end/core/sdk/HeapProfilerModel.ts +0 -2
  22. package/front_end/core/sdk/NetworkManager.ts +0 -3
  23. package/front_end/core/sdk/Resource.ts +0 -3
  24. package/front_end/core/sdk/ResourceTreeModel.ts +0 -3
  25. package/front_end/core/sdk/ServiceWorkerManager.ts +0 -2
  26. package/front_end/core/sdk/sdk-legacy.ts +0 -3
  27. package/front_end/devtools_compatibility.js +1 -8
  28. package/front_end/entrypoints/devtools_app/{devtools_app-meta-files.ts → devtools_app.ts} +9 -2
  29. package/front_end/entrypoints/formatter_worker/CSSFormatter.ts +1 -3
  30. package/front_end/entrypoints/formatter_worker/FormatterActions.ts +0 -2
  31. package/front_end/entrypoints/formatter_worker/FormatterWorker.ts +0 -120
  32. package/front_end/entrypoints/formatter_worker/formatter_worker-entrypoint.ts +1 -11
  33. package/front_end/entrypoints/formatter_worker/formatter_worker.ts +5 -0
  34. package/front_end/entrypoints/heap_snapshot_worker/HeapSnapshot.ts +2 -1
  35. package/front_end/entrypoints/inspector/{inspector.js → inspector.ts} +0 -3
  36. package/front_end/entrypoints/js_app/{JsMain.ts → js_app.ts} +5 -1
  37. package/front_end/entrypoints/main/MainImpl.ts +0 -7
  38. package/front_end/entrypoints/ndb_app/{ndb_app.js → ndb_app.ts} +3 -2
  39. package/front_end/entrypoints/{node_main → node_app}/NodeConnectionsPanel.ts +1 -1
  40. package/front_end/entrypoints/{node_main → node_app}/NodeMain.ts +2 -4
  41. package/front_end/entrypoints/{node_main → node_app}/nodeConnectionsPanel.css +0 -0
  42. package/front_end/entrypoints/node_app/node_app.ts +79 -0
  43. package/front_end/entrypoints/shell/{shell-meta-files.ts → shell.ts} +7 -1
  44. package/front_end/entrypoints/worker_app/{worker_app.js → worker_app.ts} +6 -2
  45. package/front_end/generated/InspectorBackendCommands.js +5 -1
  46. package/front_end/generated/protocol.d.ts +12 -0
  47. package/front_end/legacy/legacy-defs.d.ts +0 -4
  48. package/front_end/legacy_test_runner/sources_test_runner/sources_test_runner.js +0 -1
  49. package/front_end/legacy_test_runner/test_runner/TestRunner.js +35 -59
  50. package/front_end/models/bindings/CompilerScriptMapping.ts +0 -1
  51. package/front_end/models/bindings/DebuggerLanguagePlugins.ts +4 -11
  52. package/front_end/models/bindings/DebuggerWorkspaceBinding.ts +1 -1
  53. package/front_end/models/bindings/ResourceMapping.ts +1 -1
  54. package/front_end/models/bindings/SASSSourceMapping.ts +0 -1
  55. package/front_end/models/emulation/DeviceModeModel.ts +0 -2
  56. package/front_end/models/formatter/FormatterWorkerPool.ts +0 -18
  57. package/front_end/models/issues_manager/CorsIssue.ts +17 -9
  58. package/front_end/models/issues_manager/descriptions/{corsInsecurePrivateNetworkPreflight.md → corsPreflightAllowPrivateNetworkError.md} +1 -1
  59. package/front_end/models/text_utils/CodeMirrorUtils.ts +6 -51
  60. package/front_end/models/text_utils/TextUtils.ts +1 -2
  61. package/front_end/models/text_utils/text_utils-legacy.ts +0 -5
  62. package/front_end/panels/accessibility/AccessibilitySidebarView.ts +3 -1
  63. package/front_end/panels/animation/AnimationTimeline.ts +0 -2
  64. package/front_end/panels/animation/AnimationUI.ts +0 -2
  65. package/front_end/panels/application/ApplicationPanelSidebar.ts +2 -4
  66. package/front_end/panels/application/BackForwardCacheStrings.ts +2 -5
  67. package/front_end/panels/application/BackForwardCacheView.ts +150 -58
  68. package/front_end/panels/application/ResourcesPanel.ts +0 -42
  69. package/front_end/panels/application/application-legacy.ts +0 -3
  70. package/front_end/panels/application/application-meta.ts +0 -13
  71. package/front_end/panels/application/backForwardCacheView.css +44 -6
  72. package/front_end/panels/application/components/FrameDetailsView.ts +3 -3
  73. package/front_end/panels/application/components/OriginTrialTreeView.ts +3 -3
  74. package/front_end/panels/application/components/StackTrace.ts +1 -1
  75. package/front_end/panels/coverage/CoverageView.ts +1 -1
  76. package/front_end/panels/css_overview/CSSOverviewModel.ts +0 -2
  77. package/front_end/panels/css_overview/CSSOverviewPanel.ts +0 -7
  78. package/front_end/panels/css_overview/CSSOverviewProcessingView.ts +0 -2
  79. package/front_end/panels/css_overview/components/cssOverviewStartView.css +1 -0
  80. package/front_end/panels/css_overview/cssOverviewCompletedView.css +1 -1
  81. package/front_end/panels/developer_resources/DeveloperResourcesView.ts +2 -1
  82. package/front_end/panels/elements/ColorSwatchPopoverIcon.ts +0 -11
  83. package/front_end/panels/elements/ElementsPanel.ts +9 -1
  84. package/front_end/panels/elements/ElementsTreeElement.ts +1 -1
  85. package/front_end/panels/elements/StylesSidebarPane.ts +0 -1
  86. package/front_end/panels/elements/components/ElementsBreadcrumbs.ts +1 -1
  87. package/front_end/panels/elements/elementsTreeOutline.css +0 -13
  88. package/front_end/panels/emulation/DeviceModeToolbar.ts +0 -16
  89. package/front_end/panels/issues/CorsIssueDetailsView.ts +18 -2
  90. package/front_end/panels/lighthouse/lighthouse-meta.ts +0 -3
  91. package/front_end/panels/network/NetworkConfigView.ts +10 -0
  92. package/front_end/panels/network/NetworkItemView.ts +3 -0
  93. package/front_end/panels/network/NetworkWaterfallColumn.ts +2 -0
  94. package/front_end/panels/network/networkConfigView.css +5 -0
  95. package/front_end/panels/profiler/CPUProfileFlameChart.ts +3 -1
  96. package/front_end/panels/profiler/ProfileDataGrid.ts +2 -1
  97. package/front_end/panels/profiler/profilesPanel.css +1 -1
  98. package/front_end/panels/search/SearchView.ts +24 -4
  99. package/front_end/panels/settings/components/SyncSection.ts +2 -2
  100. package/front_end/panels/settings/emulation/components/UserAgentClientHintsForm.ts +52 -50
  101. package/front_end/panels/settings/emulation/components/userAgentClientHintsForm.css +0 -12
  102. package/front_end/panels/sources/CSSPlugin.ts +3 -0
  103. package/front_end/panels/sources/CoveragePlugin.ts +2 -0
  104. package/front_end/panels/sources/DebuggerPlugin.ts +35 -7
  105. package/front_end/panels/sources/JavaScriptCompilerPlugin.ts +3 -0
  106. package/front_end/panels/sources/ProfilePlugin.ts +3 -0
  107. package/front_end/panels/sources/UISourceCodeFrame.ts +11 -2
  108. package/front_end/panels/sources/sourcesView.css +0 -130
  109. package/front_end/panels/timeline/TimelineTreeView.ts +3 -1
  110. package/front_end/third_party/codemirror/codemirror-tsconfig.json +1 -25
  111. package/front_end/third_party/codemirror.next/chunk/codemirror.js +1 -1
  112. package/front_end/third_party/codemirror.next/chunk/cpp.js +1 -2
  113. package/front_end/third_party/codemirror.next/chunk/java.js +1 -2
  114. package/front_end/third_party/codemirror.next/chunk/json.js +1 -2
  115. package/front_end/third_party/codemirror.next/chunk/markdown.js +1 -2
  116. package/front_end/third_party/codemirror.next/chunk/php.js +1 -2
  117. package/front_end/third_party/codemirror.next/chunk/python.js +1 -2
  118. package/front_end/third_party/codemirror.next/chunk/wast.js +1 -2
  119. package/front_end/third_party/codemirror.next/chunk/xml.js +1 -2
  120. package/front_end/third_party/codemirror.next/codemirror.next.d.ts +1486 -1423
  121. package/front_end/third_party/codemirror.next/codemirror.next.js +1 -2
  122. package/front_end/third_party/codemirror.next/package.json +10 -9
  123. package/front_end/third_party/lighthouse/lighthouse-dt-bundle.js +168 -164
  124. package/front_end/third_party/lighthouse/locales/ar-XB.json +0 -3
  125. package/front_end/third_party/lighthouse/locales/ar.json +0 -3
  126. package/front_end/third_party/lighthouse/locales/bg.json +17 -20
  127. package/front_end/third_party/lighthouse/locales/ca.json +0 -3
  128. package/front_end/third_party/lighthouse/locales/cs.json +0 -3
  129. package/front_end/third_party/lighthouse/locales/da.json +16 -19
  130. package/front_end/third_party/lighthouse/locales/de.json +0 -3
  131. package/front_end/third_party/lighthouse/locales/el.json +0 -3
  132. package/front_end/third_party/lighthouse/locales/en-GB.json +19 -22
  133. package/front_end/third_party/lighthouse/locales/en-US.json +33 -3
  134. package/front_end/third_party/lighthouse/locales/en-XA.json +0 -3
  135. package/front_end/third_party/lighthouse/locales/en-XL.json +33 -3
  136. package/front_end/third_party/lighthouse/locales/es-419.json +17 -20
  137. package/front_end/third_party/lighthouse/locales/es.json +0 -3
  138. package/front_end/third_party/lighthouse/locales/fi.json +16 -19
  139. package/front_end/third_party/lighthouse/locales/fil.json +33 -36
  140. package/front_end/third_party/lighthouse/locales/fr.json +16 -19
  141. package/front_end/third_party/lighthouse/locales/he.json +16 -19
  142. package/front_end/third_party/lighthouse/locales/hi.json +0 -3
  143. package/front_end/third_party/lighthouse/locales/hr.json +16 -19
  144. package/front_end/third_party/lighthouse/locales/hu.json +16 -19
  145. package/front_end/third_party/lighthouse/locales/id.json +16 -19
  146. package/front_end/third_party/lighthouse/locales/it.json +37 -40
  147. package/front_end/third_party/lighthouse/locales/ja.json +16 -19
  148. package/front_end/third_party/lighthouse/locales/ko.json +16 -19
  149. package/front_end/third_party/lighthouse/locales/lt.json +17 -20
  150. package/front_end/third_party/lighthouse/locales/lv.json +0 -3
  151. package/front_end/third_party/lighthouse/locales/nl.json +16 -19
  152. package/front_end/third_party/lighthouse/locales/no.json +17 -20
  153. package/front_end/third_party/lighthouse/locales/pl.json +16 -19
  154. package/front_end/third_party/lighthouse/locales/pt-PT.json +37 -40
  155. package/front_end/third_party/lighthouse/locales/pt.json +16 -19
  156. package/front_end/third_party/lighthouse/locales/ro.json +0 -3
  157. package/front_end/third_party/lighthouse/locales/ru.json +16 -19
  158. package/front_end/third_party/lighthouse/locales/sk.json +0 -3
  159. package/front_end/third_party/lighthouse/locales/sl.json +0 -3
  160. package/front_end/third_party/lighthouse/locales/sr-Latn.json +16 -19
  161. package/front_end/third_party/lighthouse/locales/sr.json +16 -19
  162. package/front_end/third_party/lighthouse/locales/sv.json +17 -20
  163. package/front_end/third_party/lighthouse/locales/ta.json +0 -3
  164. package/front_end/third_party/lighthouse/locales/te.json +0 -3
  165. package/front_end/third_party/lighthouse/locales/th.json +0 -3
  166. package/front_end/third_party/lighthouse/locales/tr.json +0 -3
  167. package/front_end/third_party/lighthouse/locales/uk.json +17 -20
  168. package/front_end/third_party/lighthouse/locales/vi.json +0 -3
  169. package/front_end/third_party/lighthouse/locales/zh-HK.json +0 -3
  170. package/front_end/third_party/lighthouse/locales/zh-TW.json +0 -3
  171. package/front_end/third_party/lighthouse/locales/zh.json +0 -3
  172. package/front_end/third_party/lighthouse/report/bundle.d.ts +63 -61
  173. package/front_end/third_party/lighthouse/report/bundle.js +36 -7
  174. package/front_end/third_party/lighthouse/report-assets/report-generator.js +205 -192
  175. package/front_end/ui/components/diff_view/DiffView.ts +4 -4
  176. package/front_end/ui/components/helpers/component-server-setup.ts +1 -12
  177. package/front_end/ui/components/helpers/helpers.ts +0 -2
  178. package/front_end/ui/components/icon_button/IconButton.ts +1 -1
  179. package/front_end/ui/components/issue_counter/IssueCounter.ts +2 -2
  180. package/front_end/ui/components/linear_memory_inspector/LinearMemoryViewer.ts +3 -3
  181. package/front_end/ui/components/markdown_view/MarkdownView.ts +4 -4
  182. package/front_end/ui/components/panel_feedback/PreviewToggle.ts +98 -0
  183. package/front_end/ui/components/panel_feedback/panel_feedback.ts +1 -0
  184. package/front_end/ui/components/panel_feedback/previewToggle.css +24 -0
  185. package/front_end/ui/components/report_view/ReportView.ts +22 -0
  186. package/front_end/ui/components/report_view/reportSection.css +20 -0
  187. package/front_end/ui/components/request_link_icon/RequestLinkIcon.ts +1 -1
  188. package/front_end/ui/components/settings/SettingCheckbox.ts +2 -2
  189. package/front_end/ui/components/text_editor/config.ts +11 -9
  190. package/front_end/ui/components/text_editor/javascript.ts +34 -12
  191. package/front_end/ui/components/text_editor/theme.ts +1 -0
  192. package/front_end/ui/components/text_prompt/TextPrompt.ts +2 -2
  193. package/front_end/ui/legacy/GlassPane.ts +1 -1
  194. package/front_end/ui/legacy/InspectorView.ts +10 -0
  195. package/front_end/ui/legacy/SearchableView.ts +2 -1
  196. package/front_end/ui/legacy/Treeoutline.ts +1 -1
  197. package/front_end/ui/legacy/Widget.ts +1 -1
  198. package/front_end/ui/legacy/XWidget.ts +0 -5
  199. package/front_end/ui/legacy/components/inline_editor/CSSVarSwatch.ts +2 -2
  200. package/front_end/ui/legacy/components/inline_editor/ColorSwatch.ts +1 -1
  201. package/front_end/ui/legacy/components/object_ui/ObjectPropertiesSection.ts +2 -3
  202. package/front_end/ui/legacy/components/object_ui/objectPropertiesSection.css +0 -1
  203. package/front_end/ui/legacy/components/object_ui/object_ui-legacy.ts +0 -8
  204. package/front_end/ui/legacy/components/object_ui/object_ui.ts +0 -4
  205. package/front_end/ui/legacy/components/source_frame/SourceFrame.ts +40 -29
  206. package/front_end/ui/legacy/inspectorSyntaxHighlight.css +0 -211
  207. package/front_end/ui/legacy/legacy-legacy.ts +0 -6
  208. package/front_end/ui/legacy/legacy.ts +0 -2
  209. package/front_end/ui/legacy/tabbedPane.css +1 -1
  210. package/front_end/ui/legacy/themeColors.css +1 -1
  211. package/front_end/ui/legacy/utils/append-style.ts +2 -13
  212. package/front_end/ui/legacy/utils/create-shadow-root-with-core-styles.ts +7 -5
  213. package/package.json +2 -4
  214. package/scripts/build/build_inspector_overlay.py +15 -1
  215. package/scripts/build/rjsmin.py +84 -115
  216. package/scripts/eslint_rules/lib/l10n_filename_matches.js +4 -4
  217. package/scripts/eslint_rules/lib/lit_html_no_attribute_quotes.js +101 -0
  218. package/scripts/eslint_rules/lib/no_only_eslint_tests.js +53 -0
  219. package/scripts/eslint_rules/tests/.eslintrc.js +14 -0
  220. package/scripts/eslint_rules/tests/l10n_filename_matches_test.js +4 -0
  221. package/scripts/eslint_rules/tests/lit_html_no_attribute_quotes_test.js +45 -0
  222. package/scripts/eslint_rules/tests/no_only_eslint_tests_test.js +94 -0
  223. package/scripts/hosted_mode/server.js +17 -2
  224. package/front_end/entrypoints/devtools_app/devtools_app.js +0 -8
  225. package/front_end/entrypoints/devtools_app/devtools_app.json +0 -6
  226. package/front_end/entrypoints/inspector/inspector.json +0 -4
  227. package/front_end/entrypoints/js_app/js_app.js +0 -9
  228. package/front_end/entrypoints/js_app/js_app.json +0 -4
  229. package/front_end/entrypoints/ndb_app/ndb_app.json +0 -5
  230. package/front_end/entrypoints/node_app/node_app-meta.ts +0 -43
  231. package/front_end/entrypoints/node_app/node_app.js +0 -13
  232. package/front_end/entrypoints/node_app/node_app.json +0 -4
  233. package/front_end/entrypoints/node_main/node_main-meta.ts +0 -48
  234. package/front_end/entrypoints/node_main/node_main.ts +0 -11
  235. package/front_end/entrypoints/shell/shell.js +0 -13
  236. package/front_end/entrypoints/shell/shell.json +0 -5
  237. package/front_end/entrypoints/startup/RuntimeInstantiator.ts +0 -95
  238. package/front_end/entrypoints/startup/startup.ts +0 -9
  239. package/front_end/entrypoints/worker_app/worker_app.json +0 -4
  240. package/front_end/panels/lighthouse/module.json +0 -6
  241. package/front_end/third_party/lighthouse/report-assets/report.d.ts +0 -1
  242. package/front_end/third_party/lighthouse/report-assets/report.js +0 -233
  243. package/front_end/third_party/lighthouse/report-assets/standalone-template.html +0 -38
  244. package/front_end/ui/components/helpers/get-stylesheet.ts +0 -45
  245. package/front_end/ui/legacy/TextEditor.ts +0 -82
  246. package/front_end/ui/legacy/components/object_ui/JavaScriptAutocomplete.ts +0 -836
  247. package/front_end/ui/legacy/components/text_editor/CodeMirrorTextEditor.ts +0 -1676
  248. package/front_end/ui/legacy/components/text_editor/TextEditorAutocompleteController.ts +0 -586
  249. package/front_end/ui/legacy/components/text_editor/autocompleteTooltip.css +0 -20
  250. package/front_end/ui/legacy/components/text_editor/cm_modes.ts +0 -23
  251. package/front_end/ui/legacy/components/text_editor/cmdevtools.css +0 -995
  252. package/front_end/ui/legacy/components/text_editor/module.json +0 -7
  253. package/front_end/ui/legacy/components/text_editor/text_editor-legacy.ts +0 -33
  254. package/front_end/ui/legacy/components/text_editor/text_editor.ts +0 -13
  255. package/scripts/build/build_release_applications.py +0 -216
  256. package/scripts/build/modular_build.py +0 -184
  257. package/scripts/check_gn.js +0 -119
  258. package/scripts/json_validator/module.schema.json +0 -19
  259. package/scripts/json_validator/validate_module_json.js +0 -44
@@ -119,8 +119,7 @@ def _make_jsmin(python_only=False):
119
119
  charclass = r'(?:\[[^\\\]\r\n]*(?:\\[^\r\n][^\\\]\r\n]*)*\])'
120
120
  nospecial = r'[^/\\\[\r\n]'
121
121
  regex = r'(?:/(?![\r\n/*])%s*(?:(?:\\[^\r\n]|%s)%s*)*/)' % (
122
- nospecial, charclass, nospecial
123
- )
122
+ nospecial, charclass, nospecial)
124
123
  space = r'(?:%s|%s)' % (space_chars, space_comment)
125
124
  newline = r'(?:%s?[\r\n])' % line_comment
126
125
 
@@ -147,36 +146,28 @@ def _make_jsmin(python_only=False):
147
146
  first = last = char
148
147
  if last is not None:
149
148
  result.append((first, last))
150
- return ''.join(['%s%s%s' % (
151
- chr(first),
152
- last > first + 1 and '-' or '',
153
- last != first and chr(last) or ''
154
- ) for first, last in result]) # noqa
149
+ return ''.join([
150
+ '%s%s%s' % (chr(first), last > first + 1 and '-'
151
+ or '', last != first and chr(last) or '')
152
+ for first, last in result
153
+ ]) # noqa
155
154
 
156
155
  return _re.sub(
157
156
  r'([\000-\040\047])', # \047 for better portability
158
- lambda m: '\\%03o' % ord(m.group(1)), (
159
- sequentize(result)
160
- .replace('\\', '\\\\')
161
- .replace('[', '\\[')
162
- .replace(']', '\\]')
163
- )
164
- )
157
+ lambda m: '\\%03o' % ord(m.group(1)),
158
+ (sequentize(result).replace('\\', '\\\\').replace(
159
+ '[', '\\[').replace(']', '\\]')))
165
160
 
166
161
  def id_literal_(what):
167
162
  """ Make id_literal like char class """
168
163
  match = _re.compile(what).match
169
- result = ''.join([
170
- chr(c) for c in xrange(127) if not match(chr(c))
171
- ])
164
+ result = ''.join([chr(c) for c in xrange(127) if not match(chr(c))])
172
165
  return '[^%s]' % fix_charclass(result)
173
166
 
174
167
  def not_id_literal_(keep):
175
168
  """ Make negated id_literal like char class """
176
169
  match = _re.compile(id_literal_(keep)).match
177
- result = ''.join([
178
- chr(c) for c in xrange(127) if not match(chr(c))
179
- ])
170
+ result = ''.join([chr(c) for c in xrange(127) if not match(chr(c))])
180
171
  return r'[%s]' % fix_charclass(result)
181
172
 
182
173
  not_id_literal = not_id_literal_(r'[a-zA-Z0-9_$]')
@@ -192,28 +183,26 @@ def _make_jsmin(python_only=False):
192
183
 
193
184
  space_sub_simple = _re.compile((
194
185
  # noqa pylint: disable = bad-continuation
195
-
196
- r'(%(dull)s+)' # 0
197
- r'|(%(strings)s%(dull)s*)' # 1
186
+ r'(%(dull)s+)' # 0
187
+ r'|(%(strings)s%(dull)s*)' # 1
198
188
  r'|(?<=%(preregex1)s)'
199
- r'%(space)s*(?:%(newline)s%(space)s*)*'
200
- r'(%(regex)s)' # 2
201
- r'(%(space)s*(?:%(newline)s%(space)s*)+' # 3
202
- r'(?=%(post_regex_off)s))?'
189
+ r'%(space)s*(?:%(newline)s%(space)s*)*'
190
+ r'(%(regex)s)' # 2
191
+ r'(%(space)s*(?:%(newline)s%(space)s*)+' # 3
192
+ r'(?=%(post_regex_off)s))?'
203
193
  r'|(?<=%(preregex2)s)'
204
- r'%(space)s*(?:(%(newline)s)%(space)s*)*' # 4
205
- r'(%(regex)s)' # 5
206
- r'(%(space)s*(?:%(newline)s%(space)s*)+' # 6
207
- r'(?=%(post_regex_off)s))?'
194
+ r'%(space)s*(?:(%(newline)s)%(space)s*)*' # 4
195
+ r'(%(regex)s)' # 5
196
+ r'(%(space)s*(?:%(newline)s%(space)s*)+' # 6
197
+ r'(?=%(post_regex_off)s))?'
208
198
  r'|(?<=%(id_literal_close)s)'
209
- r'%(space)s*(?:(%(newline)s)%(space)s*)+' # 7
210
- r'(?=%(id_literal_open)s)'
199
+ r'%(space)s*(?:(%(newline)s)%(space)s*)+' # 7
200
+ r'(?=%(id_literal_open)s)'
211
201
  r'|(?<=%(id_literal)s)(%(space)s)+(?=%(id_literal)s)' # 8
212
- r'|(?<=\+)(%(space)s)+(?=\+)' # 9
213
- r'|(?<=-)(%(space)s)+(?=-)' # 10
202
+ r'|(?<=\+)(%(space)s)+(?=\+)' # 9
203
+ r'|(?<=-)(%(space)s)+(?=-)' # 10
214
204
  r'|%(space)s+'
215
- r'|(?:%(newline)s%(space)s*)+'
216
- ) % locals()).sub
205
+ r'|(?:%(newline)s%(space)s*)+') % locals()).sub
217
206
 
218
207
  # print space_sub_simple.__self__.pattern
219
208
 
@@ -245,35 +234,33 @@ def _make_jsmin(python_only=False):
245
234
 
246
235
  space_sub_banged = _re.compile((
247
236
  # noqa pylint: disable = bad-continuation
248
-
249
- r'(%(dull)s+)' # 0
250
- r'|(%(strings)s%(dull)s*)' # 1
237
+ r'(%(dull)s+)' # 0
238
+ r'|(%(strings)s%(dull)s*)' # 1
251
239
  r'|(?<=%(preregex1)s)'
252
- r'(%(space)s*(?:%(newline)s%(space)s*)*)' # 2
253
- r'(%(regex)s)' # 3
254
- r'(%(space)s*(?:%(newline)s%(space)s*)+' # 4
255
- r'(?=%(post_regex_off)s))?'
240
+ r'(%(space)s*(?:%(newline)s%(space)s*)*)' # 2
241
+ r'(%(regex)s)' # 3
242
+ r'(%(space)s*(?:%(newline)s%(space)s*)+' # 4
243
+ r'(?=%(post_regex_off)s))?'
256
244
  r'|(?<=%(preregex2)s)'
257
- r'(%(space)s*(?:(%(newline)s)%(space)s*)*)' # 5, 6
258
- r'(%(regex)s)' # 7
259
- r'(%(space)s*(?:%(newline)s%(space)s*)+' # 8
260
- r'(?=%(post_regex_off)s))?'
245
+ r'(%(space)s*(?:(%(newline)s)%(space)s*)*)' # 5, 6
246
+ r'(%(regex)s)' # 7
247
+ r'(%(space)s*(?:%(newline)s%(space)s*)+' # 8
248
+ r'(?=%(post_regex_off)s))?'
261
249
  r'|(?<=%(id_literal_close)s)'
262
- r'(%(space)s*(?:%(newline)s%(space)s*)+)' # 9
263
- r'(?=%(id_literal_open)s)'
250
+ r'(%(space)s*(?:%(newline)s%(space)s*)+)' # 9
251
+ r'(?=%(id_literal_open)s)'
264
252
  r'|(?<=%(id_literal)s)(%(space)s+)(?=%(id_literal)s)' # 10
265
- r'|(?<=\+)(%(space)s+)(?=\+)' # 11
266
- r'|(?<=-)(%(space)s+)(?=-)' # 12
267
- r'|(%(space)s+)' # 13
268
- r'|((?:%(newline)s%(space)s*)+)' # 14
253
+ r'|(?<=\+)(%(space)s+)(?=\+)' # 11
254
+ r'|(?<=-)(%(space)s+)(?=-)' # 12
255
+ r'|(%(space)s+)' # 13
256
+ r'|((?:%(newline)s%(space)s*)+)' # 14
269
257
  ) % locals()).sub
270
258
 
271
259
  # print space_sub_banged.__self__.pattern
272
260
 
273
- keep = _re.compile((
274
- r'%(space_chars)s+|%(space_comment_nobang)s+|%(newline)s+'
275
- r'|(%(bang_comment)s+)'
276
- ) % locals()).sub
261
+ keep = _re.compile(
262
+ (r'%(space_chars)s+|%(space_comment_nobang)s+|%(newline)s+'
263
+ r'|(%(bang_comment)s+)') % locals()).sub
277
264
  keeper = lambda m: m.groups()[0] or ''
278
265
 
279
266
  # print keep.__self__.pattern
@@ -333,16 +320,15 @@ def _make_jsmin(python_only=False):
333
320
  # pylint: disable = redefined-outer-name
334
321
 
335
322
  if keep_bang_comments:
336
- return space_sub_banged(
337
- space_subber_banged, '\n%s\n' % script
338
- ).strip()
323
+ return space_sub_banged(space_subber_banged,
324
+ '\n%s\n' % script).strip()
339
325
  else:
340
- return space_sub_simple(
341
- space_subber_simple, '\n%s\n' % script
342
- ).strip()
326
+ return space_sub_simple(space_subber_simple,
327
+ '\n%s\n' % script).strip()
343
328
 
344
329
  return jsmin
345
330
 
331
+
346
332
  jsmin = _make_jsmin()
347
333
 
348
334
 
@@ -403,28 +389,19 @@ def jsmin_for_posers(script, keep_bang_comments=False):
403
389
  r'\014\016-\040]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/)))+(?=-)|(?:['
404
390
  r'\000-\011\013\014\016-\040]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/)'
405
391
  r')+|(?:(?:(?://[^\r\n]*)?[\r\n])(?:[\000-\011\013\014\016-\040]'
406
- r'|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/))*)+'
407
- )
392
+ r'|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/))*)+')
408
393
 
409
394
  def subber(match):
410
395
  """ Substitution callback """
411
396
  groups = match.groups()
412
- return (
413
- groups[0] or
414
- groups[1] or
415
- (groups[3] and (groups[2] + '\n')) or
416
- groups[2] or
417
- (groups[5] and "%s%s%s" % (
418
- groups[4] and '\n' or '',
419
- groups[5],
420
- groups[6] and '\n' or '',
421
- )) or
422
- (groups[7] and '\n') or
423
- (groups[8] and ' ') or
424
- (groups[9] and ' ') or
425
- (groups[10] and ' ') or
426
- ''
427
- )
397
+ return (groups[0] or groups[1]
398
+ or (groups[3] and (groups[2] + '\n')) or groups[2]
399
+ or (groups[5] and "%s%s%s" % (
400
+ groups[4] and '\n' or '',
401
+ groups[5],
402
+ groups[6] and '\n' or '',
403
+ )) or (groups[7] and '\n') or (groups[8] and ' ')
404
+ or (groups[9] and ' ') or (groups[10] and ' ') or '')
428
405
  else:
429
406
  rex = (
430
407
  r'([^\047"/\000-\040]+)|((?:(?:\047[^\047\\\r\n]*(?:\\(?:[^\r\n]'
@@ -457,46 +434,39 @@ def jsmin_for_posers(script, keep_bang_comments=False):
457
434
  r'11\013\014\016-\040]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/))+)(?=-'
458
435
  r')|((?:[\000-\011\013\014\016-\040]|(?:/\*[^*]*\*+(?:[^/*][^*]*'
459
436
  r'\*+)*/))+)|((?:(?:(?://[^\r\n]*)?[\r\n])(?:[\000-\011\013\014'
460
- r'\016-\040]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/))*)+)'
461
- )
462
-
463
- keep = _re.compile((
464
- r'[\000-\011\013\014\016-\040]+|(?:/\*(?!!)[^*]*\*+(?:[^/*][^*]*'
465
- r'\*+)*/)+|(?:(?://[^\r\n]*)?[\r\n])+|((?:/\*![^*]*\*+(?:[^/*][^'
466
- r'*]*\*+)*/)+)'
467
- ) % locals()).sub
437
+ r'\016-\040]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/))*)+)')
438
+
439
+ keep = _re.compile(
440
+ (r'[\000-\011\013\014\016-\040]+|(?:/\*(?!!)[^*]*\*+(?:[^/*][^*]*'
441
+ r'\*+)*/)+|(?:(?://[^\r\n]*)?[\r\n])+|((?:/\*![^*]*\*+(?:[^/*][^'
442
+ r'*]*\*+)*/)+)') % locals()).sub
468
443
  keeper = lambda m: m.groups()[0] or ''
469
444
 
470
445
  def subber(match):
471
446
  """ Substitution callback """
472
447
  groups = match.groups()
473
- return (
474
- groups[0] or
475
- groups[1] or
476
- (groups[3] and "%s%s%s%s" % (
477
- keep(keeper, groups[2]),
478
- groups[3],
479
- keep(keeper, groups[4] or ''),
480
- groups[4] and '\n' or '',
481
- )) or
482
- (groups[7] and "%s%s%s%s%s" % (
483
- keep(keeper, groups[5]),
484
- groups[6] and '\n' or '',
485
- groups[7],
486
- keep(keeper, groups[8] or ''),
487
- groups[8] and '\n' or '',
488
- )) or
489
- (groups[9] and keep(keeper, groups[9] + '\n')) or
490
- (groups[10] and keep(keeper, groups[10]) or ' ') or
491
- (groups[11] and keep(keeper, groups[11]) or ' ') or
492
- (groups[12] and keep(keeper, groups[12]) or ' ') or
493
- keep(keeper, groups[13] or groups[14])
494
- )
448
+ return (groups[0] or groups[1] or (groups[3] and "%s%s%s%s" % (
449
+ keep(keeper, groups[2]),
450
+ groups[3],
451
+ keep(keeper, groups[4] or ''),
452
+ groups[4] and '\n' or '',
453
+ )) or (groups[7] and "%s%s%s%s%s" % (
454
+ keep(keeper, groups[5]),
455
+ groups[6] and '\n' or '',
456
+ groups[7],
457
+ keep(keeper, groups[8] or ''),
458
+ groups[8] and '\n' or '',
459
+ )) or (groups[9] and keep(keeper, groups[9] + '\n'))
460
+ or (groups[10] and keep(keeper, groups[10]) or ' ')
461
+ or (groups[11] and keep(keeper, groups[11]) or ' ')
462
+ or (groups[12] and keep(keeper, groups[12]) or ' ')
463
+ or keep(keeper, groups[13] or groups[14]))
495
464
 
496
465
  return _re.sub(rex, subber, '\n%s\n' % script).strip()
497
466
 
498
467
 
499
468
  if __name__ == '__main__':
469
+
500
470
  def main():
501
471
  """ Main """
502
472
  import sys as _sys
@@ -508,8 +478,7 @@ if __name__ == '__main__':
508
478
  else:
509
479
  xjsmin = jsmin
510
480
 
511
- _sys.stdout.write(xjsmin(
512
- _sys.stdin.read(), keep_bang_comments=keep_bang_comments
513
- ))
481
+ _sys.stdout.write(
482
+ xjsmin(_sys.stdin.read(), keep_bang_comments=keep_bang_comments))
514
483
 
515
484
  main()
@@ -5,9 +5,6 @@
5
5
  'use strict';
6
6
 
7
7
  const path = require('path');
8
- const {devtoolsRootPath} = require('../../devtools_paths.js');
9
-
10
- const DEFAULT_FRONT_END_DIRECTORY = path.join(devtoolsRootPath(), 'front_end');
11
8
 
12
9
  function isModuleScope(context) {
13
10
  return context.getScope().type === 'module';
@@ -60,10 +57,13 @@ module.exports = {
60
57
  return;
61
58
  }
62
59
 
63
- let frontEndDirectory = DEFAULT_FRONT_END_DIRECTORY;
60
+ let frontEndDirectory = '';
64
61
  if (context.options && context.options[0]?.rootFrontendDirectory) {
65
62
  frontEndDirectory = context.options[0].rootFrontendDirectory;
66
63
  }
64
+ if (!frontEndDirectory) {
65
+ throw new Error('rootFrontendDirectory must be provided.');
66
+ }
67
67
  const currentSourceFile = path.resolve(context.getFilename());
68
68
  const currentFileRelativeToFrontEnd = path.relative(frontEndDirectory, currentSourceFile);
69
69
 
@@ -0,0 +1,101 @@
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
+ function isLitHtmlTemplateCall(taggedTemplateExpressionNode) {
7
+ // Match LitHtml.html``
8
+ const {tag} = taggedTemplateExpressionNode;
9
+ if (!tag) {
10
+ return false;
11
+ }
12
+ // Match LitHtml.html``
13
+ const isLitHtmlDotHtmlCall = tag.object?.name === 'LitHtml' && tag.property?.name === 'html';
14
+ // Match html`` (and guess that it's Lit)
15
+ const isDestructuredHtmlCall = tag.type === 'Identifier' && tag.name === 'html';
16
+
17
+ return isLitHtmlDotHtmlCall || isDestructuredHtmlCall;
18
+ }
19
+
20
+ function templateElementPartStartsWithDoubleQuote(templateElementPartNode) {
21
+ return templateElementPartNode.value.raw.startsWith('"');
22
+ }
23
+ function templateElementPartEndsWithEqualsDoubleQuote(templateElementPartNode) {
24
+ return templateElementPartNode.value.raw.endsWith('="');
25
+ }
26
+
27
+ function removeQuotesFromAttribute({fixer, firstPart, secondPart}) {
28
+ const [, rangeOfOpeningTemplatePartEnd] = firstPart.range;
29
+ // From the first part, we need to remove the last character, which is the double quote.
30
+ // We can do this by fetching the range of the node (range = start and end position on the line)
31
+ // However, for the template part with the opening quote, the range will also contain the ${ of the interpolation:
32
+ // <p class="${
33
+ // ^^^^^^^^^^^^ this is the text covered by the [start, end] range.
34
+ // So what we need to do is remove the quote, and leave the last two characters alone.
35
+ // Therefore we remove the third character back from the end, and only remove a single character, leaving the ${ part alone.
36
+ const startingQuoteRangeToRemove = [rangeOfOpeningTemplatePartEnd - 3, rangeOfOpeningTemplatePartEnd - 2];
37
+
38
+ const [rangeOfClosingTemplatePartStart] = secondPart.range;
39
+ // It's a similar story for the second part where the range includes the }:
40
+ // }">foo</p>
41
+ // ^^^^^^^^^^ this is the range
42
+ // So therefore we get the start of the range, and add one to it, to dodge the } character, and then remove only the quote.
43
+ const endingQuoteRangeToRemove = [rangeOfClosingTemplatePartStart + 1, rangeOfClosingTemplatePartStart + 2];
44
+
45
+ return [fixer.removeRange(startingQuoteRangeToRemove), fixer.removeRange(endingQuoteRangeToRemove)];
46
+ }
47
+
48
+ module.exports = {
49
+ meta: {
50
+ type: 'problem',
51
+
52
+ docs: {
53
+ description: 'ensure no extra quotes around attributes when the value is interpolated',
54
+ category: 'Possible Errors',
55
+ },
56
+ fixable: 'code',
57
+ messages: {
58
+ attributeQuotesNotRequired:
59
+ 'When interpolating a value as an attribute in LitHtml you do not need double quotes around it.',
60
+ },
61
+ schema: [] // no options
62
+ },
63
+ create: function(context) {
64
+ return {
65
+ TaggedTemplateExpression(node) {
66
+ if (!isLitHtmlTemplateCall(node)) {
67
+ return;
68
+ }
69
+
70
+ // quasis here = the static parts of a template expression
71
+ // expressions = the dynamic parts of a template expression
72
+ // For example, given: <p class="${foo}"> we will have:
73
+ // quasis: ['<p class="', '">']
74
+ // expressions: ['foo'] (it's actually an AST node representing ${foo})
75
+ // So what we do is walk through and look for quasi pairs where:
76
+ // 1. the first ends with ="
77
+ // 2. the second begins with "
78
+ // We can then be confident that we have found an attribute with quotes around it.
79
+ node.quasi.quasis.forEach((templateElement, index) => {
80
+ if (templateElementPartEndsWithEqualsDoubleQuote(templateElement)) {
81
+ const nextElement = node.quasi.quasis[index + 1];
82
+ if (nextElement && templateElementPartStartsWithDoubleQuote(nextElement)) {
83
+ const expressionBetweenTheParts = node.quasi.expressions[index];
84
+ context.report({
85
+ node: expressionBetweenTheParts,
86
+ messageId: 'attributeQuotesNotRequired',
87
+ fix(fixer) {
88
+ return removeQuotesFromAttribute({
89
+ fixer,
90
+ firstPart: templateElement,
91
+ secondPart: nextElement,
92
+ });
93
+ }
94
+ });
95
+ }
96
+ }
97
+ });
98
+ },
99
+ };
100
+ }
101
+ };
@@ -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
+ };
@@ -0,0 +1,14 @@
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
+ }
14
+ };
@@ -17,14 +17,17 @@ ruleTester.run('l10n_filename_matches', rule, {
17
17
  {
18
18
  code: 'const str_ = i18n.i18n.registerUIStrings(\'components/test.ts\', UIStrings);',
19
19
  filename: 'front_end/components/test.ts',
20
+ options: [{rootFrontendDirectory: path.join(__dirname, '..', '..', '..', 'front_end')}]
20
21
  },
21
22
  {
22
23
  code: 'const str_ = i18n.i18n.registerUIStrings(\'components/ModuleUIStrings.js\', UIStrings);',
23
24
  filename: 'front_end/components/test.ts',
25
+ options: [{rootFrontendDirectory: path.join(__dirname, '..', '..', '..', 'front_end')}]
24
26
  },
25
27
  {
26
28
  code: 'const str_ = i18n.i18n.registerUIStrings(\'components/ModuleUIStrings.ts\', UIStrings);',
27
29
  filename: 'front_end/components/test.ts',
30
+ options: [{rootFrontendDirectory: path.join(__dirname, '..', '..', '..', 'front_end')}]
28
31
  },
29
32
  {
30
33
  code: 'const str_ = i18n.i18n.registerUIStrings(\'ModuleUIStrings.ts\', UIStrings);',
@@ -41,6 +44,7 @@ ruleTester.run('l10n_filename_matches', rule, {
41
44
  {
42
45
  code: 'const str_ = i18n.i18n.registerUIStrings(\'components/foo.ts\', UIStrings);',
43
46
  filename: 'front_end/components/test.ts',
47
+ options: [{rootFrontendDirectory: path.join(__dirname, '..', '..', '..', 'front_end')}],
44
48
  errors: [{
45
49
  message:
46
50
  'First argument to \'registerUIStrings\' call must be \'components/test.ts\' or the ModuleUIStrings.(js|ts)'
@@ -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
+ });