oakmac / standard-clojure-style-js

Standard Clojure Style in JavaScript
ISC License
33 stars 1 forks source link

Formatter throws exception when formatting namespaces with `(:import)` directive #93

Closed alexandercampbell closed 1 month ago

alexandercampbell commented 1 month ago

Minimum repro case:

Create a file named example.clj:

(ns example (:import [org.example ExampleClass]))

Run formatter on example.clj:

~/workspace/standard-clojure-style-js 1 λ g rev-parse HEAD
c97813464d2b6a70524e457774b5823e61ef1af3

~/workspace/standard-clojure-style-js 0 λ node cli.mjs fix example.clj
standard-clj fix [dev]

E /example.clj - Object.hasOwn is not a function [3.08ms]

0 files formatted with Standard Clojure Style
1 files with errors
Checked 1 files. [14.61ms]

This issue is present on the current release (0.4.0) and was also present on 0.3.0.

oakmac commented 1 month ago

Thank you for the report! This is caused by the lack of the Object.hasOwn function in your JavaScript runtime. I need to adjust this function to work everywhere.

alexandercampbell commented 1 month ago

Ah, that's interesting. Thank you very much for the quick response. It didn't occur to me that I was on an old version of node on this machine (v14.19.0 LTS). I've now upgraded to Node 22.9.0.

oakmac commented 1 month ago

Fixed with PR-95

oakmac commented 1 month ago

Fixed with v0.4.1 :+1: