Skip to content

Commit

Permalink
feat(plugins): add @jnxplus/nx-ktlint plugin (#518)
Browse files Browse the repository at this point in the history
Co-authored-by: khalilou88 <[email protected]>
  • Loading branch information
khalilou88 and khalilou88 authored Oct 14, 2023
1 parent c3f1877 commit ed8fa12
Show file tree
Hide file tree
Showing 12 changed files with 162 additions and 0 deletions.
25 changes: 25 additions & 0 deletions packages/nx-ktlint/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"extends": ["../../.eslintrc.json"],
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {}
},
{
"files": ["*.ts", "*.tsx"],
"rules": {}
},
{
"files": ["*.js", "*.jsx"],
"rules": {}
},
{
"files": ["*.json"],
"parser": "jsonc-eslint-parser",
"rules": {
"@nx/dependency-checks": "error"
}
}
]
}
11 changes: 11 additions & 0 deletions packages/nx-ktlint/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# nx-ktlint

This library was generated with [Nx](https://nx.dev).

## Building

Run `nx build nx-ktlint` to build the library.

## Running unit tests

Run `nx test nx-ktlint` to execute the unit tests via [Jest](https://jestjs.io).
11 changes: 11 additions & 0 deletions packages/nx-ktlint/jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/* eslint-disable */
export default {
displayName: 'nx-ktlint',
preset: '../../jest.preset.js',
testEnvironment: 'node',
transform: {
'^.+\\.[tj]s$': ['ts-jest', { tsconfig: '<rootDir>/tsconfig.spec.json' }],
},
moduleFileExtensions: ['ts', 'js', 'html'],
coverageDirectory: '../../coverage/packages/nx-ktlint',
};
10 changes: 10 additions & 0 deletions packages/nx-ktlint/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "@jnxplus/nx-ktlint",
"version": "0.0.1",
"dependencies": {
"tslib": "^2.3.0"
},
"type": "commonjs",
"main": "./src/index.js",
"typings": "./src/index.d.ts"
}
47 changes: 47 additions & 0 deletions packages/nx-ktlint/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"name": "nx-ktlint",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "packages/nx-ktlint/src",
"projectType": "library",
"targets": {
"build": {
"executor": "@nx/js:tsc",
"outputs": ["{options.outputPath}"],
"options": {
"outputPath": "dist/packages/nx-ktlint",
"main": "packages/nx-ktlint/src/index.ts",
"tsConfig": "packages/nx-ktlint/tsconfig.lib.json",
"assets": ["packages/nx-ktlint/*.md"]
}
},
"publish": {
"command": "node tools/scripts/publish.mjs nx-ktlint {args.ver} {args.tag}",
"dependsOn": ["build"]
},
"lint": {
"executor": "@nx/linter:eslint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": [
"packages/nx-ktlint/**/*.ts",
"packages/nx-ktlint/package.json"
]
}
},
"test": {
"executor": "@nx/jest:jest",
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
"options": {
"jestConfig": "packages/nx-ktlint/jest.config.ts",
"passWithNoTests": true
},
"configurations": {
"ci": {
"ci": true,
"codeCoverage": true
}
}
}
},
"tags": []
}
1 change: 1 addition & 0 deletions packages/nx-ktlint/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './lib/nx-ktlint';
7 changes: 7 additions & 0 deletions packages/nx-ktlint/src/lib/nx-ktlint.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { nxKtlint } from './nx-ktlint';

describe('nxKtlint', () => {
it('should work', () => {
expect(nxKtlint()).toEqual('nx-ktlint');
});
});
3 changes: 3 additions & 0 deletions packages/nx-ktlint/src/lib/nx-ktlint.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export function nxKtlint(): string {
return 'nx-ktlint';
}
22 changes: 22 additions & 0 deletions packages/nx-ktlint/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"module": "commonjs",
"forceConsistentCasingInFileNames": true,
"strict": true,
"noImplicitOverride": true,
"noPropertyAccessFromIndexSignature": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true
},
"files": [],
"include": [],
"references": [
{
"path": "./tsconfig.lib.json"
},
{
"path": "./tsconfig.spec.json"
}
]
}
10 changes: 10 additions & 0 deletions packages/nx-ktlint/tsconfig.lib.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"declaration": true,
"types": ["node"]
},
"include": ["src/**/*.ts"],
"exclude": ["jest.config.ts", "src/**/*.spec.ts", "src/**/*.test.ts"]
}
14 changes: 14 additions & 0 deletions packages/nx-ktlint/tsconfig.spec.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"module": "commonjs",
"types": ["jest", "node"]
},
"include": [
"jest.config.ts",
"src/**/*.test.ts",
"src/**/*.spec.ts",
"src/**/*.d.ts"
]
}
1 change: 1 addition & 0 deletions tsconfig.base.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"@jnxplus/internal/testing": ["packages/internal/testing/src/index.ts"],
"@jnxplus/nx-checkstyle": ["packages/nx-checkstyle/src/index.ts"],
"@jnxplus/nx-gradle": ["packages/nx-gradle/src/index.ts"],
"@jnxplus/nx-ktlint": ["packages/nx-ktlint/src/index.ts"],
"@jnxplus/nx-maven": ["packages/nx-maven/src/index.ts"],
"@jnxplus/xml": ["packages/xml/src/index.ts"]
}
Expand Down

0 comments on commit ed8fa12

Please sign in to comment.