Skip to content

Commit

Permalink
fix(prettier): correctly handle jsonc files
Browse files Browse the repository at this point in the history
  • Loading branch information
murdos committed Dec 18, 2024
1 parent 86f03c7 commit 474417c
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .lintstagedrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ export default {
'*.{js,cjs,ts,tsx,vue}': ['eslint --fix', 'prettier --write'],
'*.{css,scss}': ['stylelint --fix --allow-empty-input', 'prettier --write'],
'*.pug': ['eslint --fix', 'prettier --write'],
'*.{md,json,yml,html,java,xml,feature,sh}': ['prettier --write'],
'*.{md,json*,yml,html,java,xml,feature,sh}': ['prettier --write'],
};
6 changes: 6 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,9 @@ bracketSameLine: false

# xml rules:
xmlWhitespaceSensitivity: ignore

# https://github.com/prettier/prettier/issues/15956
overrides:
- files: ['*.jsonc']
options:
trailingComma: none
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public JHipsterModule buildModule(JHipsterModuleProperties properties) {
.postActions()
.add(context -> npmLazyInstaller.runInstallIn(context.projectFolder()))
.and()
.preCommitActions(stagedFilesFilter("*.{md,json,yml,html,css,scss,java,xml,feature}"), preCommitCommands("['prettier --write']"))
.preCommitActions(stagedFilesFilter("*.{md,json*,yml,html,css,scss,java,xml,feature}"), preCommitCommands("['prettier --write']"))
.build();
//@formatter:on
}
Expand Down
6 changes: 6 additions & 0 deletions src/main/resources/generator/prettier/.prettierrc.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,9 @@ bracketSameLine: false

# xml rules:
xmlWhitespaceSensitivity: ignore

# https://github.com/prettier/prettier/issues/15956
overrides:
- files: ['*.jsonc']
options:
trailingComma: none
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ void shouldBuildModuleWithoutPrettierLintStaged() {
.containing(
"""
module.exports = {
'*.{md,json,yml,html,css,scss,java,xml,feature}': ['prettier --write'],
'*.{md,json*,yml,html,css,scss,java,xml,feature}': ['prettier --write'],
'*.pug': ['eslint --fix', 'prettier --write'],
};
"""
Expand Down Expand Up @@ -83,7 +83,7 @@ void shouldBuildModuleWithEmptyLintStaged() {
.containing(
"""
module.exports = {
'*.{md,json,yml,html,css,scss,java,xml,feature}': ['prettier --write'],
'*.{md,json*,yml,html,css,scss,java,xml,feature}': ['prettier --write'],
};
"""
);
Expand Down

0 comments on commit 474417c

Please sign in to comment.