Comments (7)
Good idea, I'm happy to open a pr tomorrow with those changes (it's late UK time right now)
from prettier.
Would you like to raise a PR which will be appreciated!
from prettier.
Happy to help, however I don't have a proper fix yet other than directly modifying the bundled code. I think it might be a rollup config issue, I will spend some more time looking into how rollup is setup here
from prettier.
prettier/packages/sql/shim.d.ts
Line 2 in 3d85966
It needs to be changed to
const JSOX = typeof JSON
export = JSOX
And the ESM version should be changed accordingly.
You can juat raise the PR and I'll review and guide to finish.
from prettier.
https://github.com/d3x0r/JSOX/blob/44d2c55a1f0cfaf60f4b7f07f8565420f05498d0/package.jsox#L20-L24
https://github.com/d3x0r/JSOX/blob/44d2c55a1f0cfaf60f4b7f07f8565420f05498d0/lib/jsox.mjs#L3018
Interesting. This means it's an upstream issue actually...
cc @d3x0r
from prettier.
prettier/packages/sql/shim.d.ts
Line 2 in 3d85966
It needs to be changed to
const JSOX = typeof JSON export = JSOXAnd the ESM version should be changed accordingly.
You can juat raise the PR and I'll review and guide to finish.
Yep I tried this locally when I was investigating. It seems like import { JSOX } from 'jsox'
is valid and in CommonJS it's var jsox = require('jsox')
. I assumed they'd be something in roll up that could fix this for us. But you're right ideally it'd be fixed upstream
from prettier.
We need to support both of them at the same time.
// shim.d.ts
const JSOX: typeof JSON & { JSOX?: typeof JSON}
expot = JSOX
// index.ts
import * as _JSOX from 'jsox'
// workaround for inconsistent cjs/esm exports
const JSOX = _JSOX.JSOX || _JSOX
from prettier.
Related Issues (20)
- prettier-plugin-sql: Update to sql-formatter@14? HOT 2
- [prettier-plugin-toml] unable to format `toml` programmatically in an es module HOT 6
- prettier-plugin-sql: Allow `dialect` as alternative to `language` HOT 6
- Possibility of updating the license again? HOT 2
- prettier-plugin-sql: Upgrade to sql-formatter@15 HOT 1
- Idea: `eslint` as a plugin for `prettier` HOT 1
- prettier-plugin-sh fails to format standard VisualStudio.gitignore file HOT 1
- [prettier-plugin-sh] Incorrectly splits RUN command HOT 5
- prettier-plugin-sh: support .nvmrc files? HOT 7
- [prettier-plugin-sh]: automatic parser detection for `.husky/*` files. HOT 1
- [warn] embeddedSqlIdentifiers is deprecated. HOT 1
- Is there an SQL Server version of prettier-plugin-sql plugin? HOT 1
- [prettier-plugin-toml]: do not add tailing comma to one-line object
- Project-level config `prettier-plugin-sql` HOT 1
- [prettier-plugin-sql] Broken indentation formatting in vscode HOT 3
- [prettier-plugin-sql] doesn't support esmodule out of box ? HOT 3
- Feature Request: Add support for Containerfile HOT 1
- Dockerfile/Containerfile formatting issues with for loops/semicolons and `RUN <<EOF`
- [prettier-plugin-sh] `requirePragma` Option Not Respected
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from prettier.