Summary: Bumps [typescript-eslint/experimental-utils](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/experimental-utils) from 5.10.1 to 5.10.2. <details> <summary>Release notes</summary> <p><em>Sourced from <a href="https://github.com/typescript-eslint/typescript-eslint/releases"><code>@typescript-eslint/experimental-utils</code>'s releases</a>.</em></p> <blockquote> <h2>v5.10.2</h2> <h2><a href="https://github.com/typescript-eslint/typescript-eslint/compare/v5.10.1...v5.10.2">5.10.2</a> (2022-01-31)</h2> <h3>Bug Fixes</h3> <ul> <li><strong>eslint-plugin:</strong> [no-restricted-imports] allow relative type imports with patterns configured (<a href="https://github-redirect.dependabot.com/typescript-eslint/typescript-eslint/issues/4494">#4494</a>) (<a href="4a6d217ae8">4a6d217</a>)</li> </ul> </blockquote> </details> <details> <summary>Changelog</summary> <p><em>Sourced from <a href="https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/experimental-utils/CHANGELOG.md"><code>@typescript-eslint/experimental-utils</code>'s changelog</a>.</em></p> <blockquote> <h2><a href="https://github.com/typescript-eslint/typescript-eslint/compare/v5.10.1...v5.10.2">5.10.2</a> (2022-01-31)</h2> <p><strong>Note:</strong> Version bump only for package <code>@typescript-eslint/experimental-utils</code></p> </blockquote> </details> <details> <summary>Commits</summary> <ul> <li><a href="1d88ac1d57"><code>1d88ac1</code></a> chore: publish v5.10.2</li> <li>See full diff in <a href="https://github.com/typescript-eslint/typescript-eslint/commits/v5.10.2/packages/experimental-utils">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/3411 Reviewed By: passy Differential Revision: D34050514 Pulled By: mweststrate fbshipit-source-id: 272d07121cbfe0720b23844f50942c5b04fb5809
53 lines
1.5 KiB
TypeScript
53 lines
1.5 KiB
TypeScript
/**
|
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*
|
|
* @format
|
|
*/
|
|
|
|
import {TSESTree} from '@typescript-eslint/experimental-utils';
|
|
import {createESLintRule} from '../utils/createEslintRule';
|
|
|
|
type Options = [];
|
|
|
|
export type MessageIds = 'noElectronRemoteImports';
|
|
export const RULE_NAME = 'no-electron-remote-imports';
|
|
|
|
export default createESLintRule<Options, MessageIds>({
|
|
name: RULE_NAME,
|
|
meta: {
|
|
type: 'suggestion',
|
|
docs: {
|
|
description: '`remote` is slow. Please be careful when using it.',
|
|
recommended: 'warn',
|
|
},
|
|
schema: [],
|
|
messages: {
|
|
noElectronRemoteImports:
|
|
'Accessing properties on the `remote` object is blocking and 10,000x slower than a local one. Please consider alternatives or cache your access.',
|
|
},
|
|
},
|
|
defaultOptions: [],
|
|
create(context) {
|
|
return {
|
|
ImportDeclaration(node: TSESTree.ImportDeclaration) {
|
|
if (node.source.value === 'electron') {
|
|
const hasImport =
|
|
node.specifiers.filter(
|
|
(v) =>
|
|
v.type === 'ImportSpecifier' && v.imported.name === 'remote',
|
|
).length > 0;
|
|
if (hasImport) {
|
|
context.report({
|
|
node,
|
|
messageId: 'noElectronRemoteImports',
|
|
});
|
|
}
|
|
}
|
|
},
|
|
};
|
|
},
|
|
}) as any /* unnameable return type */;
|