Skip to content

Prefer 2 spaces as default indent - #3050

Open
Goooler wants to merge 2 commits into
mainfrom
g/20260910/indent_size
Open

Prefer 2 spaces as default indent#3050
Goooler wants to merge 2 commits into
mainfrom
g/20260910/indent_size

Conversation

@Goooler

@Goooler Goooler commented Sep 10, 2026

Copy link
Copy Markdown
Member

No description provided.

@Goooler
Goooler added this pull request to stack #3051 September 10, 2026 13:16
@Goooler
Goooler requested a lite review from Copilot September 10, 2026 13:21

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The new package.json.template files leave an unconditional comma after ${devDependencies}, which yields invalid JSON when devDependencies is empty (and the test helper currently hits that path).

Pull request overview

This PR updates repository indentation defaults (2-space spaces by default) and migrates the Node-based formatter package.json resources to new *.json.template files, updating the Java steps/tests to load the new template paths.

Changes:

  • Update .editorconfig to prefer 2-space indentation by default (with overrides for Java/tab-indented files).
  • Add prettier/eslint/tsfmt package.json.template resources and update formatter steps/tests to read them.
  • Re-indent .github/renovate.json5 to match the new default style.
File summaries
File Description
lib/src/test/java/com/diffplug/spotless/npm/NodeServerLayoutTest.java Switches test helper to read the new prettier package.json template.
lib/src/main/resources/com/diffplug/spotless/npm/tsfmt-package.json.template New tsfmt npm package.json template resource.
lib/src/main/resources/com/diffplug/spotless/npm/prettier-package.json.template New prettier npm package.json template resource.
lib/src/main/resources/com/diffplug/spotless/npm/eslint-package.json.template New eslint npm package.json template resource.
lib/src/main/java/com/diffplug/spotless/npm/TsFmtFormatterStep.java Loads the new tsfmt template path when building NpmConfig.
lib/src/main/java/com/diffplug/spotless/npm/PrettierFormatterStep.java Loads the new prettier template path when building NpmConfig.
lib/src/main/java/com/diffplug/spotless/npm/EslintFormatterStep.java Loads the new eslint template path when building NpmConfig.
.github/renovate.json5 Reformats indentation to 2 spaces.
.editorconfig Sets default indentation to 2 spaces and adds/updates file-type overrides.
Review details

Suppressed comments (1)

lib/src/test/java/com/diffplug/spotless/npm/NodeServerLayoutTest.java:73

  • prettierPackageJson(Collections.emptyMap()) currently replaces ${devDependencies} with an empty string, which (with the new prettier-package.json.template) yields an invalid package.json fragment because the template keeps a trailing comma after the placeholder. Consider always including at least the core prettier devDependency (and using the same indentation/newline style as NpmFormatterStepStateBase#replaceDevDependencies) so the generated JSON is valid and representative of real usage.
		String templateContent = NpmResourceHelper.readUtf8StringFromClasspath(NodeServerLayoutTest.class, "/com/diffplug/spotless/npm/prettier-package.json.template");
		String dependenciesList = dependencies.entrySet().stream()
				.map(entry -> "\"%s\": \"%s\"".formatted(entry.getKey(), entry.getValue()))
				.reduce((a, b) -> a + ",\n  " + b)
				.orElse("");
  • Files reviewed: 5/9 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Base automatically changed from g/20260908/composite-build to main September 11, 2026 01:38
@Goooler
Goooler force-pushed the g/20260910/indent_size branch from 09ffe37 to 3bb1646 Compare September 11, 2026 01:38
@Goooler
Goooler marked this pull request as ready for review September 11, 2026 01:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants