diff --git a/eslint.config.js b/eslint.config.js index 7090f7a6300..73465fb2464 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -1,4 +1,5 @@ import eslint from '@eslint/js'; +import erasableSyntaxOnly from 'eslint-plugin-erasable-syntax-only'; import tseslint from 'typescript-eslint'; export default tseslint.config( @@ -6,6 +7,7 @@ export default tseslint.config( ignores: ['dist/', 'docs/', 'node_modules/', 'src/gen/'], }, eslint.configs.recommended, + erasableSyntaxOnly.configs.recommended, tseslint.configs.strict, { languageOptions: { diff --git a/package-lock.json b/package-lock.json index 2f2f01ac744..f7ae14aa9df 100644 --- a/package-lock.json +++ b/package-lock.json @@ -35,6 +35,7 @@ "@types/mock-fs": "^4.13.1", "c8": "^10.0.0", "eslint": "^9.18.0", + "eslint-plugin-erasable-syntax-only": "^0.3.0", "husky": "^9.0.6", "mocha": "^11.0.1", "mock-fs": "^5.2.0", @@ -1403,6 +1404,16 @@ } } }, + "node_modules/cached-factory": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/cached-factory/-/cached-factory-0.1.0.tgz", + "integrity": "sha512-IGOSWu+NuED5UzCRmBeqQPZ8z7SkgrD/nN67W2iY1Qv83CVhevyMexkGclJ86saXisIqxoOnbeiTWvsCHRqJBw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + } + }, "node_modules/call-bind-apply-helpers": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz", @@ -1813,6 +1824,25 @@ } } }, + "node_modules/eslint-plugin-erasable-syntax-only": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-erasable-syntax-only/-/eslint-plugin-erasable-syntax-only-0.3.0.tgz", + "integrity": "sha512-bKtSWTIPGT89AEgQc67/i01DtIdEfiS3iYsqdbSSEECIQwOYs1xEi19jPQ5ZncDp1gzIRf8gWUpJE65a3XYt0A==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/utils": "^8.24.0", + "cached-factory": "^0.1.0" + }, + "engines": { + "node": ">=20.18.0" + }, + "peerDependencies": { + "@typescript-eslint/parser": ">=8", + "eslint": ">=9", + "typescript": ">=5" + } + }, "node_modules/eslint-scope": { "version": "8.2.0", "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-8.2.0.tgz", @@ -5004,6 +5034,12 @@ "yargs-parser": "^21.1.1" } }, + "cached-factory": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/cached-factory/-/cached-factory-0.1.0.tgz", + "integrity": "sha512-IGOSWu+NuED5UzCRmBeqQPZ8z7SkgrD/nN67W2iY1Qv83CVhevyMexkGclJ86saXisIqxoOnbeiTWvsCHRqJBw==", + "dev": true + }, "call-bind-apply-helpers": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz", @@ -5303,6 +5339,16 @@ } } }, + "eslint-plugin-erasable-syntax-only": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-erasable-syntax-only/-/eslint-plugin-erasable-syntax-only-0.3.0.tgz", + "integrity": "sha512-bKtSWTIPGT89AEgQc67/i01DtIdEfiS3iYsqdbSSEECIQwOYs1xEi19jPQ5ZncDp1gzIRf8gWUpJE65a3XYt0A==", + "dev": true, + "requires": { + "@typescript-eslint/utils": "^8.24.0", + "cached-factory": "^0.1.0" + } + }, "eslint-scope": { "version": "8.2.0", "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-8.2.0.tgz", diff --git a/package.json b/package.json index 89982480020..4dbc638e755 100644 --- a/package.json +++ b/package.json @@ -80,6 +80,7 @@ "@types/mock-fs": "^4.13.1", "c8": "^10.0.0", "eslint": "^9.18.0", + "eslint-plugin-erasable-syntax-only": "^0.3.0", "husky": "^9.0.6", "mocha": "^11.0.1", "mock-fs": "^5.2.0", diff --git a/src/object_test.ts b/src/object_test.ts index 1da88931dbf..31114501cac 100644 --- a/src/object_test.ts +++ b/src/object_test.ts @@ -36,8 +36,10 @@ describe('KubernetesObject', () => { }); class KubernetesObjectApiTest extends KubernetesObjectApi { - constructor(public configuration: Configuration) { + public configuration: Configuration; + public constructor(configuration: Configuration) { super(configuration); + this.configuration = configuration; } public static makeApiClient(kc?: KubeConfig): KubernetesObjectApiTest { diff --git a/src/test/match-buffer.ts b/src/test/match-buffer.ts index 5bb3a2c387d..636b52beea9 100644 --- a/src/test/match-buffer.ts +++ b/src/test/match-buffer.ts @@ -7,11 +7,12 @@ export function matchBuffer(channel: number, contents: string): StringBufferMatc } class StringBufferMatcher extends Matcher { - constructor( - private channel: number, - private contents: string, - ) { + private channel: number; + private contents: string; + constructor(channel: number, contents: string) { super(); + this.channel = channel; + this.contents = contents; } public valueOf(): string {