Summary: Bumps [eslint](https://github.com/eslint/eslint) from 8.38.0 to 8.40.0. <details> <summary>Release notes</summary> <p><em>Sourced from <a href="https://github.com/eslint/eslint/releases">eslint's releases</a>.</em></p> <blockquote> <h2>v8.40.0</h2> <h2>Features</h2> <ul> <li><a href="5db7808139"><code>5db7808</code></a> feat: improve flat config errors for invalid rule options and severities (<a href="https://redirect.github.com/eslint/eslint/issues/17140">#17140</a>) (Josh Goldberg ✨)</li> <li><a href="f5574dc739"><code>f5574dc</code></a> feat: Add findConfigFile() method to FlatESLint (<a href="https://redirect.github.com/eslint/eslint/issues/17142">#17142</a>) (Nicholas C. Zakas)</li> <li><a href="e52b98bf25"><code>e52b98b</code></a> feat: add <code>sourceCode</code> property to the rule context (<a href="https://redirect.github.com/eslint/eslint/issues/17107">#17107</a>) (Nitin Kumar)</li> <li><a href="1468f5b640"><code>1468f5b</code></a> feat: add <code>physicalFilename</code> property to the rule context (<a href="https://redirect.github.com/eslint/eslint/issues/17111">#17111</a>) (Nitin Kumar)</li> <li><a href="0df4d4f658"><code>0df4d4f</code></a> feat: add <code>cwd</code> to rule context (<a href="https://redirect.github.com/eslint/eslint/issues/17106">#17106</a>) (Nitin Kumar)</li> <li><a href="52018f21c1"><code>52018f2</code></a> feat: add <code>filename</code> property to the rule context (<a href="https://redirect.github.com/eslint/eslint/issues/17108">#17108</a>) (Nitin Kumar)</li> <li><a href="559ff4e4bc"><code>559ff4e</code></a> feat: add new <code>omitLastInOneLineClassBody</code> option to the <code>semi</code> rule (<a href="https://redirect.github.com/eslint/eslint/issues/17105">#17105</a>) (Nitin Kumar)</li> </ul> <h2>Bug Fixes</h2> <ul> <li><a href="f076e54ecd"><code>f076e54</code></a> fix: Ensure FlatESLint#findConfigFile() doesn't throw. (<a href="https://redirect.github.com/eslint/eslint/issues/17151">#17151</a>) (Nicholas C. Zakas)</li> </ul> <h2>Documentation</h2> <ul> <li><a href="e980bf38cf"><code>e980bf3</code></a> docs: Update README (GitHub Actions Bot)</li> <li><a href="e92a6fc7ed"><code>e92a6fc</code></a> docs: Update README (GitHub Actions Bot)</li> <li><a href="af5fe64c39"><code>af5fe64</code></a> docs: Fix custom rule schema docs (<a href="https://redirect.github.com/eslint/eslint/issues/17115">#17115</a>) (Adam Jones)</li> <li><a href="4a352a957b"><code>4a352a9</code></a> docs: explain how to include predefined globals (<a href="https://redirect.github.com/eslint/eslint/issues/17114">#17114</a>) (Marcus Wyatt)</li> <li><a href="5ea15d92ee"><code>5ea15d9</code></a> docs: add mastodon link in readme (<a href="https://redirect.github.com/eslint/eslint/issues/17110">#17110</a>) (唯然)</li> </ul> <h2>Chores</h2> <ul> <li><a href="4053004c95"><code>4053004</code></a> chore: upgrade <code>@eslint/js</code><a href="https://github.com/8"><code>@8</code></a>.40.0 (<a href="https://redirect.github.com/eslint/eslint/issues/17156">#17156</a>) (Milos Djermanovic)</li> <li><a href="50fed1da44"><code>50fed1d</code></a> chore: package.json update for <code>@eslint/js</code> release (ESLint Jenkins)</li> <li><a href="4c7a170b04"><code>4c7a170</code></a> chore: upgrade <code>@eslint/eslintrc</code><a href="https://github.com/2"><code>@2</code></a>.0.3 (<a href="https://redirect.github.com/eslint/eslint/issues/17155">#17155</a>) (Milos Djermanovic)</li> <li><a href="e80b7cce64"><code>e80b7cc</code></a> chore: upgrade espree@9.5.2 (<a href="https://redirect.github.com/eslint/eslint/issues/17154">#17154</a>) (Milos Djermanovic)</li> <li><a href="ce3ac91b51"><code>ce3ac91</code></a> chore: upgrade eslint-visitor-keys@3.4.1 (<a href="https://redirect.github.com/eslint/eslint/issues/17153">#17153</a>) (Milos Djermanovic)</li> <li><a href="9094d79fb4"><code>9094d79</code></a> chore: add <code>latest/</code> to <code>meta.docs.url</code> in all core rules (<a href="https://redirect.github.com/eslint/eslint/issues/17136">#17136</a>) (Milos Djermanovic)</li> <li><a href="d85efad655"><code>d85efad</code></a> perf: don't use <code>grapheme-splitter</code> on ASCII strings in key-spacing rule (<a href="https://redirect.github.com/eslint/eslint/issues/17122">#17122</a>) (Milos Djermanovic)</li> </ul> <h2>v8.39.0</h2> <h2>Features</h2> <ul> <li><a href="3f7af9f408"><code>3f7af9f</code></a> feat: Implement <code>SourceCode#markVariableAsUsed()</code> (<a href="https://redirect.github.com/eslint/eslint/issues/17086">#17086</a>) (Nicholas C. Zakas)</li> </ul> <h2>Documentation</h2> <ul> <li><a href="6987dc59e4"><code>6987dc5</code></a> docs: Fix formatting in Custom Rules docs (<a href="https://redirect.github.com/eslint/eslint/issues/17097">#17097</a>) (Milos Djermanovic)</li> <li><a href="4ee92e5cbd"><code>4ee92e5</code></a> docs: Update README (GitHub Actions Bot)</li> <li><a href="d8e9887c2c"><code>d8e9887</code></a> docs: Custom Rules cleanup/expansion (<a href="https://redirect.github.com/eslint/eslint/issues/16906">#16906</a>) (Ben Perlmutter)</li> <li><a href="1fea279780"><code>1fea279</code></a> docs: Clarify how to add to tsc agenda (<a href="https://redirect.github.com/eslint/eslint/issues/17084">#17084</a>) (Nicholas C. Zakas)</li> <li><a href="970ef1c868"><code>970ef1c</code></a> docs: Update triage board location (Nicholas C. Zakas)</li> <li><a href="6d8bffdf45"><code>6d8bffd</code></a> docs: Update README (GitHub Actions Bot)</li> </ul> <h2>Chores</h2> <ul> <li><a href="60a6f2694d"><code>60a6f26</code></a> chore: upgrade <code>@eslint/js</code><a href="https://github.com/8"><code>@8</code></a>.39.0 (<a href="https://redirect.github.com/eslint/eslint/issues/17102">#17102</a>) (Milos Djermanovic)</li> <li><a href="d5ba5c0a85"><code>d5ba5c0</code></a> chore: package.json update for <code>@eslint/js</code> release (ESLint Jenkins)</li> <li><a href="f57eff20f5"><code>f57eff2</code></a> ci: run tests on Node.js v20 (<a href="https://redirect.github.com/eslint/eslint/issues/17093">#17093</a>) (Nitin Kumar)</li> <li><a href="9d1b8fc60c"><code>9d1b8fc</code></a> perf: Binary search in token store <code>utils.search</code> (<a href="https://redirect.github.com/eslint/eslint/issues/17066">#17066</a>) (Francesco Trotta)</li> <li><a href="07a4435a0c"><code>07a4435</code></a> chore: Add request for minimal repro to bug report (<a href="https://redirect.github.com/eslint/eslint/issues/17081">#17081</a>) (Nicholas C. Zakas)</li> <li><a href="eac4943ba2"><code>eac4943</code></a> refactor: remove unnecessary use of <code>SourceCode#getAncestors</code> in rules (<a href="https://redirect.github.com/eslint/eslint/issues/17075">#17075</a>) (Milos Djermanovic)</li> <li><a href="0a7b60a9d5"><code>0a7b60a</code></a> chore: update description of <code>SourceCode#getDeclaredVariables</code> (<a href="https://redirect.github.com/eslint/eslint/issues/17072">#17072</a>) (Milos Djermanovic)</li> <li><a href="6e2df71cc3"><code>6e2df71</code></a> chore: remove unnecessary references to the LICENSE file (<a href="https://redirect.github.com/eslint/eslint/issues/17071">#17071</a>) (Milos Djermanovic)</li> </ul> </blockquote> </details> <details> <summary>Changelog</summary> <p><em>Sourced from <a href="https://github.com/eslint/eslint/blob/main/CHANGELOG.md">eslint's changelog</a>.</em></p> <blockquote> <p>v8.40.0 - May 5, 2023</p> <ul> <li><a href="4053004c95"><code>4053004</code></a> chore: upgrade <code>@eslint/js</code><a href="https://github.com/8"><code>@8</code></a>.40.0 (<a href="https://redirect.github.com/eslint/eslint/issues/17156">#17156</a>) (Milos Djermanovic)</li> <li><a href="50fed1da44"><code>50fed1d</code></a> chore: package.json update for <code>@eslint/js</code> release (ESLint Jenkins)</li> <li><a href="f076e54ecd"><code>f076e54</code></a> fix: Ensure FlatESLint#findConfigFile() doesn't throw. (<a href="https://redirect.github.com/eslint/eslint/issues/17151">#17151</a>) (Nicholas C. Zakas)</li> <li><a href="4c7a170b04"><code>4c7a170</code></a> chore: upgrade <code>@eslint/eslintrc</code><a href="https://github.com/2"><code>@2</code></a>.0.3 (<a href="https://redirect.github.com/eslint/eslint/issues/17155">#17155</a>) (Milos Djermanovic)</li> <li><a href="e80b7cce64"><code>e80b7cc</code></a> chore: upgrade espree@9.5.2 (<a href="https://redirect.github.com/eslint/eslint/issues/17154">#17154</a>) (Milos Djermanovic)</li> <li><a href="ce3ac91b51"><code>ce3ac91</code></a> chore: upgrade eslint-visitor-keys@3.4.1 (<a href="https://redirect.github.com/eslint/eslint/issues/17153">#17153</a>) (Milos Djermanovic)</li> <li><a href="5db7808139"><code>5db7808</code></a> feat: improve flat config errors for invalid rule options and severities (<a href="https://redirect.github.com/eslint/eslint/issues/17140">#17140</a>) (Josh Goldberg ✨)</li> <li><a href="f5574dc739"><code>f5574dc</code></a> feat: Add findConfigFile() method to FlatESLint (<a href="https://redirect.github.com/eslint/eslint/issues/17142">#17142</a>) (Nicholas C. Zakas)</li> <li><a href="e52b98bf25"><code>e52b98b</code></a> feat: add <code>sourceCode</code> property to the rule context (<a href="https://redirect.github.com/eslint/eslint/issues/17107">#17107</a>) (Nitin Kumar)</li> <li><a href="e980bf38cf"><code>e980bf3</code></a> docs: Update README (GitHub Actions Bot)</li> <li><a href="9094d79fb4"><code>9094d79</code></a> chore: add <code>latest/</code> to <code>meta.docs.url</code> in all core rules (<a href="https://redirect.github.com/eslint/eslint/issues/17136">#17136</a>) (Milos Djermanovic)</li> <li><a href="1468f5b640"><code>1468f5b</code></a> feat: add <code>physicalFilename</code> property to the rule context (<a href="https://redirect.github.com/eslint/eslint/issues/17111">#17111</a>) (Nitin Kumar)</li> <li><a href="0df4d4f658"><code>0df4d4f</code></a> feat: add <code>cwd</code> to rule context (<a href="https://redirect.github.com/eslint/eslint/issues/17106">#17106</a>) (Nitin Kumar)</li> <li><a href="52018f21c1"><code>52018f2</code></a> feat: add <code>filename</code> property to the rule context (<a href="https://redirect.github.com/eslint/eslint/issues/17108">#17108</a>) (Nitin Kumar)</li> <li><a href="559ff4e4bc"><code>559ff4e</code></a> feat: add new <code>omitLastInOneLineClassBody</code> option to the <code>semi</code> rule (<a href="https://redirect.github.com/eslint/eslint/issues/17105">#17105</a>) (Nitin Kumar)</li> <li><a href="e92a6fc7ed"><code>e92a6fc</code></a> docs: Update README (GitHub Actions Bot)</li> <li><a href="d85efad655"><code>d85efad</code></a> perf: don't use <code>grapheme-splitter</code> on ASCII strings in key-spacing rule (<a href="https://redirect.github.com/eslint/eslint/issues/17122">#17122</a>) (Milos Djermanovic)</li> <li><a href="af5fe64c39"><code>af5fe64</code></a> docs: Fix custom rule schema docs (<a href="https://redirect.github.com/eslint/eslint/issues/17115">#17115</a>) (Adam Jones)</li> <li><a href="4a352a957b"><code>4a352a9</code></a> docs: explain how to include predefined globals (<a href="https://redirect.github.com/eslint/eslint/issues/17114">#17114</a>) (Marcus Wyatt)</li> <li><a href="5ea15d92ee"><code>5ea15d9</code></a> docs: add mastodon link in readme (<a href="https://redirect.github.com/eslint/eslint/issues/17110">#17110</a>) (唯然)</li> </ul> <p>v8.39.0 - April 21, 2023</p> <ul> <li><a href="60a6f2694d"><code>60a6f26</code></a> chore: upgrade <code>@eslint/js</code><a href="https://github.com/8"><code>@8</code></a>.39.0 (<a href="https://redirect.github.com/eslint/eslint/issues/17102">#17102</a>) (Milos Djermanovic)</li> <li><a href="d5ba5c0a85"><code>d5ba5c0</code></a> chore: package.json update for <code>@eslint/js</code> release (ESLint Jenkins)</li> <li><a href="6987dc59e4"><code>6987dc5</code></a> docs: Fix formatting in Custom Rules docs (<a href="https://redirect.github.com/eslint/eslint/issues/17097">#17097</a>) (Milos Djermanovic)</li> <li><a href="4ee92e5cbd"><code>4ee92e5</code></a> docs: Update README (GitHub Actions Bot)</li> <li><a href="3f7af9f408"><code>3f7af9f</code></a> feat: Implement <code>SourceCode#markVariableAsUsed()</code> (<a href="https://redirect.github.com/eslint/eslint/issues/17086">#17086</a>) (Nicholas C. Zakas)</li> <li><a href="d8e9887c2c"><code>d8e9887</code></a> docs: Custom Rules cleanup/expansion (<a href="https://redirect.github.com/eslint/eslint/issues/16906">#16906</a>) (Ben Perlmutter)</li> <li><a href="f57eff20f5"><code>f57eff2</code></a> ci: run tests on Node.js v20 (<a href="https://redirect.github.com/eslint/eslint/issues/17093">#17093</a>) (Nitin Kumar)</li> <li><a href="1fea279780"><code>1fea279</code></a> docs: Clarify how to add to tsc agenda (<a href="https://redirect.github.com/eslint/eslint/issues/17084">#17084</a>) (Nicholas C. Zakas)</li> <li><a href="970ef1c868"><code>970ef1c</code></a> docs: Update triage board location (Nicholas C. Zakas)</li> <li><a href="9d1b8fc60c"><code>9d1b8fc</code></a> perf: Binary search in token store <code>utils.search</code> (<a href="https://redirect.github.com/eslint/eslint/issues/17066">#17066</a>) (Francesco Trotta)</li> <li><a href="07a4435a0c"><code>07a4435</code></a> chore: Add request for minimal repro to bug report (<a href="https://redirect.github.com/eslint/eslint/issues/17081">#17081</a>) (Nicholas C. Zakas)</li> <li><a href="eac4943ba2"><code>eac4943</code></a> refactor: remove unnecessary use of <code>SourceCode#getAncestors</code> in rules (<a href="https://redirect.github.com/eslint/eslint/issues/17075">#17075</a>) (Milos Djermanovic)</li> <li><a href="6d8bffdf45"><code>6d8bffd</code></a> docs: Update README (GitHub Actions Bot)</li> <li><a href="0a7b60a9d5"><code>0a7b60a</code></a> chore: update description of <code>SourceCode#getDeclaredVariables</code> (<a href="https://redirect.github.com/eslint/eslint/issues/17072">#17072</a>) (Milos Djermanovic)</li> <li><a href="6e2df71cc3"><code>6e2df71</code></a> chore: remove unnecessary references to the LICENSE file (<a href="https://redirect.github.com/eslint/eslint/issues/17071">#17071</a>) (Milos Djermanovic)</li> </ul> </blockquote> </details> <details> <summary>Commits</summary> <ul> <li><a href="69a19c83e4"><code>69a19c8</code></a> 8.40.0</li> <li><a href="9ef73ea70c"><code>9ef73ea</code></a> Build: changelog update for 8.40.0</li> <li><a href="4053004c95"><code>4053004</code></a> chore: upgrade <code>@eslint/js</code><a href="https://github.com/8"><code>@8</code></a>.40.0 (<a href="https://redirect.github.com/eslint/eslint/issues/17156">#17156</a>)</li> <li><a href="50fed1da44"><code>50fed1d</code></a> chore: package.json update for <code>@eslint/js</code> release</li> <li><a href="f076e54ecd"><code>f076e54</code></a> fix: Ensure FlatESLint#findConfigFile() doesn't throw. (<a href="https://redirect.github.com/eslint/eslint/issues/17151">#17151</a>)</li> <li><a href="4c7a170b04"><code>4c7a170</code></a> chore: upgrade <code>@eslint/eslintrc</code><a href="https://github.com/2"><code>@2</code></a>.0.3 (<a href="https://redirect.github.com/eslint/eslint/issues/17155">#17155</a>)</li> <li><a href="e80b7cce64"><code>e80b7cc</code></a> chore: upgrade espree@9.5.2 (<a href="https://redirect.github.com/eslint/eslint/issues/17154">#17154</a>)</li> <li><a href="ce3ac91b51"><code>ce3ac91</code></a> chore: upgrade eslint-visitor-keys@3.4.1 (<a href="https://redirect.github.com/eslint/eslint/issues/17153">#17153</a>)</li> <li><a href="5db7808139"><code>5db7808</code></a> feat: improve flat config errors for invalid rule options and severities (<a href="https://redirect.github.com/eslint/eslint/issues/17">https://github.com/facebook/flipper/issues/17</a>...</li> <li><a href="f5574dc739"><code>f5574dc</code></a> feat: Add findConfigFile() method to FlatESLint (<a href="https://redirect.github.com/eslint/eslint/issues/17142">#17142</a>)</li> <li>Additional commits viewable in <a href="https://github.com/eslint/eslint/compare/v8.38.0...v8.40.0">compare view</a></li> </ul> </details> <br /> [](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - `dependabot rebase` will rebase this PR - `dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `dependabot merge` will merge this PR after your CI passes on it - `dependabot squash and merge` will squash and merge this PR after your CI passes on it - `dependabot cancel merge` will cancel a previously requested merge and block automerging - `dependabot reopen` will reopen this PR if it is closed - `dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) </details> Pull Request resolved: https://github.com/facebook/flipper/pull/4728 Reviewed By: passy Differential Revision: D46016561 Pulled By: ivanmisuno fbshipit-source-id: 23a93c6f74556743e2e9d9362efa5f7b9f95928a
js-flipper
This package exposes JavaScript bindings to talk from web / Node.js directly to flipper.
Installation
yarn add js-flipper
Usage
How to build Flipper plugins is explained in the flipper documentation: Creating a Flipper plugin. Building a Flipper plugin involves building a plugin for the Desktop app, and a plugin that runs on a Device (web or Node.js). This package is only needed for the plugin that runs on the device (web / Node.js), and wants to use the WebSocket connection to communicate to Flipper.
This package exposes a flipperClient. It has:
addPluginmethod. It accepts apluginparameter, that registers a client plugin and will fire the relevant callbacks if the corresponding desktop plugin is selected in the Flipper Desktop. The full plugin API is documented here.startmethod. It starts the client. It has two arguments:appName- (required) the name displayed in Flipperoptionswhich conforms to the interfaceinterface FlipperClientOptions { // Make the client connect to a different URL urlBase?: string; // Override WebSocket implementation (Node.js folks, it is for you!) websocketFactory?: (url: string) => FlipperWebSocket; // Override how errors are handled (it is simple `console.error` by default) onError?: (e: unknown) => void; // Timeout after which client tries to reconnect to Flipper reconnectTimeout?: number; // Set device ID. Default: random ID persisted to local storage. getDeviceId?: () => Promise<string> | string }
Example (web)
An example plugin can be found in FlipperTicTacToe.js.
The corresponding Desktop plugin ships by default in Flipper, so importing the
above file and dropping the <FlipperTicTacToe /> component somewhere in your
application should work out of the box.
The sources of the corresponding Desktop plugin can be found here.
Node.js
Node.js does not have a built-in WebSocket implementation. You need to install any implementation of WebSockets for Node.js that is compatible with the interface of the web version.
import flipperClient from 'js-flipper';
// Say, you decided to go with 'ws'
// https://github.com/websockets/ws
import WebSocket from 'ws';
// Start the client and pass some options
// You might ask yourself why there is the second argument `{ origin: 'localhost:' }`
// Flipper Desktop verifies the `Origin` header for every WS connection. You need to set it to one of the whitelisted values (see `VALID_WEB_SOCKET_REQUEST_ORIGIN_PREFIXES`).
flipperClient.start('My cool nodejs app', { websocketFactory: url => new WebSocket(url, {origin: 'localhost:'}) });
An example plugin should be somewhat similar to what we have for React. It is currently WIP (do not confuse with RIP!).