Skip to content

Commit

Permalink
WIP WIP WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
oakmac committed Dec 2, 2024
1 parent 5544e13 commit 689024f
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 2 deletions.
2 changes: 2 additions & 0 deletions lib/standard-clojure-style.js
Original file line number Diff line number Diff line change
Expand Up @@ -2127,6 +2127,7 @@
} else if (idx > requireNodeIdx && insideRequireForm && isTokenNode2 && isReferKeyword(node)) {
referIdx = idx
referParenNestingDepth = parenNestingDepth
console.log('AAAAAAAAA')

// is this :require :default ?
} else if (idx > requireNodeIdx && insideRequireForm && isTokenNode2 && isDefaultKeyword(node)) {
Expand All @@ -2153,6 +2154,7 @@
// collect :refer :all
} else if (idx > referIdx && insideRequireForm && isTokenNode2 && isAllNode(node)) {
result.requires[activeRequireIdx].refer = 'all'
console.log('BBBBBBBBBB')

// collect :refer :default symbol
} else if (idx > referIdx && insideRequireForm && isTokenNode2 && nextTokenIsRequireDefaultSymbol) {
Expand Down
4 changes: 2 additions & 2 deletions test/parse_ns.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ test('All test_parse_ns/ cases should have unique names', () => {

// dev convenience: set this to true and add specific test cases
// only those cases will run
const onlyRunSpecificTests = false
const onlyRunSpecificTests = true
const specificTests = new Set()
// specificTests.add('your test case here')
specificTests.add('GitHub Issue #166 - :require :refer :all bug')

const ignoreSomeTests = false
const ignoreTests = new Set()
Expand Down
27 changes: 27 additions & 0 deletions test_parse_ns/parse_ns.eno
Original file line number Diff line number Diff line change
Expand Up @@ -2916,3 +2916,30 @@
]
}
--Expected

# GitHub Issue #166 - :require :refer :all bug

> https://github.com/oakmac/standard-clojure-style-js/issues/166

--Input
(ns com.example.my-app
(:require [other :refer :all :rename {foo bar}]))
--Input

--Expected
{
"nsSymbol": "com.example.my-app",
"requires": [
{
"symbol": "other",
"refer": "all",
"rename": [
{
"fromSymbol": "foo",
"toSymbol": "bar"
}
]
}
]
}
--Expected

0 comments on commit 689024f

Please sign in to comment.