-
Notifications
You must be signed in to change notification settings - Fork 15
feat: typescript plugin poc implementation #902
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from 109 commits
Commits
Show all changes
120 commits
Select commit
Hold shift + click to select a range
da9891e
test(test-setup): add custom path matcher to vitest, add tests
BioPhoton d166627
format
BioPhoton 332c963
fix build
BioPhoton dd21bfd
wip
BioPhoton 9d2dcab
test: refactor typings
BioPhoton 619a2bc
refactor: adjust types
BioPhoton 13f9374
Merge branch 'main' into test-custom-matcher-paths-os-agnostic
BioPhoton b81df43
test(test-setup): fix custom path matchers type definitions
matejchalk 7194c09
Merge branch 'main' into test-custom-matcher-paths-os-agnostic
matejchalk 44aa3ab
Update vite.config.unit.ts
BioPhoton 3703047
Update path.matcher.ts
BioPhoton 1618c11
Update path.matcher.ts
BioPhoton 499a67e
Update path.matcher.ts
BioPhoton e350aa6
Update path.matcher.ts
BioPhoton b896dab
wip
BioPhoton 78d6c6c
wip
BioPhoton ebaebe1
Merge branch 'main' into test-custom-matcher-paths-os-agnostic
BioPhoton a1642c7
fix lint
BioPhoton 0a75f47
feat: add TypeScript plugin
BioPhoton 63a3129
wip
BioPhoton 1606175
wip
BioPhoton eead92f
wip
BioPhoton a92c487
wip
BioPhoton 7abace2
fix lint
BioPhoton 84b0bc6
fix format
BioPhoton 01d044e
wip
BioPhoton e3c0d48
add category
BioPhoton 7683533
fix: adjust plugin options
BioPhoton c1cff7b
fix: adjust plugin options for audits
BioPhoton 62e4ba0
wip
BioPhoton 0a48be4
wip
BioPhoton 381ffbb
wip
BioPhoton a32f9b2
wip
BioPhoton c7f2d3a
wip
BioPhoton ba00774
wip
BioPhoton 73232cd
add groups
BioPhoton ce4daa6
refactor static ts error data
BioPhoton 68f56c8
feat(plugin-typescript): new tests, docs, readme, remove unused asyncโฆ
aramirezj 7c67433
merge PR
BioPhoton 7ecb376
wip
BioPhoton 8bd94f6
wip
BioPhoton e229455
wip
BioPhoton 1b4d4bb
feat: add ts config default generator
BioPhoton cee894f
wip
BioPhoton e8ab0e4
wip
BioPhoton 9ee6857
wip
BioPhoton f02dd08
wip
BioPhoton 26c12d0
cleanup config and imports
BioPhoton 4c71a2b
wip
BioPhoton 233fe92
wip
BioPhoton 039ed97
wip
BioPhoton bea7105
wip
BioPhoton 05b2504
wip
BioPhoton 1f17b67
wip
BioPhoton 64876ed
wip
BioPhoton 6f702d7
wip
BioPhoton 58bb4f8
wip
BioPhoton d7d797c
wip
BioPhoton eda1681
chore(plugin-typescript): wip (#906)
aramirezj 06b39ca
feat: add postinstall to typescript plugin
BioPhoton f6b8f59
wip
BioPhoton 4ceac7f
fix lint
BioPhoton 396b761
refactor tests
BioPhoton 4092fa0
refactor unit tests
BioPhoton 21ee2fe
refactor unit tests
BioPhoton 1b0a8f3
wip
BioPhoton e855d6f
Update package.json
BioPhoton c150de0
wip
BioPhoton b3a38b3
test: setup basic e2e
BioPhoton 430186e
wip
BioPhoton 55f4e2c
wip
BioPhoton 137fe52
wip
BioPhoton 350f971
fix unit and integration tests
BioPhoton 8792092
wip
BioPhoton 0cf36a8
wip
BioPhoton 17ae3b1
wip
BioPhoton 34ba6cc
wip
BioPhoton 3d7ac94
wip
BioPhoton 61a1623
wip
BioPhoton a87fc03
test: add basic e2e
BioPhoton a8c252e
wip
BioPhoton e812e3c
wip
BioPhoton 17ea733
fix e2e
BioPhoton 7bca00e
e2e
BioPhoton c4a3889
e2e
BioPhoton 0938ffd
wip
BioPhoton d656b23
wip
BioPhoton 0d06579
fix: refactor types
BioPhoton 5a53391
wip
BioPhoton a31e15d
wip
BioPhoton eca4416
refactor to code ranges
BioPhoton 5c80d53
fix tests for to code ranges
BioPhoton b947f5e
cleanup
BioPhoton ebd6e8b
cleanup
BioPhoton 51ae9fe
cleanup
BioPhoton 57e33f3
Merge branch 'main' into plugin-typescript
BioPhoton 8146f93
Merge branch 'main' into test-custom-matcher-paths-os-agnostic
BioPhoton 2db3010
wip
BioPhoton 0870140
e2e issues 1
BioPhoton 967280a
e2e issues 2
BioPhoton bbfeb57
e2e issues 3
BioPhoton 71e0062
Merge branch 'test-custom-matcher-paths-os-agnostic' into plugin-typeโฆ
BioPhoton c85c44d
wip
BioPhoton 5aacd8d
wip
BioPhoton 4a687f7
wip
BioPhoton 8f3dc47
timeout 1
BioPhoton 9414f47
timeout 2
BioPhoton 2a33c78
timeout 3
BioPhoton 56531e9
Merge branch 'main' into plugin-typescript
BioPhoton 80b1fbc
adjust ranges
BioPhoton 2fd18c1
wip
BioPhoton 47d4149
wip
BioPhoton a9f9c03
refactor e2e
BioPhoton 51710a4
refactor docs
BioPhoton bae4eee
refactor types
BioPhoton 4e05355
refactor categories
BioPhoton 0fe38d1
wip
BioPhoton 0b9c371
Merge branch 'main' into plugin-typescript
BioPhoton 5ae687a
Merge branch 'main' into plugin-typescript
BioPhoton 66d1fec
Merge branch 'main' into plugin-typescript
BioPhoton File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| import tseslint from 'typescript-eslint'; | ||
| import baseConfig from '../../eslint.config.js'; | ||
|
|
||
| export default tseslint.config(...baseConfig, { | ||
| files: ['**/*.ts'], | ||
| languageOptions: { | ||
| parserOptions: { | ||
| projectService: true, | ||
| tsconfigRootDir: import.meta.dirname, | ||
| }, | ||
| }, | ||
| }); |
19 changes: 19 additions & 0 deletions
19
e2e/plugin-typescript-e2e/mocks/fixtures/default-setup/code-pushup.config.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| import type { CoreConfig } from '@code-pushup/models'; | ||
| import {getCategoryRefsFromGroups, typescriptPlugin} from "@code-pushup/typescript-plugin"; | ||
|
|
||
| export default { | ||
| plugins: [ | ||
| await typescriptPlugin({ | ||
| tsConfigPath: 'tsconfig.json', | ||
| }), | ||
| ], | ||
| categories: [ | ||
| { | ||
| slug: 'typescript-quality', | ||
| title: 'Typescript', | ||
| refs: await getCategoryRefsFromGroups({ | ||
| tsConfigPath: 'tsconfig.json', | ||
| }) | ||
| } | ||
| ], | ||
| } satisfies CoreConfig; |
3 changes: 3 additions & 0 deletions
3
e2e/plugin-typescript-e2e/mocks/fixtures/default-setup/exclude/utils.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| export function test() { | ||
| return 'test'; | ||
| } |
1 change: 1 addition & 0 deletions
1
e2e/plugin-typescript-e2e/mocks/fixtures/default-setup/src/1-syntax-errors.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| const a = { ; // Error: TS1136: Property assignment expected |
7 changes: 7 additions & 0 deletions
7
e2e/plugin-typescript-e2e/mocks/fixtures/default-setup/src/2-semantic-errors.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| // 2683 - NoImplicitThis: 'this' implicitly has type 'any'. | ||
| function noImplicitThisTS2683() { | ||
| console.log(this.value); // Error 2683 | ||
| } | ||
|
|
||
| // 2531 - StrictNullChecks: Object is possibly 'null'. | ||
| const strictNullChecksTS2531: string = null; |
6 changes: 6 additions & 0 deletions
6
e2e/plugin-typescript-e2e/mocks/fixtures/default-setup/src/4-languale-service.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| class Standalone { | ||
| override method() { // Error: TS4114 - 'override' modifier can only be used in a class derived from a base class. | ||
| console.log("Standalone method"); | ||
| } | ||
| } | ||
| const s = Standalone; |
1 change: 1 addition & 0 deletions
1
e2e/plugin-typescript-e2e/mocks/fixtures/default-setup/src/6-configuration-errors.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| import { test } from '../exclude/utils'; // TS6059:: File 'exclude/utils.ts' is not under 'rootDir' '.../configuration-errors'. 'rootDir' is expected to contain all source files. |
10 changes: 10 additions & 0 deletions
10
e2e/plugin-typescript-e2e/mocks/fixtures/default-setup/tsconfig.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| { | ||
| "compilerOptions": { | ||
| "rootDir": "./src", | ||
| "target": "ES6", | ||
| "module": "CommonJS", | ||
| "strict": true, | ||
| "verbatimModuleSyntax": false | ||
| }, | ||
| "include": ["src/**/*.ts"], | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| { | ||
| "name": "plugin-typescript-e2e", | ||
| "$schema": "../../node_modules/nx/schemas/project-schema.json", | ||
| "sourceRoot": "e2e/plugin-typescript-e2e/src", | ||
| "projectType": "application", | ||
| "targets": { | ||
| "lint": { | ||
| "executor": "@nx/linter:eslint", | ||
| "outputs": ["{options.outputFile}"], | ||
| "options": { | ||
| "lintFilePatterns": ["e2e/plugin-typescript-e2e/**/*.ts"] | ||
| } | ||
| }, | ||
| "e2e": { | ||
| "executor": "@nx/vite:test", | ||
| "options": { | ||
| "configFile": "e2e/plugin-typescript-e2e/vite.config.e2e.ts" | ||
| } | ||
| } | ||
| }, | ||
| "implicitDependencies": ["cli", "plugin-typescript"], | ||
| "tags": ["scope:plugin", "type:e2e"] | ||
| } |
118 changes: 118 additions & 0 deletions
118
e2e/plugin-typescript-e2e/tests/__snapshots__/typescript-plugin-json-report.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,118 @@ | ||
| { | ||
| "categories": [ | ||
| { | ||
| "refs": [ | ||
| { | ||
| "plugin": "typescript", | ||
| "slug": "problems-group", | ||
| "type": "group", | ||
| "weight": 1, | ||
| }, | ||
| { | ||
| "plugin": "typescript", | ||
| "slug": "ts-configuration-group", | ||
| "type": "group", | ||
| "weight": 1, | ||
| }, | ||
| { | ||
| "plugin": "typescript", | ||
| "slug": "miscellaneous-group", | ||
| "type": "group", | ||
| "weight": 1, | ||
| }, | ||
| ], | ||
| "slug": "typescript-quality", | ||
| "title": "Typescript", | ||
| }, | ||
| ], | ||
| "packageName": "@code-pushup/core", | ||
| "plugins": [ | ||
| { | ||
| "audits": [ | ||
| { | ||
| "description": "Errors that occur during parsing and lexing of TypeScript source code", | ||
| "slug": "syntax-errors", | ||
| "title": "Syntax-Errors", | ||
| }, | ||
| { | ||
| "description": "Errors that occur during type checking and type inference", | ||
| "slug": "semantic-errors", | ||
| "title": "Semantic-Errors", | ||
| }, | ||
| { | ||
| "description": "Errors that occur during TypeScript language service operations", | ||
| "slug": "language-service-errors", | ||
| "title": "Language-Service-Errors", | ||
| }, | ||
| { | ||
| "description": "Errors that occur during TypeScript internal operations", | ||
| "slug": "internal-errors", | ||
| "title": "Internal-Errors", | ||
| }, | ||
| { | ||
| "description": "Errors that occur when parsing TypeScript configuration files", | ||
| "slug": "configuration-errors", | ||
| "title": "Configuration-Errors", | ||
| }, | ||
| { | ||
| "description": "Errors that do not match any known TypeScript error code", | ||
| "slug": "unknown-codes", | ||
| "title": "Unknown-Codes", | ||
| }, | ||
| ], | ||
| "description": "Official Code PushUp Typescript plugin.", | ||
| "docsUrl": "https://www.npmjs.com/package/@code-pushup/typescript-plugin/", | ||
| "groups": [ | ||
| { | ||
| "description": "Syntax, semantic, and internal compiler errors are critical for identifying and preventing bugs.", | ||
| "refs": [ | ||
| { | ||
| "slug": "syntax-errors", | ||
| "weight": 1, | ||
| }, | ||
| { | ||
| "slug": "semantic-errors", | ||
| "weight": 1, | ||
| }, | ||
| { | ||
| "slug": "internal-errors", | ||
| "weight": 1, | ||
| }, | ||
| ], | ||
| "slug": "problems-group", | ||
| "title": "Problems", | ||
| }, | ||
| { | ||
| "description": "TypeScript configuration and options errors ensure correct project setup, reducing risks from misconfiguration.", | ||
| "refs": [ | ||
| { | ||
| "slug": "configuration-errors", | ||
| "weight": 1, | ||
| }, | ||
| ], | ||
| "slug": "ts-configuration-group", | ||
| "title": "Configuration", | ||
| }, | ||
| { | ||
| "description": "Errors that do not bring any specific value to the developer, but are still useful to know.", | ||
| "refs": [ | ||
| { | ||
| "slug": "unknown-codes", | ||
| "weight": 1, | ||
| }, | ||
| { | ||
| "slug": "language-service-errors", | ||
| "weight": 1, | ||
| }, | ||
| ], | ||
| "slug": "miscellaneous-group", | ||
| "title": "Miscellaneous", | ||
| }, | ||
| ], | ||
| "icon": "typescript", | ||
| "packageName": "@code-pushup/typescript-plugin", | ||
| "slug": "typescript", | ||
| "title": "Typescript", | ||
| }, | ||
| ], | ||
| } |
36 changes: 36 additions & 0 deletions
36
e2e/plugin-typescript-e2e/tests/__snapshots__/typescript-plugin-terminal-report.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| Code PushUp CLI | ||
| [ info ] Run collect... | ||
| Code PushUp Report - @code-pushup/core@0.57.0 | ||
|
|
||
|
|
||
| Typescript audits | ||
|
|
||
| โ Semantic-Errors 2 | ||
| โ Configuration-Errors 1 | ||
| โ Language-Service-Errors 1 | ||
| โ Syntax-Errors 1 | ||
| โ Internal-Errors 0 | ||
| โ Unknown-Codes 0 | ||
|
|
||
| Categories | ||
|
|
||
| โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโฌโโโโโโโโโโโ | ||
| โ Category โ Score โ Audits โ | ||
| โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโผโโโโโโโโโโโค | ||
| โ Typescript โ 28 โ 6 โ | ||
| โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโดโโโโโโโโโโโ | ||
|
|
||
| Made with โค by code-pushup.dev | ||
|
|
||
| [ success ] Generated reports successfully: | ||
| [ success ] Collecting report successful! | ||
| โญโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ | ||
| โ โ | ||
| โ ๐ก Visualize your reports โ | ||
| โ โ | ||
| โ โฏ npx code-pushup upload - Run upload to upload the created report to the server โ | ||
| โ https://github.com/code-pushup/cli/tree/main/packages/cli#upload-command โ | ||
| โ โฏ npx code-pushup autorun - Run collect & upload โ | ||
| โ https://github.com/code-pushup/cli/tree/main/packages/cli#autorun-command โ | ||
| โ โ | ||
| โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.