diff --git a/eslint.config.cjs b/eslint.config.cjs index 949e2f1..1bc90e5 100644 --- a/eslint.config.cjs +++ b/eslint.config.cjs @@ -18,7 +18,9 @@ const {defineConfig, globalIgnores} = require('eslint/config'); const {fixupConfigRules, fixupPluginRules} = require('@eslint/compat'); const typescriptEslint = require('@typescript-eslint/eslint-plugin'); +const eslintPluginImport = require('eslint-plugin-import'); const prettier = require('eslint-plugin-prettier'); +const vitest = require('@vitest/eslint-plugin'); const globals = require('globals'); const tsParser = require('@typescript-eslint/parser'); const js = require('@eslint/js'); @@ -32,27 +34,35 @@ const compat = new FlatCompat({ }); module.exports = defineConfig([ - globalIgnores(['.yarn/**/*', 'lib/**/*', 'coverage/**/*', 'node_modules/**/*']), + globalIgnores([ + // prettier-ignore + '.yarn/**/*', + 'coverage/**/*', + 'lib/**/*' + ]), { extends: fixupConfigRules( - compat.extends('eslint:recommended', 'plugin:@typescript-eslint/eslint-recommended', 'plugin:@typescript-eslint/recommended', 'plugin:import/errors', 'plugin:import/typescript', 'plugin:import/warnings', 'plugin:prettier/recommended') + compat.extends( + // prettier-ignore + 'eslint:recommended', + 'plugin:@typescript-eslint/eslint-recommended', + 'plugin:@typescript-eslint/recommended', + 'plugin:prettier/recommended' + ) ), - plugins: { '@typescript-eslint': fixupPluginRules(typescriptEslint), + import: fixupPluginRules(eslintPluginImport), prettier: fixupPluginRules(prettier) }, - languageOptions: { globals: { - ...globals.node, - ...globals.mocha + ...globals.node }, parser: tsParser, ecmaVersion: 2023, sourceType: 'module' }, - rules: { '@typescript-eslint/no-require-imports': [ 'error', @@ -65,7 +75,14 @@ module.exports = defineConfig([ { ignore: ['\\.js$', 'csv-parse/sync', '@octokit/openapi-types', '@octokit/core', '@octokit/plugin-rest-endpoint-methods', 'vitest/config'] } - ], + ] + } + }, + { + files: ['__tests__/**'], + ...vitest.configs.recommended, + rules: { + ...vitest.configs.recommended.rules, 'vitest/no-conditional-expect': 'error', 'vitest/no-disabled-tests': 0 } diff --git a/package.json b/package.json index fd7a86f..5b376b1 100644 --- a/package.json +++ b/package.json @@ -84,6 +84,7 @@ "@typescript-eslint/eslint-plugin": "^8.50.0", "@typescript-eslint/parser": "^8.50.0", "@vitest/coverage-v8": "^3.2.4", + "@vitest/eslint-plugin": "^1.6.9", "dotenv": "^17.2.3", "eslint": "^9.39.2", "eslint-config-prettier": "^10.1.8", diff --git a/tsconfig.json b/tsconfig.json index bca4392..0385754 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -17,9 +17,5 @@ }, "include": [ "src/**/*.ts" - ], - "exclude": [ - "./lib/**/*", - "node_modules" ] } diff --git a/tsconfig.test.json b/tsconfig.test.json index 37e63ac..1224ee1 100644 --- a/tsconfig.test.json +++ b/tsconfig.test.json @@ -7,10 +7,7 @@ }, "include": [ "src/**/*.ts", - "__tests__/**/*.ts" - ], - "exclude": [ - "lib", - "node_modules" + "__tests__/**/*.ts", + "__mocks__/**/*.ts" ] } diff --git a/vitest.config.itg.ts b/vitest.config.itg.ts index b32f3e0..8138e68 100644 --- a/vitest.config.itg.ts +++ b/vitest.config.itg.ts @@ -28,7 +28,7 @@ export default defineConfig({ provider: 'v8', reporter: ['clover'], include: ['src/**/*.ts'], - exclude: ['src/**/index.ts', 'lib/**', 'node_modules/**', '__mocks__/**', '__tests__/**'] + exclude: ['src/**/index.ts'] } } }); diff --git a/vitest.config.ts b/vitest.config.ts index bf3ea9e..f777b61 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -27,7 +27,7 @@ export default defineConfig({ provider: 'v8', reporter: ['clover'], include: ['src/**/*.ts'], - exclude: ['src/**/index.ts', 'lib/**', 'node_modules/**', '__mocks__/**', '__tests__/**'] + exclude: ['src/**/index.ts'] } } }); diff --git a/yarn.lock b/yarn.lock index 9a14a8e..a83cd7e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -415,6 +415,7 @@ __metadata: "@typescript-eslint/eslint-plugin": "npm:^8.50.0" "@typescript-eslint/parser": "npm:^8.50.0" "@vitest/coverage-v8": "npm:^3.2.4" + "@vitest/eslint-plugin": "npm:^1.6.9" async-retry: "npm:^1.3.3" csv-parse: "npm:^6.1.0" dotenv: "npm:^17.2.3" @@ -642,6 +643,17 @@ __metadata: languageName: node linkType: hard +"@eslint-community/eslint-utils@npm:^4.9.1": + version: 4.9.1 + resolution: "@eslint-community/eslint-utils@npm:4.9.1" + dependencies: + eslint-visitor-keys: "npm:^3.4.3" + peerDependencies: + eslint: ^6.0.0 || ^7.0.0 || >=8.0.0 + checksum: 10/863b5467868551c9ae34d03eefe634633d08f623fc7b19d860f8f26eb6f303c1a5934253124163bee96181e45ed22bf27473dccc295937c3078493a4a8c9eddd + languageName: node + linkType: hard + "@eslint-community/regexpp@npm:^4.10.0": version: 4.10.0 resolution: "@eslint-community/regexpp@npm:4.10.0" @@ -1585,6 +1597,19 @@ __metadata: languageName: node linkType: hard +"@typescript-eslint/project-service@npm:8.56.1": + version: 8.56.1 + resolution: "@typescript-eslint/project-service@npm:8.56.1" + dependencies: + "@typescript-eslint/tsconfig-utils": "npm:^8.56.1" + "@typescript-eslint/types": "npm:^8.56.1" + debug: "npm:^4.4.3" + peerDependencies: + typescript: ">=4.8.4 <6.0.0" + checksum: 10/5e7fdc95aebcefc72fec77806bb0821a9a59e5e88f86d72b15ad011eb6110da05419b803875f021716a219fc7fb8517331a6736364344c8613a90209539a6d32 + languageName: node + linkType: hard + "@typescript-eslint/scope-manager@npm:8.50.0": version: 8.50.0 resolution: "@typescript-eslint/scope-manager@npm:8.50.0" @@ -1595,6 +1620,16 @@ __metadata: languageName: node linkType: hard +"@typescript-eslint/scope-manager@npm:8.56.1, @typescript-eslint/scope-manager@npm:^8.55.0": + version: 8.56.1 + resolution: "@typescript-eslint/scope-manager@npm:8.56.1" + dependencies: + "@typescript-eslint/types": "npm:8.56.1" + "@typescript-eslint/visitor-keys": "npm:8.56.1" + checksum: 10/f358cf8bd32952eed005d4f34c1e95805baefe35abee96d866222b0eff8027cc02f831cee04b308707d74db2b415437a134191207b4213ee8acbc6d67a435616 + languageName: node + linkType: hard + "@typescript-eslint/tsconfig-utils@npm:8.50.0, @typescript-eslint/tsconfig-utils@npm:^8.50.0": version: 8.50.0 resolution: "@typescript-eslint/tsconfig-utils@npm:8.50.0" @@ -1604,6 +1639,15 @@ __metadata: languageName: node linkType: hard +"@typescript-eslint/tsconfig-utils@npm:8.56.1, @typescript-eslint/tsconfig-utils@npm:^8.56.1": + version: 8.56.1 + resolution: "@typescript-eslint/tsconfig-utils@npm:8.56.1" + peerDependencies: + typescript: ">=4.8.4 <6.0.0" + checksum: 10/d509f1ae4b14969173e498db6d15c833b6407db456c7fca9e25396798a35014229a73754691f353c4a99f5f0bbb4535b4144f42f84e596645a16d88a2022135f + languageName: node + linkType: hard + "@typescript-eslint/type-utils@npm:8.50.0": version: 8.50.0 resolution: "@typescript-eslint/type-utils@npm:8.50.0" @@ -1627,6 +1671,13 @@ __metadata: languageName: node linkType: hard +"@typescript-eslint/types@npm:8.56.1, @typescript-eslint/types@npm:^8.56.1": + version: 8.56.1 + resolution: "@typescript-eslint/types@npm:8.56.1" + checksum: 10/4bcffab5b0fd48adb731fcade86a776ca4a66e229defa5a282b58ba9c95af16ffc459a7d188e27c988a35be1f6fb5b812f9cf0952692eac38d5b3e87daafb20a + languageName: node + linkType: hard + "@typescript-eslint/typescript-estree@npm:8.50.0": version: 8.50.0 resolution: "@typescript-eslint/typescript-estree@npm:8.50.0" @@ -1646,6 +1697,25 @@ __metadata: languageName: node linkType: hard +"@typescript-eslint/typescript-estree@npm:8.56.1": + version: 8.56.1 + resolution: "@typescript-eslint/typescript-estree@npm:8.56.1" + dependencies: + "@typescript-eslint/project-service": "npm:8.56.1" + "@typescript-eslint/tsconfig-utils": "npm:8.56.1" + "@typescript-eslint/types": "npm:8.56.1" + "@typescript-eslint/visitor-keys": "npm:8.56.1" + debug: "npm:^4.4.3" + minimatch: "npm:^10.2.2" + semver: "npm:^7.7.3" + tinyglobby: "npm:^0.2.15" + ts-api-utils: "npm:^2.4.0" + peerDependencies: + typescript: ">=4.8.4 <6.0.0" + checksum: 10/af39dae0a8fada72295a11f0efb49f311241134b0a3d819100eeda6a2f92368844645873ba785de5513ad541cd9c2ba17b9bfed2679daac4682fa2a3b627f087 + languageName: node + linkType: hard + "@typescript-eslint/utils@npm:8.50.0": version: 8.50.0 resolution: "@typescript-eslint/utils@npm:8.50.0" @@ -1661,6 +1731,21 @@ __metadata: languageName: node linkType: hard +"@typescript-eslint/utils@npm:^8.55.0": + version: 8.56.1 + resolution: "@typescript-eslint/utils@npm:8.56.1" + dependencies: + "@eslint-community/eslint-utils": "npm:^4.9.1" + "@typescript-eslint/scope-manager": "npm:8.56.1" + "@typescript-eslint/types": "npm:8.56.1" + "@typescript-eslint/typescript-estree": "npm:8.56.1" + peerDependencies: + eslint: ^8.57.0 || ^9.0.0 || ^10.0.0 + typescript: ">=4.8.4 <6.0.0" + checksum: 10/528cbd187d8288a8cfce24a043f993b93711087f53d2b6f95cdd615a1a4087af1dab083a747761af97474a621c7b14f11c84ee50c250f31566ebc64cf73867fe + languageName: node + linkType: hard + "@typescript-eslint/visitor-keys@npm:8.50.0": version: 8.50.0 resolution: "@typescript-eslint/visitor-keys@npm:8.50.0" @@ -1671,6 +1756,16 @@ __metadata: languageName: node linkType: hard +"@typescript-eslint/visitor-keys@npm:8.56.1": + version: 8.56.1 + resolution: "@typescript-eslint/visitor-keys@npm:8.56.1" + dependencies: + "@typescript-eslint/types": "npm:8.56.1" + eslint-visitor-keys: "npm:^5.0.0" + checksum: 10/efed6a9867e7be203eec543e5a65da5aaec96aae55fba6fe74a305bf600e57c707764835e82bb8eb541f49a9b70442ff1e1a0ecf3543c78c91b84dda43b95c53 + languageName: node + linkType: hard + "@typespec/ts-http-runtime@npm:^0.3.0": version: 0.3.2 resolution: "@typespec/ts-http-runtime@npm:0.3.2" @@ -1709,6 +1804,25 @@ __metadata: languageName: node linkType: hard +"@vitest/eslint-plugin@npm:^1.6.9": + version: 1.6.9 + resolution: "@vitest/eslint-plugin@npm:1.6.9" + dependencies: + "@typescript-eslint/scope-manager": "npm:^8.55.0" + "@typescript-eslint/utils": "npm:^8.55.0" + peerDependencies: + eslint: ">=8.57.0" + typescript: ">=5.0.0" + vitest: "*" + peerDependenciesMeta: + typescript: + optional: true + vitest: + optional: true + checksum: 10/b718dc25635bdd997b37302db7e1184f26dd872e99d139684b754e960acc2f2fdce9a48015a473bb7e9724e93cd6aa67939a6183e4dfa26417cb8c5b35dea2df + languageName: node + linkType: hard + "@vitest/expect@npm:3.2.4": version: 3.2.4 resolution: "@vitest/expect@npm:3.2.4" @@ -3388,6 +3502,13 @@ __metadata: languageName: node linkType: hard +"eslint-visitor-keys@npm:^5.0.0": + version: 5.0.1 + resolution: "eslint-visitor-keys@npm:5.0.1" + checksum: 10/f9cc1a57b75e0ef949545cac33d01e8367e302de4c1483266ed4d8646ee5c306376660196bbb38b004e767b7043d1e661cb4336b49eff634a1bbe75c1db709ec + languageName: node + linkType: hard + "eslint@npm:^9.39.2": version: 9.39.2 resolution: "eslint@npm:9.39.2" @@ -6962,6 +7083,15 @@ __metadata: languageName: node linkType: hard +"ts-api-utils@npm:^2.4.0": + version: 2.4.0 + resolution: "ts-api-utils@npm:2.4.0" + peerDependencies: + typescript: ">=4.8.4" + checksum: 10/d6b2b3b6caad8d2f4ddc0c3785d22bb1a6041773335a1c71d73a5d67d11d993763fe8e4faefc4a4d03bb42b26c6126bbcf2e34826baed1def5369d0ebad358fa + languageName: node + linkType: hard + "ts-node@npm:^10.9.2": version: 10.9.2 resolution: "ts-node@npm:10.9.2"