Git Product home page Git Product logo

Comments (6)

Sec-ant avatar Sec-ant commented on July 29, 2024 1

No longer needed, thanks for your work!

from prettier.

Sec-ant avatar Sec-ant commented on July 29, 2024

Here is one possible way to address our concern without needing to many changes or dev burden, if it is acceptable to you.

So we can use the named export ReadonlySqlPlugin in our plugin to extract all the supported choices of language and database.

diff --git a/packages/sql/src/index.ts b/packages/sql/src/index.ts
index 81ceb70..84511b4 100644
--- a/packages/sql/src/index.ts
+++ b/packages/sql/src/index.ts
@@ -5,6 +5,7 @@ import type { AST, Option } from 'node-sql-parser'
 import nodeSqlParser from 'node-sql-parser'
 import type { Options, ParserOptions, Plugin } from 'prettier'
 import { format, type FormatOptions } from 'sql-formatter'
+import type { ReadonlyDeep } from 'type-fest'
 
 import { languages } from './languages.js'
 
@@ -32,7 +33,7 @@ export type SqlOptions = ParserOptions<AST> & SqlBaseOptions
 
 export type SqlFormatOptions = Options & SqlBaseOptions
 
-const SqlPlugin: Plugin<AST | string> = {
+export const ReadonlySqlPlugin = {
   languages,
   parsers: {
     sql: {
@@ -413,6 +414,6 @@ const SqlPlugin: Plugin<AST | string> = {
       ],
     },
   },
-}
+} as const satisfies ReadonlyDeep<Plugin<AST | string>>
 
-export default SqlPlugin
+export default ReadonlySqlPlugin as unknown as Plugin<AST | string>

from prettier.

JounQin avatar JounQin commented on July 29, 2024

I'll take a look soon.

from prettier.

JounQin avatar JounQin commented on July 29, 2024

https://github.com/Sec-ant/prettier-plugin-embed/blob/2c2efc50ba500189f809317dfc44bfee505411d8/src/embedded/sql/options.ts#L15-L46

I think this should reopen?

Or you should access them via SqlPlugin.options:

from prettier.

Sec-ant avatar Sec-ant commented on July 29, 2024

I think I can just use several common names as the default identifiers: https://github.com/Sec-ant/prettier-plugin-embed/blob/2c2efc50ba500189f809317dfc44bfee505411d8/src/embedded/sql/options.ts#L69

And those export types are not actually used anywhere. I should update that part of the code.

from prettier.

JounQin avatar JounQin commented on July 29, 2024

And those export types are not actually used anywhere. I should update that part of the code.

Good to know.

from prettier.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.