Merge pull request #230 from oke-py/feature/eslint9-migration

chore: migrate to ESLint 9 and update configurations
This commit is contained in:
Naoki Oketani
2025-05-03 21:07:35 +09:00
committed by GitHub
7 changed files with 4809 additions and 2970 deletions

View File

@@ -1,3 +0,0 @@
dist/
lib/
node_modules/

View File

@@ -1,107 +0,0 @@
{
"plugins": [
"@typescript-eslint"
],
"extends": [
"plugin:github/typescript"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 9,
"sourceType": "module",
"project": "./tsconfig.json"
},
"rules": {
"eslint-comments/no-use": "off",
"import/no-namespace": "off",
"no-unused-vars": "off",
"@typescript-eslint/explicit-member-accessibility": "off",
"@typescript-eslint/no-require-imports": "error",
"@typescript-eslint/array-type": "off",
"@typescript-eslint/await-thenable": "error",
"@typescript-eslint/ban-ts-comment": "error",
"camelcase": "off",
"@typescript-eslint/explicit-function-return-type": [
"error",
{
"allowExpressions": true
}
],
"@typescript-eslint/func-call-spacing": [
"error",
"never"
],
"@typescript-eslint/naming-convention": [
"error",
{
"selector": "default",
"format": [
"camelCase"
]
},
{
"selector": "class",
"format": [
"PascalCase"
]
},
{
"selector": "interface",
"format": [
"PascalCase"
]
},
{
"selector": "typeAlias",
"format": [
"PascalCase"
]
},
{
"selector": "property",
"format": null
},
{
"selector": "variable",
"format": [
"camelCase",
"UPPER_CASE"
],
"leadingUnderscore": "allow",
"trailingUnderscore": "allow"
}
],
"@typescript-eslint/no-array-constructor": "error",
"@typescript-eslint/no-empty-interface": "error",
"@typescript-eslint/no-explicit-any": "error",
"@typescript-eslint/no-extraneous-class": "error",
"@typescript-eslint/no-for-in-array": "error",
"@typescript-eslint/no-inferrable-types": "error",
"@typescript-eslint/no-misused-new": "error",
"@typescript-eslint/no-namespace": "error",
"@typescript-eslint/no-non-null-assertion": "warn",
"@typescript-eslint/no-unnecessary-qualifier": "error",
"@typescript-eslint/no-unnecessary-type-assertion": "error",
"@typescript-eslint/no-unused-vars": "off",
"@typescript-eslint/no-useless-constructor": "error",
"@typescript-eslint/no-var-requires": "error",
"@typescript-eslint/prefer-for-of": "warn",
"@typescript-eslint/prefer-function-type": "warn",
"@typescript-eslint/prefer-includes": "error",
"@typescript-eslint/prefer-string-starts-ends-with": "error",
"@typescript-eslint/promise-function-async": "error",
"@typescript-eslint/require-array-sort-compare": "error",
"@typescript-eslint/restrict-plus-operands": "error",
"semi": "off",
"@typescript-eslint/semi": [
"error",
"never"
],
"@typescript-eslint/type-annotation-spacing": "error",
"@typescript-eslint/unbound-method": "error"
},
"env": {
"node": true,
"es6": true
}
}

26
eslint.config.js Normal file
View File

@@ -0,0 +1,26 @@
import github from "eslint-plugin-github";
export default [
github.getFlatConfigs().recommended,
...github.getFlatConfigs().typescript,
{
files: ["**/*.{js,mjs,cjs,jsx,mjsx,ts,tsx,mtsx}"],
ignores: ["eslint.config.mjs"],
rules: {
"github/array-foreach": "error",
"github/async-preventdefault": "warn",
"github/no-then": "error",
"github/no-blur": "error",
'i18n-text/no-en': 'off',
'import/no-unresolved': 'off',
'import/no-namespace': 'off',
},
settings: {
'import/resolver': {
typescript: {
project: './tsconfig.json',
},
},
},
},
];

7621
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -38,12 +38,14 @@
},
"devDependencies": {
"@types/node": "^20.0.0",
"@typescript-eslint/eslint-plugin": "^6.21.0",
"@typescript-eslint/parser": "^6.21.0",
"@typescript-eslint/eslint-plugin": "^8.31.1",
"@typescript-eslint/parser": "^8.31.1",
"@vercel/ncc": "^0.38.3",
"@vitest/coverage-v8": "^3.1.2",
"eslint": "^8.57.1",
"eslint-plugin-github": "^4.10.2",
"eslint": "^9.26.0",
"eslint-define-config": "^2.1.0",
"eslint-import-resolver-typescript": "^4.3.4",
"eslint-plugin-github": "^6.0.0",
"js-yaml": "^4.0.0",
"prettier": "^3.5.3",
"typescript": "^5.8.3",

View File

@@ -2,8 +2,8 @@ import * as core from '@actions/core'
import {IssueOption} from './interface.js'
export function getIssueOption(body: string): IssueOption {
let assignees
let labels
let assignees: string[] | undefined
let labels: string[] | undefined
if (core.getInput('issue_assignees')) {
assignees = core.getInput('issue_assignees').replace(/\s+/g, '').split(',')
@@ -29,7 +29,7 @@ export type GetIssuesFunc = (options: {
state: 'open' | 'closed' | 'all' | undefined
// eslint-disable-next-line @typescript-eslint/no-explicit-any
[key: string]: any // Allow additional properties
}) => Promise<{data: {title: string; number: number}[]}>
}) => Promise<{data: Array<{title: string; number: number}>}>
export async function getExistingIssueNumber(
getIssues: GetIssuesFunc,

View File

@@ -6,7 +6,11 @@
"rootDir": "./src", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
"strict": true, /* Enable all strict type-checking options. */
"noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
"esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
"baseUrl": "./",
"paths": {
"*": ["src/*"]
}
},
"exclude": [
"node_modules",