diff --git a/eslint.config.mjs b/eslint.config.mjs index 5ada9b8..3e356db 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -1,26 +1,22 @@ -import tsPlugin from '@typescript-eslint/eslint-plugin' -import tsParser from '@typescript-eslint/parser' +import eslint from '@eslint/js' +import tseslint from 'typescript-eslint' -export default [{ - files: ['**/*.ts'] -}, { - plugins: { - '@typescript-eslint': tsPlugin - }, - languageOptions: { - parser: tsParser, - ecmaVersion: 2022, - sourceType: 'module' - }, - rules: { - '@typescript-eslint/naming-convention': ['warn', { - selector: 'import', - format: ['camelCase', 'PascalCase'] - }], - 'curly': 'warn', - 'eqeqeq': 'warn', - 'no-throw-literal': 'warn', - 'semi': 'off', - 'quotes': ['error', 'single'] +export default tseslint.config( + eslint.configs.recommended, + tseslint.configs.strict, + tseslint.configs.stylistic, + { + rules: { + 'curly': 'error', + 'eol-last': ['error', 'always'], + 'eqeqeq': 'error', + 'no-throw-literal': 'error', + 'quotes': ['error', 'single'], + 'semi': ["error", "never"], + '@typescript-eslint/naming-convention': ['warn', { + selector: 'import', + format: ['camelCase', 'PascalCase'] + }] + } } -}] +) diff --git a/package-lock.json b/package-lock.json index 719a326..ea65903 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,14 +12,14 @@ "simple-git": "^3.27.0" }, "devDependencies": { + "@eslint/js": "^9.17.0", "@types/node": "20.x", "@types/vscode": "^1.96.0", - "@typescript-eslint/eslint-plugin": "^8.17.0", - "@typescript-eslint/parser": "^8.17.0", - "eslint": "^9.16.0", + "eslint": "^9.17.0", "jest": "^29.7.0", "ts-jest": "^29.2.5", - "typescript": "^5.7.2" + "typescript": "^5.7.2", + "typescript-eslint": "^8.19.0" }, "engines": { "vscode": "^1.96.0" @@ -1524,17 +1524,17 @@ "license": "MIT" }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "8.18.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.18.2.tgz", - "integrity": "sha512-adig4SzPLjeQ0Tm+jvsozSGiCliI2ajeURDGHjZ2llnA+A67HihCQ+a3amtPhUakd1GlwHxSRvzOZktbEvhPPg==", + "version": "8.19.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.19.0.tgz", + "integrity": "sha512-NggSaEZCdSrFddbctrVjkVZvFC6KGfKfNK0CU7mNK/iKHGKbzT4Wmgm08dKpcZECBu9f5FypndoMyRHkdqfT1Q==", "dev": true, "license": "MIT", "dependencies": { "@eslint-community/regexpp": "^4.10.0", - "@typescript-eslint/scope-manager": "8.18.2", - "@typescript-eslint/type-utils": "8.18.2", - "@typescript-eslint/utils": "8.18.2", - "@typescript-eslint/visitor-keys": "8.18.2", + "@typescript-eslint/scope-manager": "8.19.0", + "@typescript-eslint/type-utils": "8.19.0", + "@typescript-eslint/utils": "8.19.0", + "@typescript-eslint/visitor-keys": "8.19.0", "graphemer": "^1.4.0", "ignore": "^5.3.1", "natural-compare": "^1.4.0", @@ -1554,16 +1554,16 @@ } }, "node_modules/@typescript-eslint/parser": { - "version": "8.18.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.18.2.tgz", - "integrity": "sha512-y7tcq4StgxQD4mDr9+Jb26dZ+HTZ/SkfqpXSiqeUXZHxOUyjWDKsmwKhJ0/tApR08DgOhrFAoAhyB80/p3ViuA==", + "version": "8.19.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.19.0.tgz", + "integrity": "sha512-6M8taKyOETY1TKHp0x8ndycipTVgmp4xtg5QpEZzXxDhNvvHOJi5rLRkLr8SK3jTgD5l4fTlvBiRdfsuWydxBw==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/scope-manager": "8.18.2", - "@typescript-eslint/types": "8.18.2", - "@typescript-eslint/typescript-estree": "8.18.2", - "@typescript-eslint/visitor-keys": "8.18.2", + "@typescript-eslint/scope-manager": "8.19.0", + "@typescript-eslint/types": "8.19.0", + "@typescript-eslint/typescript-estree": "8.19.0", + "@typescript-eslint/visitor-keys": "8.19.0", "debug": "^4.3.4" }, "engines": { @@ -1579,14 +1579,14 @@ } }, "node_modules/@typescript-eslint/scope-manager": { - "version": "8.18.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.18.2.tgz", - "integrity": "sha512-YJFSfbd0CJjy14r/EvWapYgV4R5CHzptssoag2M7y3Ra7XNta6GPAJPPP5KGB9j14viYXyrzRO5GkX7CRfo8/g==", + "version": "8.19.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.19.0.tgz", + "integrity": "sha512-hkoJiKQS3GQ13TSMEiuNmSCvhz7ujyqD1x3ShbaETATHrck+9RaDdUbt+osXaUuns9OFwrDTTrjtwsU8gJyyRA==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/types": "8.18.2", - "@typescript-eslint/visitor-keys": "8.18.2" + "@typescript-eslint/types": "8.19.0", + "@typescript-eslint/visitor-keys": "8.19.0" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -1597,14 +1597,14 @@ } }, "node_modules/@typescript-eslint/type-utils": { - "version": "8.18.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.18.2.tgz", - "integrity": "sha512-AB/Wr1Lz31bzHfGm/jgbFR0VB0SML/hd2P1yxzKDM48YmP7vbyJNHRExUE/wZsQj2wUCvbWH8poNHFuxLqCTnA==", + "version": "8.19.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.19.0.tgz", + "integrity": "sha512-TZs0I0OSbd5Aza4qAMpp1cdCYVnER94IziudE3JU328YUHgWu9gwiwhag+fuLeJ2LkWLXI+F/182TbG+JaBdTg==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/typescript-estree": "8.18.2", - "@typescript-eslint/utils": "8.18.2", + "@typescript-eslint/typescript-estree": "8.19.0", + "@typescript-eslint/utils": "8.19.0", "debug": "^4.3.4", "ts-api-utils": "^1.3.0" }, @@ -1621,9 +1621,9 @@ } }, "node_modules/@typescript-eslint/types": { - "version": "8.18.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.18.2.tgz", - "integrity": "sha512-Z/zblEPp8cIvmEn6+tPDIHUbRu/0z5lqZ+NvolL5SvXWT5rQy7+Nch83M0++XzO0XrWRFWECgOAyE8bsJTl1GQ==", + "version": "8.19.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.19.0.tgz", + "integrity": "sha512-8XQ4Ss7G9WX8oaYvD4OOLCjIQYgRQxO+qCiR2V2s2GxI9AUpo7riNwo6jDhKtTcaJjT8PY54j2Yb33kWtSJsmA==", "dev": true, "license": "MIT", "engines": { @@ -1635,14 +1635,14 @@ } }, "node_modules/@typescript-eslint/typescript-estree": { - "version": "8.18.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.18.2.tgz", - "integrity": "sha512-WXAVt595HjpmlfH4crSdM/1bcsqh+1weFRWIa9XMTx/XHZ9TCKMcr725tLYqWOgzKdeDrqVHxFotrvWcEsk2Tg==", + "version": "8.19.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.19.0.tgz", + "integrity": "sha512-WW9PpDaLIFW9LCbucMSdYUuGeFUz1OkWYS/5fwZwTA+l2RwlWFdJvReQqMUMBw4yJWJOfqd7An9uwut2Oj8sLw==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/types": "8.18.2", - "@typescript-eslint/visitor-keys": "8.18.2", + "@typescript-eslint/types": "8.19.0", + "@typescript-eslint/visitor-keys": "8.19.0", "debug": "^4.3.4", "fast-glob": "^3.3.2", "is-glob": "^4.0.3", @@ -1662,16 +1662,16 @@ } }, "node_modules/@typescript-eslint/utils": { - "version": "8.18.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.18.2.tgz", - "integrity": "sha512-Cr4A0H7DtVIPkauj4sTSXVl+VBWewE9/o40KcF3TV9aqDEOWoXF3/+oRXNby3DYzZeCATvbdksYsGZzplwnK/Q==", + "version": "8.19.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.19.0.tgz", + "integrity": "sha512-PTBG+0oEMPH9jCZlfg07LCB2nYI0I317yyvXGfxnvGvw4SHIOuRnQ3kadyyXY6tGdChusIHIbM5zfIbp4M6tCg==", "dev": true, "license": "MIT", "dependencies": { "@eslint-community/eslint-utils": "^4.4.0", - "@typescript-eslint/scope-manager": "8.18.2", - "@typescript-eslint/types": "8.18.2", - "@typescript-eslint/typescript-estree": "8.18.2" + "@typescript-eslint/scope-manager": "8.19.0", + "@typescript-eslint/types": "8.19.0", + "@typescript-eslint/typescript-estree": "8.19.0" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -1686,13 +1686,13 @@ } }, "node_modules/@typescript-eslint/visitor-keys": { - "version": "8.18.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.18.2.tgz", - "integrity": "sha512-zORcwn4C3trOWiCqFQP1x6G3xTRyZ1LYydnj51cRnJ6hxBlr/cKPckk+PKPUw/fXmvfKTcw7bwY3w9izgx5jZw==", + "version": "8.19.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.19.0.tgz", + "integrity": "sha512-mCFtBbFBJDCNCWUl5y6sZSCHXw1DEFEk3c/M3nRK2a4XUB8StGFtmcEMizdjKuBzB6e/smJAAWYug3VrdLMr1w==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/types": "8.18.2", + "@typescript-eslint/types": "8.19.0", "eslint-visitor-keys": "^4.2.0" }, "engines": { @@ -5116,6 +5116,29 @@ "node": ">=14.17" } }, + "node_modules/typescript-eslint": { + "version": "8.19.0", + "resolved": "https://registry.npmjs.org/typescript-eslint/-/typescript-eslint-8.19.0.tgz", + "integrity": "sha512-Ni8sUkVWYK4KAcTtPjQ/UTiRk6jcsuDhPpxULapUDi8A/l8TSBk+t1GtJA1RsCzIJg0q6+J7bf35AwQigENWRQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/eslint-plugin": "8.19.0", + "@typescript-eslint/parser": "8.19.0", + "@typescript-eslint/utils": "8.19.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0", + "typescript": ">=4.8.4 <5.8.0" + } + }, "node_modules/undici-types": { "version": "6.19.8", "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.19.8.tgz", diff --git a/package.json b/package.json index e0ad1c1..e6771db 100644 --- a/package.json +++ b/package.json @@ -46,14 +46,14 @@ "simple-git": "^3.27.0" }, "devDependencies": { + "@eslint/js": "^9.17.0", "@types/node": "20.x", "@types/vscode": "^1.96.0", - "@typescript-eslint/eslint-plugin": "^8.17.0", - "@typescript-eslint/parser": "^8.17.0", - "eslint": "^9.16.0", + "eslint": "^9.17.0", "jest": "^29.7.0", "ts-jest": "^29.2.5", - "typescript": "^5.7.2" + "typescript": "^5.7.2", + "typescript-eslint": "^8.19.0" }, "repository": { "type": "git", diff --git a/src/GitFacade.ts b/src/GitFacade.ts index 4295578..cee36fc 100644 --- a/src/GitFacade.ts +++ b/src/GitFacade.ts @@ -16,7 +16,7 @@ export class GitFacade { } async hasStagedFiles(): Promise { - const diff = await this.git.diff(['--name-only', '--cached']); + const diff = await this.git.diff(['--name-only', '--cached']) return (diff.trim() !== '') } @@ -51,7 +51,7 @@ export class GitFacade { async getCommitsNotInUpstream(): Promise { try { return (await this.queryCommits('@{u}..')) - } catch (e: any) { + } catch (e) { if (e.message?.includes('no upstream configured')) { return NO_UPSTREAM } @@ -85,7 +85,7 @@ export class GitFacade { GIT_SEQUENCE_EDITOR: 'true' // bypass the interactive editor }).rebase(['--autosquash', '--autostash', '-i', `${hash}~`]) return false - } catch (e: any) { + } catch (e) { if (e.message?.includes('Merge conflict')) { return true } diff --git a/src/extension.ts b/src/extension.ts index dd6c789..4b05fc0 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -70,7 +70,7 @@ export const activate = (context: vscode.ExtensionContext): void => { writeToOutputChannel(successMessage) vscode.window.showInformationMessage(successMessage) } - } catch (error: any) { + } catch (error) { vscode.window.showErrorMessage(error.message) } }) diff --git a/src/types.ts b/src/types.ts index 54cbc61..b9f5d2b 100644 --- a/src/types.ts +++ b/src/types.ts @@ -5,4 +5,4 @@ export type BranchName = string export interface Commit { hash: ShortCommitHash subject: string -} \ No newline at end of file +} diff --git a/test/GitFacade.test.ts b/test/GitFacade.test.ts index 763b75c..4236434 100644 --- a/test/GitFacade.test.ts +++ b/test/GitFacade.test.ts @@ -75,4 +75,4 @@ describe('GitFacade', () => { await git.commit('-') expect(await facade.hasStagedFiles()).toBe(false) }) -}) \ No newline at end of file +}) diff --git a/tsconfig.json b/tsconfig.json index e9ada4a..01bccb0 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -11,7 +11,8 @@ "strict": true, "noImplicitReturns": true, "noFallthroughCasesInSwitch": true, - "noUnusedParameters": true + "noUnusedParameters": true, + "useUnknownInCatchVariables": false }, "exclude": ["test/*"] }