• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

pantsbuild / pants / 18863997817

28 Oct 2025 04:20AM UTC coverage: 43.222% (-37.1%) from 80.276%
18863997817

Pull #22800

github

web-flow
Merge 8c0fd834f into 68248435f
Pull Request #22800: Bump the gha-deps group across 1 directory with 14 updates

25847 of 59801 relevant lines covered (43.22%)

0.86 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/python/pants/backend/javascript/lint/prettier/subsystem.py
1
# Copyright 2022 Pants project contributors (see CONTRIBUTORS.md).
2
# Licensed under the Apache License, Version 2.0 (see LICENSE).
3

4
from __future__ import annotations
×
5

6
import os
×
7
from collections.abc import Iterable
×
8

9
from pants.backend.javascript.subsystems.nodejs_tool import NodeJSToolBase
×
10
from pants.core.util_rules.config_files import ConfigFilesRequest
×
11
from pants.option.option_types import ArgsListOption, SkipOption
×
12
from pants.util.strutil import help_text
×
13

14

15
class Prettier(NodeJSToolBase):
×
16
    options_scope = "prettier"
×
17
    name = "Prettier"
×
18
    help = help_text(
×
19
        """
20
        The Prettier utility for formatting JS/TS (and others) code
21
        (https://prettier.io/).
22
        """
23
    )
24

25
    default_version = "prettier@3.6.2"
×
26

27
    skip = SkipOption("fmt", "lint")
×
28
    args = ArgsListOption(example="--version")
×
29

30
    def config_request(self, dirs: Iterable[str]) -> ConfigFilesRequest:
×
31
        """Prettier will use the closest configuration file to the file currently being formatted,
32
        so add all of them In the event of multiple configuration files, Prettier has an order of
33
        precedence specified here: https://prettier.io/docs/en/configuration.html."""
34

35
        config_files = (
×
36
            *[f"prettier.config{ext}" for ext in [".js", ".cjs"]],
37
            *[
38
                f".prettierrc{ext}"
39
                for ext in [
40
                    "",
41
                    ".json",
42
                    ".yml",
43
                    ".yaml",
44
                    ".json5",
45
                    ".js",
46
                    ".cjs",
47
                    ".toml",
48
                ]
49
            ],
50
        )
51
        check_existence = [os.path.join(d, file) for file in config_files for d in ("", *dirs)]
×
52
        return ConfigFilesRequest(
×
53
            discovery=True,
54
            check_existence=check_existence,
55
        )
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc