Skip to content
This repository was archived by the owner on Jun 18, 2023. It is now read-only.

Commit ee4a801

Browse files
committed
feat: Add spotless code formatter with prettier
1 parent b427cdf commit ee4a801

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ It contains multiple mocks - including the ones from the springwolf-core example
2727

2828
To update the mock data, run `npm run update-mocks`.
2929

30+
### Code Formatting
31+
32+
The project uses spotless together with prettier for code formatting.
33+
Using the gradle task `spotlessApply`, the code is reformatted to match the style.
34+
3035
## Release
3136

3237
Releasing is done by running the gradle task `publish`. For local development, use `publishToMavenLocal`.

build.gradle

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ plugins {
33
id 'com.github.node-gradle.node' version '2.2.4'
44
id 'signing'
55
id 'maven-publish'
6+
id "com.diffplug.spotless" version "6.11.0"
67
}
78

89
def isSnapshot = Boolean.valueOf(project.findProperty('SNAPSHOT'))
@@ -18,6 +19,8 @@ node {
1819
}
1920

2021
npm_run_build {
22+
dependsOn spotlessCheck
23+
2124
inputs.files fileTree("src")
2225
inputs.file 'angular.json'
2326
inputs.file 'package.json'
@@ -97,3 +100,14 @@ signing {
97100
sign publishing.publications.mavenJava
98101
}
99102

103+
spotless {
104+
encoding 'UTF-8'
105+
106+
format 'Angular', {
107+
target 'src/**/*.ts', 'src/**/*.css', 'src/**/*.html'
108+
109+
trimTrailingWhitespace()
110+
endWithNewline()
111+
prettier().config(["singleQuote": true])
112+
}
113+
}

0 commit comments

Comments
 (0)