-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(plugin-typescript): setup plugin project base (#917)
- Loading branch information
Showing
11 changed files
with
211 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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,21 @@ | ||
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, | ||
}, | ||
}, | ||
}, | ||
{ | ||
files: ['**/*.json'], | ||
rules: { | ||
'@nx/dependency-checks': 'error', | ||
}, | ||
}, | ||
); |
This file contains 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,27 @@ | ||
{ | ||
"name": "@code-pushup/typescript-plugin", | ||
"version": "0.57.0", | ||
"license": "MIT", | ||
"description": "Code PushUp plugin for incrementally adopting strict compilation flags in TypeScript projects", | ||
"homepage": "https://github.com/code-pushup/cli/tree/main/packages/plugin-typescript#readme", | ||
"bugs": { | ||
"url": "https://github.com/code-pushup/cli/issues?q=is%3Aissue%20state%3Aopen%20type%3ABug%20label%3A\"🧩%20typescript-plugin\"" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/code-pushup/cli.git", | ||
"directory": "packages/plugin-typescript" | ||
}, | ||
"keywords": [ | ||
"CLI", | ||
"Code PushUp", | ||
"plugin", | ||
"typescript" | ||
], | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"type": "module", | ||
"dependencies": {}, | ||
"scripts": {} | ||
} |
This file contains 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,41 @@ | ||
{ | ||
"name": "plugin-typescript", | ||
"$schema": "../../node_modules/nx/schemas/project-schema.json", | ||
"sourceRoot": "packages/plugin-typescript/src", | ||
"projectType": "library", | ||
"targets": { | ||
"build": { | ||
"executor": "@nx/js:tsc", | ||
"outputs": ["{options.outputPath}"], | ||
"options": { | ||
"outputPath": "dist/packages/plugin-typescript", | ||
"main": "packages/plugin-typescript/src/index.ts", | ||
"tsConfig": "packages/plugin-typescript/tsconfig.lib.json", | ||
"assets": ["packages/plugin-typescript/*.md"] | ||
} | ||
}, | ||
"lint": { | ||
"executor": "@nx/linter:eslint", | ||
"outputs": ["{options.outputFile}"], | ||
"options": { | ||
"lintFilePatterns": [ | ||
"packages/plugin-typescript/**/*.ts", | ||
"packages/plugin-typescript/package.json" | ||
] | ||
} | ||
}, | ||
"unit-test": { | ||
"executor": "@nx/vite:test", | ||
"options": { | ||
"configFile": "packages/plugin-typescript/vite.config.unit.ts" | ||
} | ||
}, | ||
"integration-test": { | ||
"executor": "@nx/vite:test", | ||
"options": { | ||
"configFile": "packages/plugin-typescript/vite.config.integration.ts" | ||
} | ||
} | ||
}, | ||
"tags": ["scope:plugin", "type:feature", "publishable"] | ||
} |
This file contains 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 @@ | ||
export { TYPESCRIPT_PLUGIN_SLUG } from './lib/constants.js'; |
This file contains 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 @@ | ||
export const TYPESCRIPT_PLUGIN_SLUG = 'typescript'; |
This file contains 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 @@ | ||
{ | ||
"extends": "../../tsconfig.base.json", | ||
"compilerOptions": { | ||
"module": "ESNext", | ||
"forceConsistentCasingInFileNames": true, | ||
"strict": true, | ||
"noImplicitOverride": true, | ||
"noPropertyAccessFromIndexSignature": true, | ||
"noImplicitReturns": true, | ||
"noFallthroughCasesInSwitch": true, | ||
"types": ["vitest"] | ||
}, | ||
"files": [], | ||
"include": [], | ||
"references": [ | ||
{ | ||
"path": "./tsconfig.lib.json" | ||
}, | ||
{ | ||
"path": "./tsconfig.test.json" | ||
} | ||
] | ||
} |
This file contains 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,16 @@ | ||
{ | ||
"extends": "./tsconfig.json", | ||
"compilerOptions": { | ||
"outDir": "../../dist/out-tsc", | ||
"declaration": true, | ||
"types": ["node"] | ||
}, | ||
"include": ["src/**/*.ts"], | ||
"exclude": [ | ||
"vite.config.unit.ts", | ||
"vite.config.integration.ts", | ||
"src/**/*.test.ts", | ||
"src/**/*.mock.ts", | ||
"mocks/**/*.ts" | ||
] | ||
} |
This file contains 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,17 @@ | ||
{ | ||
"extends": "./tsconfig.json", | ||
"compilerOptions": { | ||
"outDir": "../../dist/out-tsc", | ||
"types": ["vitest/globals", "vitest/importMeta", "vite/client", "node"] | ||
}, | ||
"include": [ | ||
"vite.config.unit.ts", | ||
"vite.config.integration.ts", | ||
"mocks/**/*.ts", | ||
"src/**/*.test.ts", | ||
"src/**/*.test.tsx", | ||
"src/**/*.test.js", | ||
"src/**/*.test.jsx", | ||
"src/**/*.d.ts" | ||
] | ||
} |
This file contains 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,30 @@ | ||
/// <reference types="vitest" /> | ||
import { defineConfig } from 'vite'; | ||
import { tsconfigPathAliases } from '../../tools/vitest-tsconfig-path-aliases.js'; | ||
|
||
export default defineConfig({ | ||
cacheDir: '../../node_modules/.vite/plugin-typescript', | ||
test: { | ||
reporters: ['basic'], | ||
globals: true, | ||
cache: { | ||
dir: '../../node_modules/.vitest/plugin-typescript', | ||
}, | ||
alias: tsconfigPathAliases(), | ||
pool: 'threads', | ||
poolOptions: { threads: { singleThread: true } }, | ||
coverage: { | ||
reporter: ['text', 'lcov'], | ||
reportsDirectory: '../../coverage/plugin-typescript/integration-tests', | ||
exclude: ['mocks/**', '**/types.ts'], | ||
}, | ||
environment: 'node', | ||
include: ['src/**/*.integration.test.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'], | ||
globalSetup: ['../../global-setup.ts'], | ||
setupFiles: [ | ||
'../../testing/test-setup/src/lib/cliui.mock.ts', | ||
'../../testing/test-setup/src/lib/reset.mocks.ts', | ||
'../../testing/test-setup/src/lib/chrome-path.setup.ts', | ||
], | ||
}, | ||
}); |
This file contains 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,31 @@ | ||
/// <reference types="vitest" /> | ||
import { defineConfig } from 'vite'; | ||
import { tsconfigPathAliases } from '../../tools/vitest-tsconfig-path-aliases.js'; | ||
|
||
export default defineConfig({ | ||
cacheDir: '../../node_modules/.vite/plugin-typescript', | ||
test: { | ||
reporters: ['basic'], | ||
globals: true, | ||
cache: { | ||
dir: '../../node_modules/.vitest/plugin-typescript', | ||
}, | ||
alias: tsconfigPathAliases(), | ||
pool: 'threads', | ||
poolOptions: { threads: { singleThread: true } }, | ||
coverage: { | ||
reporter: ['text', 'lcov'], | ||
reportsDirectory: '../../coverage/plugin-typescript/unit-tests', | ||
exclude: ['mocks/**', '**/types.ts'], | ||
}, | ||
environment: 'node', | ||
include: ['src/**/*.unit.test.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'], | ||
globalSetup: ['../../global-setup.ts'], | ||
setupFiles: [ | ||
'../../testing/test-setup/src/lib/cliui.mock.ts', | ||
'../../testing/test-setup/src/lib/fs.mock.ts', | ||
'../../testing/test-setup/src/lib/console.mock.ts', | ||
'../../testing/test-setup/src/lib/reset.mocks.ts', | ||
], | ||
}, | ||
}); |
This file contains 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