Skip to content

Commit

Permalink
chore: fix lint warnings (#1582)
Browse files Browse the repository at this point in the history
  • Loading branch information
mshima authored Dec 12, 2024
1 parent 9e2195f commit efa92b3
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 15 deletions.
4 changes: 2 additions & 2 deletions src/actions/fs.ts
Original file line number Diff line number Diff line change
@@ -1,9 1,9 @@
/* eslint max-params: [1, 5] */
/* eslint max-params: [1, 6] */
import assert from 'node:assert';
import { type CopyOptions, type MemFsEditor } from 'mem-fs-editor';
import type { Data as TemplateData, Options as TemplateOptions } from 'ejs';
import type { OverloadParameters, OverloadReturnType } from '../types-utils.js';
import type BaseGenerator from '../generator.js';
import type { BaseGenerator } from '../generator.js';

export type Template<D extends TemplateData, G> = {
/**
Expand Down
2 changes: 1 addition & 1 deletion src/actions/help.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 2,7 @@ import path from 'node:path';
import fs from 'node:fs';
import table from 'text-table';
import type { ArgumentSpec, CliOptionSpec } from '../types.js';
import type BaseGenerator from '../generator.js';
import type { BaseGenerator } from '../generator.js';

function formatArg(config: ArgumentSpec) {
let arg = `<${config.name}>`;
Expand Down
2 changes: 1 addition & 1 deletion src/actions/spawn-command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 9,7 @@ import {
execaCommandSync,
execaSync,
} from 'execa';
import type BaseGenerator from '../generator.js';
import type { BaseGenerator } from '../generator.js';

export class SpawnCommandMixin {
/**
Expand Down
6 changes: 3 additions & 3 deletions src/generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 4,7 @@ import os from 'node:os';
import { EventEmitter } from 'node:events';
import { fileURLToPath } from 'node:url';
import * as _ from 'lodash-es';
import semver from 'semver';
import { lte as semverLte } from 'semver';
import { readPackageUpSync } from 'read-package-up';
import chalk from 'chalk';
import minimist from 'minimist';
Expand Down Expand Up @@ -291,15 291,15 @@ export class BaseGenerator<O extends BaseOptions = BaseOptions, F extends BaseFe

console.warn(`It's not possible to check version with running Environment less than ${ENV_VER_WITH_VER_API}`);
console.warn('Some features may be missing');
if (semver.lte(versionToCheck, '2.8.1')) {
if (semverLte(versionToCheck, '2.8.1')) {
return undefined;
}

return false;
}

const runningVersion = this.env.getVersion(packageDependency);
if (runningVersion !== undefined && semver.lte(versionToCheck, runningVersion)) {
if (runningVersion !== undefined && semverLte(versionToCheck, runningVersion)) {
return true;
}

Expand Down
4 changes: 2 additions & 2 deletions src/util/storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 8,10 @@ import type { StorageRecord, StorageValue } from '../types.js';
* Proxy handler for Storage
*/
const proxyHandler: ProxyHandler<Storage> = {
get(storage: Storage, property: string, receiver: any): StorageValue {
get(storage: Storage, property: string, _receiver: any): StorageValue {
return storage.get(property);
},
set(storage: Storage, property: string, value: any, receiver: any): boolean {
set(storage: Storage, property: string, value: any, _receiver: any): boolean {
if (typeof property === 'string') {
storage.set(property, value);
return true;
Expand Down
2 changes: 1 addition & 1 deletion test/fs.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 5,7 @@ import { TestAdapter } from '@yeoman/adapter/testing';
import { type SinonStub, stub as sinonStub } from 'sinon';
import type { Data as TemplateData } from 'ejs';
import Environment from 'yeoman-environment';
import BaseGenerator from '../src/generator.js';
import { BaseGenerator } from '../src/generator.js';
import Base from './utils.js';

const randomString = () => Math.random().toString(36).slice(7);
Expand Down
4 changes: 2 additions & 2 deletions test/generators.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 5,7 @@ import { beforeEach, describe, it } from 'vitest';
import { TestAdapter } from '@yeoman/adapter/testing';
import Environment from 'yeoman-environment';
import assert from 'yeoman-assert';
import semver from 'semver';
import { valid as semverValid } from 'semver';
import Base from './utils.js';

const NAMESPACE = 'somenamespace';
Expand All @@ -31,7 31,7 @@ describe('Generators module', () => {
});

it('should expose yoGeneratorVersion', () => {
assert(semver.valid(generator.yoGeneratorVersion), `Not valid version ${generator.yoGeneratorVersion as string}`);
assert(semverValid(generator.yoGeneratorVersion), `Not valid version ${generator.yoGeneratorVersion as string}`);
});

it('is an EventEmitter', () =>
Expand Down
6 changes: 3 additions & 3 deletions test/package-json.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 1,6 @@
import assert from 'node:assert';
import { beforeEach, describe, expect, it, vi } from 'vitest';
import semver from 'semver';
import { lte as semverLte } from 'semver';
import helpers from 'yeoman-test';
import type { BaseEnvironment } from '@yeoman/types';
import Generator from '../src/index.js';
Expand All @@ -21,7 21,7 @@ describe('Base#package-json', () => {

describe('_resolvePackageJsonDependencies()', () => {
it('should accept empty version and resolve', async ctx => {
if (semver.lte(env.getVersion(), '3.1.0')) {
if (semverLte(env.getVersion(), '3.1.0')) {
ctx.skip();
}
const dependencies = await generator._resolvePackageJsonDependencies('yeoman-generator');
Expand All @@ -40,7 40,7 @@ describe('Base#package-json', () => {
});

it('should resolve object with empty version and resolve', async ctx => {
if (semver.lte(env.getVersion(), '3.1.0')) {
if (semverLte(env.getVersion(), '3.1.0')) {
ctx.skip();
}

Expand Down

0 comments on commit efa92b3

Please sign in to comment.