Skip to content

Commit

Permalink
chore: Upgrade to eslint 9
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason3S committed May 3, 2024
1 parent d94243a commit b7fd10c
Show file tree
Hide file tree
Showing 24 changed files with 263 additions and 78 deletions.
38 changes: 0 additions & 38 deletions .eslintrc.cjs

This file was deleted.

2 changes: 1 addition & 1 deletion action-src/build.mjs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/usr/bin/env node

import * as esbuild from 'esbuild';
import { fileURLToPath } from 'url';
import { promises as fs } from 'fs';
import path from 'path';
import { fileURLToPath } from 'url';

const targetPackageDir = '../action';

Expand Down
3 changes: 2 additions & 1 deletion action-src/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@
"vscode-uri": "^3.0.8"
},
"files": [
"lib"
"lib",
"build.mjs"
],
"engines": {
"node": ">=20"
Expand Down
3 changes: 2 additions & 1 deletion action-src/src/ActionParams.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { describe, expect, test, vi } from 'vitest';
import { ActionParamsInput, __testing__, applyDefaults, validateActionParams } from './ActionParams.js';

import { __testing__, ActionParamsInput, applyDefaults, validateActionParams } from './ActionParams.js';

describe('ActionParams', () => {
test.each`
Expand Down
1 change: 1 addition & 0 deletions action-src/src/ActionParams.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { existsSync } from 'fs';

import { AppError } from './error.js';

/**
Expand Down
7 changes: 4 additions & 3 deletions action-src/src/action.test.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import * as process from 'process';
import * as path from 'path';
import { Context } from '@actions/github/lib/context.js';
import * as path from 'path';
import * as process from 'process';
import { beforeEach, describe, expect, test, vi } from 'vitest';

import { action } from './action.js';
import { AppError } from './error.js';
import { fetchGithubActionFixture, root, sourceDir } from './test/helper.js';
import { beforeEach, describe, expect, test, vi } from 'vitest';

const configFile = path.resolve(root, 'cspell.json');

Expand Down
4 changes: 3 additions & 1 deletion action-src/src/action.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import path from 'node:path';

import { debug, error, info, setFailed, setOutput, warning } from '@actions/core';
import type { Context as GitHubContext } from '@actions/github/lib/context.js';
import type { RunResult } from 'cspell';
import path from 'node:path';

import { validateActionParams } from './ActionParams.js';
import { checkDotMap } from './checkDotMap.js';
import { checkSpellingForContext, type Context } from './checkSpelling.js';
Expand Down
3 changes: 2 additions & 1 deletion action-src/src/checkSpelling.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { afterEach, beforeEach, describe, expect, test, vi } from 'vitest';
import { type Context, checkSpellingForContext, __testing__ } from './checkSpelling.js';

import { toActionParams } from './ActionParams.js';
import { __testing__,checkSpellingForContext, type Context } from './checkSpelling.js';

const { gatherFileGlobsFromContext } = __testing__;

Expand Down
6 changes: 4 additions & 2 deletions action-src/src/checkSpelling.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import path from 'node:path';

import { debug, error, info, warning } from '@actions/core';
import type { PullRequestEvent, PushEvent } from '@octokit/webhooks-types';
import type { RunResult } from 'cspell';
import path from 'node:path';

import { ActionParams } from './ActionParams.js';
import { checkDotMap } from './checkDotMap.js';
import { toError } from './error.js';
import { gitListFiles, gitListFilesForPullRequest, gitListFilesForPush, gitRoot } from './git.js';
import { CSpellReporterForGithubAction } from './reporter.js';
import { LintOptions, lint } from './spell.js';
import { lint,LintOptions } from './spell.js';

const core = { debug, error, info, warning };

Expand Down
1 change: 1 addition & 0 deletions action-src/src/error.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { describe, expect, test } from 'vitest';

import { AppError, isAppError, isError, toError } from './error.js';

describe('error', () => {
Expand Down
1 change: 1 addition & 0 deletions action-src/src/getActionParams.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { getInput } from '@actions/core';

import { ActionParamsInput, applyDefaults, TrueFalse } from './ActionParams.js';

export function getActionParams(): ActionParamsInput {
Expand Down
5 changes: 3 additions & 2 deletions action-src/src/git.test.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
import { promises as fs } from 'node:fs';

import { describe, expect, test } from 'vitest';

import {
Context,
GitError,
gitDeepen,
GitError,
gitListCommits,
gitListFiles,
gitListFilesForContext,
gitListFilesForPullRequest,
gitListFilesForPush,
gitRoot,
} from './git.js';

import { root } from './test/helper.js';

const urlFixtures = new URL('../fixtures/', import.meta.url);
Expand Down
4 changes: 2 additions & 2 deletions action-src/src/git.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { promisify } from 'node:util';
import { exec } from 'node:child_process';
import { promisify } from 'node:util';

import type { PushEvent, PullRequestEvent } from '@octokit/webhooks-types';
import type { PullRequestEvent,PushEvent } from '@octokit/webhooks-types';

const execP = promisify(exec);

Expand Down
5 changes: 3 additions & 2 deletions action-src/src/main.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import * as process from 'process';
import * as helper from './test/helper.js';
import { run } from './main.js';
import { afterEach, beforeEach, describe, expect, test, vi } from 'vitest';

import { AppError } from './error.js';
import { run } from './main.js';
import * as helper from './test/helper.js';

const timeout = 20000;

Expand Down
3 changes: 2 additions & 1 deletion action-src/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { info, setFailed } from '@actions/core';
import { Context } from '@actions/github/lib/context.js';
import { toError } from './error.js';

import { action } from './action.js';
import { toError } from './error.js';

export async function run(): Promise<undefined | Error> {
try {
Expand Down
3 changes: 2 additions & 1 deletion action-src/src/main_root.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { describe, test, expect, vi } from 'vitest';
import { describe, expect, test, vi } from 'vitest';

import { run } from './main.js';

vi.mock('./main');
Expand Down
6 changes: 3 additions & 3 deletions action-src/src/reporter.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { debug, info, warning, error } from '@actions/core';
import { debug, error,info, warning } from '@actions/core';
import { issueCommand } from '@actions/core/lib/command.js';
import type {
CSpellReporter,
Issue,
MessageType,
ProgressFileComplete,
ProgressItem,
RunResult,
ProgressFileComplete,
} from '@cspell/cspell-types';
import { URI } from 'vscode-uri';
import * as path from 'path';
import { URI } from 'vscode-uri';

const core = { debug, info, warning, error };

Expand Down
2 changes: 2 additions & 0 deletions action-src/src/spell.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import path from 'node:path';

import { describe, expect, test, vi } from 'vitest';

import { CSpellReporterForGithubAction, Logger } from './reporter.js';
import * as spell from './spell.js';
import { resolveFile, resolveFiles, root, sourceDir } from './test/helper.js';
Expand Down
2 changes: 1 addition & 1 deletion action-src/src/spell.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { type CSpellApplicationOptions, lint as cspellAppLint } from 'cspell';
import type { CSpellReporter } from 'cspell';
import { type CSpellApplicationOptions, lint as cspellAppLint } from 'cspell';

export interface LintOptions {
root: string;
Expand Down
2 changes: 1 addition & 1 deletion action-src/src/test/helper.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as path from 'path';
import * as fs from 'fs';
import * as path from 'path';
import { fileURLToPath } from 'url';

const __dirname = fileURLToPath(new URL('.', import.meta.url));
Expand Down
18 changes: 10 additions & 8 deletions action/lib/main_root.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -42726,6 +42726,13 @@ var require_file_entry_cache = __commonJS({
var import_core5 = __toESM(require_core(), 1);
var import_context = __toESM(require_context(), 1);

// src/action.ts
var import_node_path6 = __toESM(require("node:path"), 1);
var import_core4 = __toESM(require_core(), 1);

// src/ActionParams.ts
var import_fs = require("fs");

// src/error.ts
var AppError = class extends Error {
constructor(message) {
Expand All @@ -42742,12 +42749,7 @@ function toError(e) {
return err;
}

// src/action.ts
var import_core4 = __toESM(require_core(), 1);
var import_node_path6 = __toESM(require("node:path"), 1);

// src/ActionParams.ts
var import_fs = require("fs");
var defaultActionParams = {
files: "",
incremental_files_only: "true",
Expand Down Expand Up @@ -42812,12 +42814,12 @@ var checkDotMap = {
};

// src/checkSpelling.ts
var import_core2 = __toESM(require_core(), 1);
var import_node_path5 = __toESM(require("node:path"), 1);
var import_core2 = __toESM(require_core(), 1);

// src/git.ts
var import_node_util = require("node:util");
var import_node_child_process = require("node:child_process");
var import_node_util = require("node:util");
var execP = (0, import_node_util.promisify)(import_node_child_process.exec);
async function gitListCommits(count3 = 100, _since) {
const args = ["rev-list", "HEAD", `-${count3}`];
Expand Down Expand Up @@ -42892,6 +42894,7 @@ async function runGit(args) {
// src/reporter.ts
var import_core = __toESM(require_core(), 1);
var import_command = __toESM(require_command(), 1);
var path = __toESM(require("path"), 1);

// ../node_modules/.pnpm/vscode-uri@3.0.8/node_modules/vscode-uri/lib/esm/index.mjs
var LIB;
Expand Down Expand Up @@ -43272,7 +43275,6 @@ var LIB;
var { URI, Utils } = LIB;

// src/reporter.ts
var path = __toESM(require("path"), 1);
var core = { debug: import_core.debug, info: import_core.info, warning: import_core.warning, error: import_core.error };
function nullEmitter(_msg) {
}
Expand Down

0 comments on commit b7fd10c

Please sign in to comment.