File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -58,10 +58,14 @@ def unreferenced_components(self) -> list[Finding]:
5858
5959# ── Patterns ──────────────────────────────────────────────────────────
6060
61- # export const/let/var/function/class/type/interface/enum
61+ # export const/let/var/function/class/type/interface/enum.
62+ # Deliberately does NOT match `export default ...`: with `default` in the
63+ # alternation the capture group grabbed the keyword `function`/`class` as
64+ # the export name, flagging every default export as removable dead code.
65+ # Default exports are entry-point conventions and are skipped entirely.
6266_EXPORT_PATTERN = re .compile (
6367 r"^\s*export\s+"
64- r"(?:const|let|var|function|class|type|interface|enum|default )\s+"
68+ r"(?:const|let|var|function|class|type|interface|enum)\s+"
6569 r"([A-Za-z_$][\w$]*)" ,
6670 re .MULTILINE ,
6771)
Original file line number Diff line number Diff line change @@ -517,7 +517,10 @@ def test_ruff_known_first_party(self):
517517 """ruff known-first-party should be ['deadcode'], not ['*']."""
518518 from pathlib import Path
519519
520- import tomllib
520+ try :
521+ import tomllib
522+ except ModuleNotFoundError : # Python 3.10 (requires-python >= 3.10)
523+ import tomli as tomllib
521524
522525 pyproject = Path (__file__ ).parent .parent / "pyproject.toml"
523526 with open (pyproject , "rb" ) as f :
@@ -530,7 +533,10 @@ def test_package_data_includes_py_typed(self):
530533 """pyproject.toml should have package-data config for py.typed."""
531534 from pathlib import Path
532535
533- import tomllib
536+ try :
537+ import tomllib
538+ except ModuleNotFoundError : # Python 3.10 (requires-python >= 3.10)
539+ import tomli as tomllib
534540
535541 pyproject = Path (__file__ ).parent .parent / "pyproject.toml"
536542 with open (pyproject , "rb" ) as f :
You can’t perform that action at this time.
0 commit comments