Skip to content

Commit

Permalink
chore: update eslint config and prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
satya164 committed Oct 24, 2023
1 parent b0316a6 commit 8e0e96b
Show file tree
Hide file tree
Showing 5 changed files with 489 additions and 195 deletions.
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@
"@lerna-lite/run": "^1.13.0",
"commitlint": "^17.0.2",
"concurrently": "^7.2.2",
"eslint": "^8.18.0",
"eslint-config-satya164": "^3.1.11",
"prettier": "^2.7.1",
"typescript": "^5.0.2"
"eslint": "^8.52.0",
"eslint-config-satya164": "^3.2.0",
"prettier": "^3.0.3",
"typescript": "^5.2.2"
},
"commitlint": {
"extends": [
Expand Down
19 changes: 10 additions & 9 deletions packages/create-react-native-library/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -263,13 +263,15 @@ const args: Record<ArgName, yargs.Options> = {
},
};

// FIXME: fix the type
// eslint-disable-next-line @typescript-eslint/no-explicit-any
async function create(argv: yargs.Arguments<any>) {
let local = false;

if (typeof argv.local === 'boolean') {
local = argv.local;
} else {
let hasPackageJson = await fs.pathExists(
const hasPackageJson = await fs.pathExists(
path.join(process.cwd(), 'package.json')
);

Expand Down Expand Up @@ -397,7 +399,7 @@ async function create(argv: yargs.Arguments<any>) {
type: local ? null : 'text',
name: 'authorUrl',
message: 'What is the URL for the package author?',
// @ts-ignore: this is supported, but types are wrong
// @ts-expect-error this is supported, but types are wrong
initial: async (previous: string) => {
try {
const username = await githubUsername(previous);
Expand All @@ -415,7 +417,6 @@ async function create(argv: yargs.Arguments<any>) {
type: local ? null : 'text',
name: 'repoUrl',
message: 'What is the URL for the repository?',
// @ts-ignore: this is supported, but types are wrong
initial: (_: string, answers: Answers) => {
if (/^https?:\/\/github.com\/[^/]+/.test(answers.authorUrl)) {
return `${answers.authorUrl}/${answers.slug
Expand Down Expand Up @@ -550,9 +551,9 @@ async function create(argv: yargs.Arguments<any>) {

try {
version = await Promise.race([
new Promise<string>((resolve) =>
setTimeout(() => resolve(FALLBACK_BOB_VERSION), 1000)
),
new Promise<string>((resolve) => {
setTimeout(() => resolve(FALLBACK_BOB_VERSION), 1000);
}),
spawn('npm', ['view', 'react-native-builder-bob', 'dist-tags.latest']),
]);
} catch (e) {
Expand Down Expand Up @@ -870,8 +871,8 @@ async function create(argv: yargs.Arguments<any>) {
.map(
([script, { name, color }]) => `
${kleur[color](`Run the example app on ${kleur.bold(name)}`)}${kleur.gray(
':'
)}
':'
)}
${kleur.gray('$')} yarn example ${script}`
)
Expand All @@ -884,7 +885,7 @@ async function create(argv: yargs.Arguments<any>) {
);
}
}
// eslint-disable-next-line babel/no-unused-expressions

yargs
.command('$0 [name]', 'create a react native library', args, create)
.demandCommand()
Expand Down
3 changes: 1 addition & 2 deletions packages/react-native-builder-bob/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import buildModule from './targets/module';
import buildTypescript from './targets/typescript';
import type { Options } from './types';

// eslint-disable-next-line import/no-commonjs
// eslint-disable-next-line import/no-commonjs, @typescript-eslint/no-var-requires
const { name, version } = require('../package.json');

const root = process.cwd();
Expand All @@ -22,7 +22,6 @@ const explorer = cosmiconfigSync(name, {

const FLOW_PRGAMA_REGEX = /\*?\s*@(flow)\b/m;

// eslint-disable-next-line babel/no-unused-expressions
yargs
.command('init', 'configure the package to use bob', {}, async () => {
if (isGitDirty()) {
Expand Down
2 changes: 1 addition & 1 deletion packages/react-native-builder-bob/src/utils/logger.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import kleur from 'kleur';

const logger =
(type: string, color: Function) =>
(type: string, color: kleur.Color) =>
(...messages: unknown[]) => {
console.log(
color(kleur.bold(type)),
Expand Down
Loading

0 comments on commit 8e0e96b

Please sign in to comment.