fix: resolve prettier and eslint conflict by removing bracketSpacing: false

This commit is contained in:
Naoki Oketani
2025-05-03 12:32:25 +00:00
parent 93b005545f
commit fa975d057b
8 changed files with 44 additions and 36 deletions

View File

@@ -1,11 +1,10 @@
{ {
"printWidth": 80, "printWidth": 80,
"tabWidth": 2, "tabWidth": 2,
"useTabs": false, "useTabs": false,
"semi": false, "semi": false,
"singleQuote": true, "singleQuote": true,
"trailingComma": "none", "trailingComma": "none",
"bracketSpacing": false, "arrowParens": "avoid",
"arrowParens": "avoid", "parser": "typescript"
"parser": "typescript" }
}

View File

@@ -1,9 +1,9 @@
import * as child_process from 'child_process' import * as child_process from 'child_process'
import * as fs from 'fs' import * as fs from 'fs'
import * as path from 'path' import * as path from 'path'
import {Audit} from '../src/audit' import { Audit } from '../src/audit'
import {fileURLToPath} from 'url' import { fileURLToPath } from 'url'
import {dirname} from 'path' import { dirname } from 'path'
const __filename = fileURLToPath(import.meta.url) const __filename = fileURLToPath(import.meta.url)
const __dirname = dirname(__filename) const __dirname = dirname(__filename)

View File

@@ -1,5 +1,5 @@
import * as issue from '../src/issue' import * as issue from '../src/issue'
import {IssueOption} from '../src/interface' import { IssueOption } from '../src/interface'
describe('getIssueOption', () => { describe('getIssueOption', () => {
test('without assignee and label', () => { test('without assignee and label', () => {
@@ -77,7 +77,10 @@ describe('getExistingIssueNumber', () => {
} }
] ]
}) })
const result = await issue.getExistingIssueNumber(getIssues, {repo, owner}) const result = await issue.getExistingIssueNumber(getIssues, {
repo,
owner
})
expect(getIssues).toHaveBeenCalledWith({ expect(getIssues).toHaveBeenCalledWith({
repo, repo,
@@ -90,9 +93,12 @@ describe('getExistingIssueNumber', () => {
test('returns null when there is no open issue', async () => { test('returns null when there is no open issue', async () => {
const getIssues = vi.fn() const getIssues = vi.fn()
getIssues.mockResolvedValue({data: []}) getIssues.mockResolvedValue({ data: [] })
const result = await issue.getExistingIssueNumber(getIssues, {repo, owner}) const result = await issue.getExistingIssueNumber(getIssues, {
repo,
owner
})
expect(getIssues).toHaveBeenCalledWith({ expect(getIssues).toHaveBeenCalledWith({
repo, repo,
@@ -114,7 +120,10 @@ describe('getExistingIssueNumber', () => {
] ]
}) })
const result = await issue.getExistingIssueNumber(getIssues, {repo, owner}) const result = await issue.getExistingIssueNumber(getIssues, {
repo,
owner
})
expect(getIssues).toHaveBeenCalledWith({ expect(getIssues).toHaveBeenCalledWith({
repo, repo,

View File

@@ -1,11 +1,11 @@
import * as fs from 'fs' import * as fs from 'fs'
import * as path from 'path' import * as path from 'path'
import {Audit} from '../src/audit' import { Audit } from '../src/audit'
import {run} from '../src/main' import { run } from '../src/main'
import * as issue from '../src/issue' import * as issue from '../src/issue'
import * as pr from '../src/pr' import * as pr from '../src/pr'
import {fileURLToPath} from 'url' import { fileURLToPath } from 'url'
import {dirname} from 'path' import { dirname } from 'path'
const __filename = fileURLToPath(import.meta.url) const __filename = fileURLToPath(import.meta.url)
const __dirname = dirname(__filename) const __dirname = dirname(__filename)

View File

@@ -1,4 +1,4 @@
import {spawnSync, SpawnSyncReturns} from 'child_process' import { spawnSync, SpawnSyncReturns } from 'child_process'
import stripAnsi from 'strip-ansi' import stripAnsi from 'strip-ansi'
const SPAWN_PROCESS_BUFFER_SIZE = 10485760 // 10MiB const SPAWN_PROCESS_BUFFER_SIZE = 10485760 // 10MiB

View File

@@ -1,5 +1,5 @@
import * as core from '@actions/core' import * as core from '@actions/core'
import {IssueOption} from './interface.js' import { IssueOption } from './interface.js'
export function getIssueOption(body: string): IssueOption { export function getIssueOption(body: string): IssueOption {
let assignees: string[] | undefined let assignees: string[] | undefined
@@ -29,7 +29,7 @@ export type GetIssuesFunc = (options: {
state: 'open' | 'closed' | 'all' | undefined state: 'open' | 'closed' | 'all' | undefined
// eslint-disable-next-line @typescript-eslint/no-explicit-any // eslint-disable-next-line @typescript-eslint/no-explicit-any
[key: string]: any // Allow additional properties [key: string]: any // Allow additional properties
}) => Promise<{data: Array<{title: string; number: number}>}> }) => Promise<{ data: Array<{ title: string; number: number }> }>
export async function getExistingIssueNumber( export async function getExistingIssueNumber(
getIssues: GetIssuesFunc, getIssues: GetIssuesFunc,
@@ -38,7 +38,7 @@ export async function getExistingIssueNumber(
repo: string repo: string
} }
): Promise<number | null> { ): Promise<number | null> {
const {data: issues} = await getIssues({ const { data: issues } = await getIssues({
...repo, ...repo,
state: 'open' state: 'open'
}) })

View File

@@ -1,8 +1,8 @@
import * as core from '@actions/core' import * as core from '@actions/core'
import * as github from '@actions/github' import * as github from '@actions/github'
import {Octokit} from '@octokit/rest' import { Octokit } from '@octokit/rest'
import {Audit} from './audit.js' import { Audit } from './audit.js'
import {IssueOption} from './interface.js' import { IssueOption } from './interface.js'
import * as issue from './issue.js' import * as issue from './issue.js'
import * as pr from './pr.js' import * as pr from './pr.js'
import * as workdir from './workdir.js' import * as workdir from './workdir.js'
@@ -20,7 +20,7 @@ export async function run(): Promise<void> {
core.info(`Current working directory: ${process.cwd()}`) core.info(`Current working directory: ${process.cwd()}`)
// get audit-level // get audit-level
const auditLevel = core.getInput('audit_level', {required: true}) const auditLevel = core.getInput('audit_level', { required: true })
if ( if (
!['critical', 'high', 'moderate', 'low', 'info', 'none'].includes( !['critical', 'high', 'moderate', 'low', 'info', 'none'].includes(
auditLevel auditLevel
@@ -29,12 +29,12 @@ export async function run(): Promise<void> {
throw new Error('Invalid input: audit_level') throw new Error('Invalid input: audit_level')
} }
const productionFlag = core.getInput('production_flag', {required: false}) const productionFlag = core.getInput('production_flag', { required: false })
if (!['true', 'false'].includes(productionFlag)) { if (!['true', 'false'].includes(productionFlag)) {
throw new Error('Invalid input: production_flag') throw new Error('Invalid input: production_flag')
} }
const jsonFlag = core.getInput('json_flag', {required: false}) const jsonFlag = core.getInput('json_flag', { required: false })
if (!['true', 'false'].includes(jsonFlag)) { if (!['true', 'false'].includes(jsonFlag)) {
throw new Error('Invalid input: json_flag') throw new Error('Invalid input: json_flag')
} }
@@ -50,7 +50,7 @@ export async function run(): Promise<void> {
// get GitHub information // get GitHub information
const ctx = JSON.parse(core.getInput('github_context')) const ctx = JSON.parse(core.getInput('github_context'))
const token: string = core.getInput('github_token', {required: true}) const token: string = core.getInput('github_token', { required: true })
const octokit = new Octokit({ const octokit = new Octokit({
auth: token auth: token
}) })
@@ -97,14 +97,14 @@ export async function run(): Promise<void> {
: null : null
if (existingIssueNumber !== null) { if (existingIssueNumber !== null) {
const {data: createdComment} = await octokit.issues.createComment({ const { data: createdComment } = await octokit.issues.createComment({
...github.context.repo, ...github.context.repo,
issue_number: existingIssueNumber, issue_number: existingIssueNumber,
body: option.body body: option.body
}) })
core.debug(`comment ${createdComment.url}`) core.debug(`comment ${createdComment.url}`)
} else { } else {
const {data: createdIssue} = await octokit.issues.create({ const { data: createdIssue } = await octokit.issues.create({
...github.context.repo, ...github.context.repo,
...option ...option
}) })

View File

@@ -1,4 +1,4 @@
import {Octokit} from '@octokit/rest' import { Octokit } from '@octokit/rest'
export async function createComment( export async function createComment(
octokit: Octokit, octokit: Octokit,