Fix Flipper lints #17

Summary: Mostly disabling warnings for scripts which are fine to use `console.error` directly.

Reviewed By: timur-valiev

Differential Revision: D30812956

fbshipit-source-id: 7fdc5bdf08f72d0d849ece6a4194d6a115d693f0
This commit is contained in:
Pascal Hartig
2021-09-13 02:31:08 -07:00
committed by Facebook GitHub Bot
parent 5fb23f83e9
commit 50f19ed3a0
12 changed files with 22 additions and 2 deletions

View File

@@ -15,6 +15,7 @@ import {runBuild, computePackageChecksum} from 'flipper-pkg-lib';
import yargs from 'yargs'; import yargs from 'yargs';
import tmp from 'tmp'; import tmp from 'tmp';
import {execSync} from 'child_process'; import {execSync} from 'child_process';
import {promisify} from 'util';
const argv = yargs const argv = yargs
.usage('yarn build-plugin [args]') .usage('yarn build-plugin [args]')
@@ -89,7 +90,7 @@ async function buildPlugin() {
: path.join(distDir, 'plugins', path.relative(pluginsDir, pluginDir)); : path.join(distDir, 'plugins', path.relative(pluginsDir, pluginDir));
await fs.ensureDir(path.dirname(outputFile)); await fs.ensureDir(path.dirname(outputFile));
await fs.remove(outputFile); await fs.remove(outputFile);
const {name: tmpDir} = tmp.dirSync(); const tmpDir = await promisify(tmp.dir)();
const packageJsonBackupPath = path.join(tmpDir, 'package.json'); const packageJsonBackupPath = path.join(tmpDir, 'package.json');
await fs.copy(packageJsonPath, packageJsonBackupPath, {overwrite: true}); await fs.copy(packageJsonPath, packageJsonBackupPath, {overwrite: true});
try { try {

View File

@@ -7,6 +7,8 @@
* @format * @format
*/ */
/* eslint-disable flipper/no-console-error-without-context */
import {bumpVersions} from './workspaces'; import {bumpVersions} from './workspaces';
import yargs from 'yargs'; import yargs from 'yargs';

View File

@@ -7,6 +7,8 @@
* @format * @format
*/ */
/* eslint-disable flipper/no-console-error-without-context */
import {computePackageChecksum} from 'flipper-pkg-lib'; import {computePackageChecksum} from 'flipper-pkg-lib';
import yargs from 'yargs'; import yargs from 'yargs';

View File

@@ -6,6 +6,7 @@
* *
* @format * @format
*/ */
/* eslint-disable flipper/no-console-error-without-context */
import {rootDir} from './paths'; import {rootDir} from './paths';
import path from 'path'; import path from 'path';

View File

@@ -7,6 +7,8 @@
* @format * @format
*/ */
/* eslint-disable flipper/no-console-error-without-context */
import {prepareDefaultPlugins} from './build-utils'; import {prepareDefaultPlugins} from './build-utils';
prepareDefaultPlugins().catch((err) => { prepareDefaultPlugins().catch((err) => {

View File

@@ -35,5 +35,5 @@ export default async function getAppWatchFolders() {
} }
return watchFolders return watchFolders
.filter((value, index, self) => self.indexOf(value) === index) .filter((value, index, self) => self.indexOf(value) === index)
.filter(fs.pathExistsSync); .filter(async (f) => fs.pathExists(f));
} }

View File

@@ -11,6 +11,8 @@
const fs = require('fs-extra'); const fs = require('fs-extra');
const path = require('path'); const path = require('path');
// Only used once at startup.
// eslint-disable-next-line node/no-sync
const isFB = fs.pathExistsSync(path.resolve(__dirname, '..', 'static', 'fb')); const isFB = fs.pathExistsSync(path.resolve(__dirname, '..', 'static', 'fb'));
module.exports = isFB; module.exports = isFB;

View File

@@ -7,6 +7,8 @@
* @format * @format
*/ */
/* eslint-disable flipper/no-console-error-without-context */
import {getWorkspaces} from './workspaces'; import {getWorkspaces} from './workspaces';
getWorkspaces() getWorkspaces()

View File

@@ -7,6 +7,8 @@
* @format * @format
*/ */
/* eslint-disable flipper/no-console-error-without-context */
import {publishPackages} from './workspaces'; import {publishPackages} from './workspaces';
import yargs from 'yargs'; import yargs from 'yargs';

View File

@@ -7,6 +7,8 @@
* @format * @format
*/ */
/* eslint-disable flipper/no-console-error-without-context */
import {resolvePluginDir} from './workspaces'; import {resolvePluginDir} from './workspaces';
resolvePluginDir(process.argv[2]) resolvePluginDir(process.argv[2])

View File

@@ -383,6 +383,8 @@ function buildErrorScreen() {
lines.push(err.message); lines.push(err.message);
lines.push( lines.push(
codeFrame( codeFrame(
// Part of a script, not blocking the UI loop.
// eslint-disable-next-line node/no-sync
fs.readFileSync(err.filename, 'utf8'), fs.readFileSync(err.filename, 'utf8'),
err.lineNumber, err.lineNumber,
err.column, err.column,

View File

@@ -7,6 +7,8 @@
* @format * @format
*/ */
/* eslint-disable flipper/no-console-error-without-context */
import fs from 'fs-extra'; import fs from 'fs-extra';
import path from 'path'; import path from 'path';
import {exec} from 'child_process'; import {exec} from 'child_process';