Skip to content

Commit 2efa8db

Browse files
committed
Lint
1 parent 097717a commit 2efa8db

File tree

4 files changed

+59
-7
lines changed

4 files changed

+59
-7
lines changed

python/formate_js/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ def javascript_hook(
4747
Reformat JavaScript and TypeScript with dprint.
4848
4949
:param source: The source to reformat.
50+
:param formate_filename: The name of the file being formatted.
5051
:param \*\*kwargs:
5152
5253
:returns: The reformatted source.

python/formate_js/enums.py

Lines changed: 56 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,62 @@
1+
#!/usr/bin/env python3
2+
#
3+
# enums.py
4+
"""
5+
Enum values for configuration.
6+
"""
7+
#
8+
# Copyright © 2026 Dominic Davis-Foster <dominic@davis-foster.co.uk>
9+
#
10+
# Permission is hereby granted, free of charge, to any person obtaining a copy
11+
# of this software and associated documentation files (the "Software"), to deal
12+
# in the Software without restriction, including without limitation the rights
13+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14+
# copies of the Software, and to permit persons to whom the Software is
15+
# furnished to do so, subject to the following conditions:
16+
#
17+
# The above copyright notice and this permission notice shall be included in all
18+
# copies or substantial portions of the Software.
19+
#
20+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
23+
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
24+
# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
25+
# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
26+
# OR OTHER DEALINGS IN THE SOFTWARE.
27+
#
28+
129
# stdlib
230
from enum import Enum
331

4-
5-
class PreferHanging(str, Enum):
32+
__all__ = [
33+
"BracePosition",
34+
"ForceMultiLine",
35+
"JsxMultiLineParens",
36+
"JsxQuoteStyle",
37+
"MemberSpacing",
38+
"NamedTypeImportsExportsOrder",
39+
"NewLineKind",
40+
"NextControlFlowPosition",
41+
"OperatorPosition",
42+
"PreferHanging",
43+
"QuoteProps",
44+
"QuoteStyle",
45+
"SameOrNextLinePosition",
46+
"SemiColonOrComma",
47+
"SemiColons",
48+
"SortOrder",
49+
"TrailingCommas",
50+
"UseBraces",
51+
"UseParentheses",
52+
]
53+
54+
55+
class PreferHanging(str, Enum): # noqa: D101
656
#: Always prefer multi-line indentation
757
Never = "never"
858

959
#: Prefer hanging indentation for sequences with only a single item, but if there are multiple items then use multi-line indentation
10-
1160
OnlySingleItem = "onlySingleItem"
1261

1362
#: Always prefer hanging indentation
@@ -232,8 +281,10 @@ class SemiColonOrComma(str, Enum):
232281
"""
233282
Whether to use semi-colons or commas.
234283
"""
284+
235285
#: Use semi colons (default).
236286
SemiColon = "semiColon"
287+
237288
#: Use commas.
238289
Comma = "comma"
239290

@@ -253,13 +304,13 @@ class SortOrder(str, Enum):
253304
CaseInsensitive = "caseInsensitive"
254305

255306

256-
class NamedTypeImportsExportsOrder(str, Enum):
307+
class NamedTypeImportsExportsOrder(str, Enum): # noqa: D101
257308
First = "first"
258309
Last = "last"
259310
_None = "none"
260311

261312

262-
class NewLineKind(str, Enum):
313+
class NewLineKind(str, Enum): # noqa: D101
263314

264315
#: Decide which newline kind to use based on the last newline in the file.
265316
Auto = "auto"

src/format_text.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use dprint_plugin_typescript::{FormatTextOptions, format_text};
33
use pyo3::{exceptions::PyValueError, prelude::*};
44
use std::path::PathBuf;
55

6-
#[pyclass(name = "FormatTextOptions", module = "formate_js")]
6+
#[pyclass(name = "FormatTextOptions", module = "_formate_js")]
77
// #[repr(transparent)]
88
#[derive(Clone)]
99
// A wrapper around a [`FormatTextOptions`] that can be converted to and from python with `pyo3`.

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ fn _formate_js(_py: Python, m: &Bound<'_, PyModule>) -> PyResult<()> {
1414
m.add_class::<PyFormatTextOptions>().unwrap();
1515

1616
let format_text = wrap_pyfunction!(format_text_py, m)?;
17-
format_text.setattr("__module__", "formate_js")?;
17+
format_text.setattr("__module__", "_formate_js")?;
1818
m.add_function(format_text).unwrap();
1919

2020
Ok(())

0 commit comments

Comments
 (0)