Skip to content

Commit

Permalink
lint: no-unused
Browse files Browse the repository at this point in the history
  • Loading branch information
ealush committed Oct 5, 2024
1 parent 3e9c0af commit a11ac9b
Show file tree
Hide file tree
Showing 15 changed files with 22 additions and 39 deletions.
17 changes: 12 additions & 5 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ module.exports = {
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-unused-vars': [
1,
2,
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
Expand Down Expand Up @@ -113,9 +113,6 @@ module.exports = {
],
},
],
'vitest/expect-expect': 0,
'vitest/no-identical-title': 0,
'vitest/no-standalone-expect': 0,
'max-params': [1, { max: 4 }],
'no-console': 2,
'no-else-return': 1,
Expand All @@ -127,7 +124,14 @@ module.exports = {
'no-undef': 2,
'no-unneeded-ternary': 2,
'no-unused-expressions': 2,
'no-unused-vars': 0,
'no-unused-vars': [
2,
{
args: 'after-used',
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
},
],
'no-useless-catch': 2,
'no-useless-computed-key': 2,
'no-useless-return': 2,
Expand All @@ -144,6 +148,9 @@ module.exports = {
minKeys: 4,
},
],
'vitest/expect-expect': 0,
'vitest/no-identical-title': 0,
'vitest/no-standalone-expect': 0,
},
settings: {
'import/parsers': {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
import { SuiteWalker } from 'SuiteWalker';
import { describe, it, expect, beforeEach } from 'vitest';
import wait from 'wait';

import * as vest from 'vest';

describe('SuiteWalker.useHasRemainingWithTestNameMatching', () => {
let hasRemaining: boolean | null = null;
let count = 0;

beforeEach(() => {
hasRemaining = null;
count = 0;
});
describe('When no field specified', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/vest/src/core/test/test.memo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ function useGetTestFromCache(
return cache(dependencies, cacheAction);
}

// FIXME(@ealush 2024-08-12): This is some kind of a hack. Instead organically letting Vest set the next
// FIXME:(@ealush 2024-08-12): This is some kind of a hack. Instead organically letting Vest set the next

Check warning on line 69 in packages/vest/src/core/test/test.memo.ts

View workflow job for this annotation

GitHub Actions / build (20)

Unexpected 'fixme' comment: 'FIXME:(@*** 2024-08-12): This is some...'
// child of the isolate, we're forcing it from the outside.
// Instead, an ideal solution would probably be to have test.memo be its own isolate
// that just injects a historic output from a previous test run.
Expand Down
2 changes: 1 addition & 1 deletion packages/vest/src/testUtils/TVestMock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ import * as vest from 'vest';

export type TVestMock = typeof vest;

export type TTestSuiteCallback = (...args: any[]) => void;
export type TTestSuiteCallback = (..._args: any[]) => void;
export type TTestSuite = vest.Suite<TFieldName, TGroupName, TTestSuiteCallback>;
2 changes: 1 addition & 1 deletion packages/vest/src/testUtils/partition.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export default function partition<T>(
array: T[],
predicate: (value: T, _index: number, array: T[]) => boolean,
predicate: (_value: T, _index: number, _array: T[]) => boolean,
): [T[], T[]] {
return array.reduce(
(partitions: [T[], T[]], value, number) => {
Expand Down
2 changes: 1 addition & 1 deletion packages/vest/src/testUtils/testPromise.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export function TestPromise(cb: (done: () => void) => void): Promise<void> {
export function TestPromise(cb: (_done: () => void) => void): Promise<void> {
return new Promise<void>(done => cb(done));
}
2 changes: 1 addition & 1 deletion vx/commands/init/prompt/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ function updateValues(packagePath, config) {
});
}

function removeTemplateExtensionFromFile(packagePath, packageName) {
function removeTemplateExtensionFromFile(packagePath, _packageName) {
glob.sync(packagePath + '/**/*.tmpl').forEach(file => {
fsExtra.moveSync(file, file.replace('.tmpl', ''));
});
Expand Down
1 change: 0 additions & 1 deletion vx/commands/test/test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
const path = require('path');

const exec = require('vx/exec');
const opts = require('vx/opts');
const { usePackage } = require('vx/vxContext');
const vxPath = require('vx/vxPath');

Expand Down
4 changes: 2 additions & 2 deletions vx/eslint-plugin-vest-internal/lib/rules/use-use.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ module.exports = {
},
create(context) {
return {
[matcher(FUNC_DEC)](node) {
[matcher(FUNC_DEC)]() {
const parentFunction = findAncestor(context, FUNC_DEC);

if (parentFunction && !parentFunction.id.name.match(USE_MATCHER)) {
report(context, parentFunction, parentFunction.id);
}
},
[matcher(VAR_DEC)](node) {
[matcher(VAR_DEC)]() {
const parentFunction = findAncestor(context, 'ArrowFunctionExpression');

if (parentFunction) {
Expand Down
6 changes: 0 additions & 6 deletions vx/packageNames.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
const path = require('path');

const glob = require('glob');

const { sortDependencies } = require('./scripts/release/depsTree');

const packageJson = require('vx/util/packageJson');
const packageList = require('vx/util/packageList');
const { usePackage } = require('vx/vxContext');
const vxPath = require('vx/vxPath');

module.exports = Object.defineProperty(
{ paths: {}, list: [], names: {} },
Expand Down
2 changes: 0 additions & 2 deletions vx/scripts/genTsConfig.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
const path = require('path');

const { writeJSONSync } = require('fs-extra');
const lodash = require('lodash');

Expand Down
2 changes: 1 addition & 1 deletion vx/scripts/genVitestConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const logger = require('vx/logger');
const opts = require('vx/opts');
const packageNames = require('vx/packageNames');
const packageList = require('vx/util/packageList');
const { genPathsPerPackage, packages } = require('vx/util/pathsPerPackage');
const { genPathsPerPackage } = require('vx/util/pathsPerPackage');
const vxPath = require('vx/vxPath');

const VITEST_CONFIG_PATH = 'vx/config/vitest/customMatchers.ts';
Expand Down
1 change: 0 additions & 1 deletion vx/scripts/release/depsTree.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
const { glob } = require('glob');
const { memoize } = require('lodash');

const packageJson = require('vx/util/packageJson');
Expand Down
7 changes: 1 addition & 6 deletions vx/scripts/release/steps/publishPackage.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
const { TAG_NEXT, TAG_DEV } = require('../releaseKeywords');

const exec = require('vx/exec');
const logger = require('vx/logger');
const opts = require('vx/opts');
const joinTruthy = require('vx/util/joinTruthy');
const taggedBranch = require('vx/util/taggedBranch');
const { isReleaseBranch } = require('vx/util/taggedBranch');
const { usePackage } = require('vx/vxContext');
const vxPath = require('vx/vxPath');

function publishPackage({ tag, tagId, versionToPublish }) {
logger.info(`🚀 Publishing package ${usePackage()}.
Expand Down Expand Up @@ -56,6 +51,6 @@ function genPublishCommand(tag) {
return [`yarn workspace ${usePackage()} npm publish`, tag && `--tag ${tag}`];
}

function shouldRelease(versionToUse) {
function shouldRelease(_versionToUse) {
return taggedBranch.branchAllowsRelease;
}
8 changes: 1 addition & 7 deletions vx/scripts/release/steps/setNextVersion.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,7 @@ const packageJson = require('vx/util/packageJson');
const { usePackage } = require('vx/vxContext');
const vxPath = require('vx/vxPath');

function setNextVersion({
tagId,
tag,
nextVersion,
versionToPublish,
changeLevel,
}) {
function setNextVersion({ tagId, tag, versionToPublish, changeLevel }) {
const packageName = usePackage();
const existingPkgJson = packageJson(packageName);

Expand Down

0 comments on commit a11ac9b

Please sign in to comment.