Skip to content

Commit

Permalink
chore: bump all (dev)Dependencies, update related usage (#218)
Browse files Browse the repository at this point in the history
  • Loading branch information
JounQin committed Aug 18, 2022
1 parent 802f7b8 commit 0afd4d7
Show file tree
Hide file tree
Showing 18 changed files with 2,653 additions and 1,106 deletions.
5 changes: 5 additions & 0 deletions .changeset/strange-ravens-switch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"prettier-plugin-sql": major
---

chore(deps): bump `sql-formatter@v9`
5 changes: 5 additions & 0 deletions .changeset/tame-maps-rhyme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"prettier-plugin-pkg": minor
---

feat: support `maintainers`/`sponsor` fields
17 changes: 3 additions & 14 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,18 +1,7 @@
{
"root": true,
"extends": "@1stg",
"overrides": [
{
"files": ".github/*.yml",
"rules": {
"unicorn/filename-case": "off"
}
},
{
"files": "docs/**/*.tsx",
"rules": {
"react/react-in-jsx-scope": "off"
}
}
]
"rules": {
"react/react-in-jsx-scope": "off"
}
}
2 changes: 2 additions & 0 deletions .github/workflows/pkg-size.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,7 @@ jobs:

- name: Package Size Report
uses: pkg-size/action@v1
with:
build-command: pnpm build
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ dist
lib
node_modules
packages/*/src/languages.ts
yarn.lock
3 changes: 1 addition & 2 deletions .remarkrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"plugins": [
"@1stg/remark-config",
"gfm"
"@1stg/preset"
]
}
38 changes: 20 additions & 18 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@
"workspaces": [
"packages/*"
],
"packageManager": "pnpm@7.7.0",
"packageManager": "pnpm@7.9.0",
"scripts": {
"build": "run-p build:*",
"build:r": "r -f cjs",
"build:ts": "tsc -b",
"clean": "rimraf dist coverage 'packages/*/{lib,*.tsbuildinfo}'",
"codesandbox:install": "npx pnpm@7.7.0 i",
"codesandbox:install": "yarn",
"dev": "vitest",
"docs:build": "w -e docs -p --publicPath /",
"docs:dev": "w -e docs --disableDotRule --publicPath /",
Expand All @@ -35,34 +35,36 @@
"vercel-build": "pnpm docs:build"
},
"devDependencies": {
"@1stg/app-config": "^6.1.5",
"@1stg/lib-config": "^9.0.2",
"@1stg/app-config": "^7.1.0",
"@1stg/lib-config": "^10.0.0",
"@changesets/changelog-github": "^0.4.6",
"@changesets/cli": "^2.24.1",
"@pkgr/webpack-mdx": "^2.0.3",
"@types/lodash": "^4.14.182",
"@changesets/cli": "^2.24.3",
"@pkgr/webpack-mdx": "^2.1.0",
"@types/lodash": "^4.14.183",
"@types/mvdan-sh": "^0.10.0",
"@types/prettier": "^2.6.4",
"@types/react": "^18.0.15",
"@types/prettier": "^2.7.0",
"@types/react": "^18.0.17",
"@types/react-dom": "^18.0.6",
"@types/web": "^0.0.70",
"c8": "^7.12.0",
"@types/web": "^0.0.71",
"@vitest/coverage-istanbul": "^0.22.0",
"github-markdown-css": "^5.1.0",
"linguist-languages": "^7.21.0",
"lodash": "^4.17.21",
"prettier-plugin-pkg": "workspace:*",
"prettier-plugin-sh": "workspace:*",
"prettier-plugin-sql": "workspace:*",
"prettier-plugin-pkg": "link:packages/pkg",
"prettier-plugin-sh": "link:packages/sh",
"prettier-plugin-sql": "link:packages/sql",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-router-dom": "^6.3.0",
"remark-gfm": "^3.0.1",
"sirv-cli": "^2.0.2",
"tsx": "^3.8.0",
"tsx": "^3.8.2",
"type-coverage": "^2.22.0",
"typescript": "^4.7.4",
"unplugin-auto-import": "^0.10.2",
"vitest": "^0.19.1"
"unplugin-auto-import": "^0.11.1",
"vitest": "^0.22.0"
},
"resolutions": {
"prettier": "^2.7.1"
},
"browserslist": [
"extends @1stg/browserslist-config/modern"
Expand Down
8 changes: 5 additions & 3 deletions packages/pkg/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ Top-level keys are sorted according to a style commonly seen in the packages of
// meta
"name",
"version",
"preview",
"type",
"flat",
"displayName",
Expand All @@ -68,9 +67,12 @@ Top-level keys are sorted according to a style commonly seen in the packages of
"repository",
"homepage",
"bugs",
"donate",
"funding",
"sponsor",
"author",
"publisher",
"maintainers",
"contributors",
"license",
"preview",
Expand All @@ -84,7 +86,7 @@ Top-level keys are sorted according to a style commonly seen in the packages of
"cpu",
"os",

// entry
// entries
"man",
"bin",
"main",
Expand All @@ -109,7 +111,7 @@ Top-level keys are sorted according to a style commonly seen in the packages of
"typings",
"typesVersions",

// content and util
// contents and utils
"directories",
"files",
"keywords",
Expand Down
7 changes: 4 additions & 3 deletions packages/pkg/src/rules/sort.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ const primary = [
// meta
'name',
'version',
'preview',
'type',
'flat',
'displayName',
Expand All @@ -43,9 +42,11 @@ const primary = [
'bugs',
'author',
'publisher',
'maintainers',
'contributors',
'donate',
'funding',
'sponsor',
'license',
'preview',
'private',
Expand All @@ -58,7 +59,7 @@ const primary = [
'cpu',
'os',

// entry
// entries
'man',
'bin',
'main',
Expand All @@ -83,7 +84,7 @@ const primary = [
'typings',
'typesVersions',

// content and util
// contents and utils
'directories',
'files',
'keywords',
Expand Down
1 change: 0 additions & 1 deletion packages/pkg/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import type { ObjectProperty, StringLiteral } from './types.js'
export function alphabetSort(a: number, b: number): number
export function alphabetSort(a: string, b: string): number
export function alphabetSort(a: number | string, b: number | string) {
/* c8 ignore next */
return a > b ? 1 : a < b ? -1 : 0
}

Expand Down
4 changes: 2 additions & 2 deletions packages/sh/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@
},
"dependencies": {
"mvdan-sh": "^0.10.1",
"sh-syntax": "^0.3.6",
"synckit": "^0.8.1"
"sh-syntax": "^0.3.7",
"synckit": "^0.8.3"
},
"publishConfig": {
"access": "public"
Expand Down
7 changes: 1 addition & 6 deletions packages/sh/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import { createSyncFn } from 'synckit'

import { languages } from './languages.js'

/* c8 ignore next 4 */
const _dirname =
typeof __dirname === 'undefined'
? path.dirname(fileURLToPath(import.meta.url))
Expand Down Expand Up @@ -76,7 +75,7 @@ class ShSyntaxParseError<

constructor(err: E) {
const error = err as ParseError | SyntaxError
super(/* c8 ignore next */ ('Text' in error && error.Text) || error.message)
super(('Text' in error && error.Text) || error.message)
this.cause = err
// `error instanceof ParseError` won't not work because the error is thrown wrapped by `synckit`
if ('Pos' in error && error.Pos != null && typeof error.Pos === 'object') {
Expand Down Expand Up @@ -118,7 +117,6 @@ const ShPlugin: Plugin<Node | ShSyntaxNode> = {

const parserOptions = [syntax.KeepComments(keepComments)]

/* c8 ignore next 8 */
if (stopAt != null) {
parserOptions.push(syntax.StopAt(stopAt))
}
Expand All @@ -135,10 +133,8 @@ const ShPlugin: Plugin<Node | ShSyntaxNode> = {
},
astFormat: 'sh',
locStart: node =>
/* c8 ignore next */
isFunction(node.Pos) ? node.Pos().Offset() : node.Pos.Offset,
locEnd: node =>
/* c8 ignore next */
isFunction(node.End) ? node.End().Offset() : node.End.Offset,
},
},
Expand All @@ -151,7 +147,6 @@ const ShPlugin: Plugin<Node | ShSyntaxNode> = {
filepath,
useTabs,
tabWidth,
/* c8 ignore next */
indent = useTabs ? 0 : tabWidth,
binaryNextLine = true,
switchCaseIndent = true,
Expand Down
2 changes: 1 addition & 1 deletion packages/sql/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
},
"dependencies": {
"node-sql-parser": "^4.4.0",
"sql-formatter": "^8.2.0",
"sql-formatter": "^9.2.0",
"tslib": "^2.4.0"
},
"publishConfig": {
Expand Down
61 changes: 30 additions & 31 deletions packages/sql/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import nodeSqlParser, { type AST, type Option } from 'node-sql-parser'
import type { Options, ParserOptions, Plugin } from 'prettier'
import { format, type FormatFnOptions } from 'sql-formatter'
import { format, Formatter, type FormatOptions } from 'sql-formatter'

import { languages } from './languages.js'

Expand All @@ -16,7 +16,7 @@ const ENDINGS = {
} as const

export type SqlBaseOptions = Option &
Partial<FormatFnOptions> & {
Partial<FormatOptions> & {
formatter?: typeof NODE_SQL_PARSER | typeof SQL_FORMATTER
}

Expand Down Expand Up @@ -54,7 +54,6 @@ const SqlPlugin: Plugin<AST | string> = {

formatted = formatted.replace(/\r\n?|\n/g, ending)

/* c8 ignore next */
return formatted.endsWith(ending) ? formatted : formatted + ending
},
},
Expand Down Expand Up @@ -119,15 +118,29 @@ const SqlPlugin: Plugin<AST | string> = {
description:
'Amazon Redshift: https://docs.aws.amazon.com/redshift/latest/dg/cm_chap_SQLCommandRef.html',
},
{
value: 'singlestoredb',
description:
'SingleStoreDB: https://docs.singlestore.com/db/v7.8/en/introduction/singlestore-documentation.html',
},
{
value: 'spark',
description: 'Spark: https://spark.apache.org',
},
{
value: 'trino',
description: 'Trino: https://trino.io',
},
{
value: 'tsql',
description:
'SQL Server Transact-SQL: https://docs.microsoft.com/en-us/sql/sql-server/',
},
{
since: '0.11.0',
value: Formatter,
description: 'Custom formatter class (experimental)',
},
],
},
keywordCase: {
Expand Down Expand Up @@ -205,33 +218,6 @@ const SqlPlugin: Plugin<AST | string> = {
},
],
},
aliasAs: {
since: '0.7.0',
category: 'Format',
type: 'choice',
default: 'preserve',
description:
'Enforces consistent use of `AS` keywords in alias declarations for `sql-formatter`',
choices: [
{
value: 'preserve',
description: 'does nothing',
},
{
value: 'always',
description: 'enforces `AS` usage for all aliases',
},
{
value: 'never',
description: 'forbids `AS` usage for all aliases',
},
{
value: 'select',
description:
'enforces `AS` usage in column aliases of `SELECT` and forbids it for table name aliases',
},
],
},
tabulateAlias: {
since: '0.7.0',
category: 'Format',
Expand Down Expand Up @@ -312,7 +298,6 @@ const SqlPlugin: Plugin<AST | string> = {
'`Object` of name-value pairs for named (and indexed) placeholders',
},
],
/* c8 ignore next 11 */
// @ts-expect-error
exception(value: unknown) {
return (
Expand All @@ -325,6 +310,20 @@ const SqlPlugin: Plugin<AST | string> = {
)
},
},
paramTypes: {
since: '0.11.0',
category: 'Config',
type: 'choice',
description:
'Specifies parameter types to support when parsing SQL prepared statements for `sql-formatter`.',
choices: [
{
value: Object,
description:
'Specifies parameter types to support when parsing SQL prepared statements.',
},
],
},
type: {
since: '0.1.0',
category: 'Config',
Expand Down
2 changes: 1 addition & 1 deletion packages/sql/test/__snapshots__/fixtures.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ WITH
`;

exports[`parser and printer > should format all fixtures > basic.sql 1`] = `
"-- this is a comment
" -- this is a comment
SELECT
*
FROM
Expand Down

0 comments on commit 0afd4d7

Please sign in to comment.