Skip to content

Commit

Permalink
feat!: bump cosmiconfig and sql-formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
JounQin committed Apr 8, 2023
1 parent 144f47f commit 880ba47
Show file tree
Hide file tree
Showing 25 changed files with 6,566 additions and 8,917 deletions.
5 changes: 5 additions & 0 deletions .changeset/dull-gorillas-sniff.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'prettier-plugin-autocorrect': minor
---

feat!: bump cosmiconfig
5 changes: 5 additions & 0 deletions .changeset/strange-wombats-smash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'prettier-plugin-sql': minor
---

feat!: bump sql-formatter
2 changes: 2 additions & 0 deletions .stylelintignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ LICENSE
*.png
*.snap
*.svg
*.ts
*.tsbuildinfo
*.tsx
*.yaml
*.yml
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

- [prettier-plugin-autocorrect](./packages/autocorrect/CHANGELOG.md)
- [prettier-plugin-pkg](./packages/pkg/CHANGELOG.md)
- [prettier-plugin-sh](./packages/sh/CHANGELOG.md)
- [prettier-plugin-sql](./packages/sql/CHANGELOG.md)
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# @unts/prettier

[![GitHub Actions](https://github.com/un-ts/prettier/workflows/Node%20CI/badge.svg)](https://github.com/un-ts/prettier/actions?query=workflow%3A%22Node+CI%22)
[![Language grade: JavaScript](https://img.shields.io/lgtm/grade/javascript/g/un-ts/prettier.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/un-ts/prettier/context:javascript)
[![Codecov](https://img.shields.io/codecov/c/gh/un-ts/prettier)](https://codecov.io/gh/un-ts/prettier)
[![type-coverage](https://img.shields.io/badge/dynamic/json.svg?label=type-coverage&prefix=%E2%89%A5&suffix=%&query=$.typeCoverage.atLeast&uri=https%3A%2F%2Fraw.githubusercontent.com%2Fun-ts%2Fprettier%2Fmaster%2Fpackage.json)](https://github.com/plantain-00/type-coverage)
[![GitHub release](https://img.shields.io/github/release/un-ts/prettier)](https://github.com/un-ts/prettier/releases)
Expand All @@ -18,11 +17,12 @@

This repository is a monorepo managed by [changesets][] what means we actually publish several packages to npm from same codebase, including:

| Package | Description | Version |
| -------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- |
| [`prettier-plugin-pkg`](/packages/pkg) | An opinionated package.json formatter plugin for Prettier | [![npm](https://img.shields.io/npm/v/prettier-plugin-pkg.svg)](https://www.npmjs.com/package/prettier-plugin-pkg) |
| [`prettier-plugin-sh`](/packages/sh) | An opinionated `shellscript` formatter plugin for Prettier, also support simple format of `Dockerfile`, `properties`, `gitignore`, `dotenv`, `hosts`, `jvmoptions`... | [![npm](https://img.shields.io/npm/v/prettier-plugin-sh.svg)](https://www.npmjs.com/package/prettier-plugin-sh) |
| [`prettier-plugin-sql`](/packages/sql) | An opinionated sql formatter plugin for Prettier | [![npm](https://img.shields.io/npm/v/prettier-plugin-sql.svg)](https://www.npmjs.com/package/prettier-plugin-sql) |
| Package | Description | Version |
| ------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------- |
| [`prettier-plugin-autocorrect`](/packages/autocorrect) | An opinionated copywriting formatter plugin for Prettier | [![npm](https://img.shields.io/npm/v/prettier-plugin-autocorrect.svg)](https://www.npmjs.com/package/prettier-plugin-autocorrect) |
| [`prettier-plugin-pkg`](/packages/pkg) | An opinionated package.json formatter plugin for Prettier | [![npm](https://img.shields.io/npm/v/prettier-plugin-pkg.svg)](https://www.npmjs.com/package/prettier-plugin-pkg) |
| [`prettier-plugin-sh`](/packages/sh) | An opinionated `shellscript` formatter plugin for Prettier, also support simple format of `Dockerfile`, `properties`, `gitignore`, `dotenv`, `hosts`, `jvmoptions`... | [![npm](https://img.shields.io/npm/v/prettier-plugin-sh.svg)](https://www.npmjs.com/package/prettier-plugin-sh) |
| [`prettier-plugin-sql`](/packages/sql) | An opinionated sql formatter plugin for Prettier | [![npm](https://img.shields.io/npm/v/prettier-plugin-sql.svg)](https://www.npmjs.com/package/prettier-plugin-sql) |

## Sponsors

Expand Down
5 changes: 4 additions & 1 deletion auto-imports.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
// Generated by 'unplugin-auto-import'
/* eslint-disable */
/* prettier-ignore */
// @ts-nocheck
// Generated by unplugin-auto-import
export {}
declare global {
const afterAll: typeof import('vitest')['afterAll']
Expand Down
22 changes: 22 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta
http-equiv="X-UA-Compatible"
content="IE=edge"
/>
<meta
name="viewport"
content="width=device-width, initial-scale=1.0"
/>
<title>Vitery</title>
</head>
<body>
<div id="app"></div>
<script
type="module"
src="./docs/index.tsx"
></script>
</body>
</html>
61 changes: 33 additions & 28 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@
"workspaces": [
"packages/*"
],
"packageManager": "pnpm@7.14.2",
"packageManager": "pnpm@8.1.1",
"scripts": {
"build": "run-p build:*",
"build:r": "r -f cjs",
"build:ts": "tsc -b",
"clean": "rimraf dist coverage 'packages/*/{lib,*.tsbuildinfo}'",
"codesandbox:install": "yarn",
"dev": "vitest",
"docs:build": "w -e docs -p --publicPath /",
"docs:dev": "w -e docs --disableDotRule --publicPath /",
"docs:build": "vite build",
"docs:dev": "vite dev",
"format": "tsx scripts/format",
"languages": "tsx scripts/languages",
"lint": "run-p lint:*",
Expand All @@ -35,19 +35,21 @@
"vercel-build": "pnpm docs:build"
},
"devDependencies": {
"@1stg/app-config": "^7.2.1",
"@1stg/lib-config": "^10.2.1",
"@1stg/app-config": "^8.0.1",
"@1stg/lib-config": "^11.0.1",
"@changesets/changelog-github": "^0.4.8",
"@changesets/cli": "^2.24.4",
"@pkgr/webpack-mdx": "^2.2.0",
"@types/lodash": "^4.14.191",
"@changesets/cli": "^2.26.1",
"@mdx-js/rollup": "^2.3.0",
"@types/lodash": "^4.14.192",
"@types/mvdan-sh": "^0.10.0",
"@types/prettier": "^2.7.0",
"@types/react": "^18.0.26",
"@types/react-dom": "^18.0.10",
"@types/web": "^0.0.72",
"@vitest/coverage-istanbul": "^0.23.1",
"github-markdown-css": "^5.1.0",
"@types/node": "^18.15.11",
"@types/prettier": "^2.7.2",
"@types/react": "^18.0.33",
"@types/react-dom": "^18.0.11",
"@types/web": "^0.0.99",
"@vitejs/plugin-react-swc": "^3.2.0",
"@vitest/coverage-istanbul": "^0.29.8",
"github-markdown-css": "^5.2.0",
"linguist-languages": "^7.21.0",
"lodash": "^4.17.21",
"prettier-plugin-autocorrect": "link:packages/autocorrect",
Expand All @@ -56,18 +58,21 @@
"prettier-plugin-sql": "link:packages/sql",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-router-dom": "^6.3.0",
"react-router-dom": "^6.10.0",
"remark-gfm": "^3.0.1",
"sass": "^1.61.0",
"sirv-cli": "^2.0.2",
"size-limit": "^8.0.1",
"size-limit-preset-node-lib": "^0.1.0",
"tsx": "^3.9.0",
"type-coverage": "^2.22.0",
"typescript": "^4.8.2",
"unplugin-auto-import": "^0.11.2",
"vitest": "^0.23.1"
"size-limit": "^8.2.4",
"size-limit-preset-node-lib": "^0.2.0",
"tsx": "^3.12.6",
"type-coverage": "^2.25.0",
"typescript": "^5.0.4",
"unplugin-auto-import": "^0.15.2",
"vite": "^4.2.1",
"vitest": "^0.29.8"
},
"resolutions": {
"prettier": "^2.7.1"
"prettier": "^2.8.7"
},
"browserslist": [
"extends @1stg/browserslist-config/modern"
Expand All @@ -84,21 +89,21 @@
"packages/**/lib",
"packages/**/CHANGELOG.md",
"packages/*/src/languages.ts",
"/auto-imports.d.ts",
"/pnpm-lock.yaml",
"!/.github",
"!/.*.js"
],
"pnpm": {
"overrides": {
"prettier": "^2.7.1"
}
},
"renovate": {
"extends": [
"@1stg"
]
},
"size-limit": [
{
"path": "packages/autocorrect/lib/index.js",
"limit": "460B"
},
{
"path": "packages/pkg/lib/index.js",
"limit": "460B"
Expand Down
6 changes: 3 additions & 3 deletions packages/autocorrect/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# prettier-plugin-autocorrect ![npm bundle size](https://img.shields.io/bundlephobia/min/prettier-plugin-autocorrect) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/prettier-plugin-autocorrect)

> An opinionated sql formatter plugin for [Prettier][]
> An opinionated copywriting formatter plugin for [Prettier][]
Prettier is an opinionated code formatter. It enforces a consistent style by parsing your code and re-printing, taking various rules into account.

Expand Down Expand Up @@ -33,10 +33,10 @@ Once installed, [Prettier plugins](https://prettier.io/docs/en/plugins.html) sho

```sh
# npx
npx prettier --write db.sql
npx prettier --write writing.md

# yarn
yarn prettier --write db.sql
yarn prettier --write writing.md
```

## Sponsors
Expand Down
8 changes: 4 additions & 4 deletions packages/autocorrect/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@
"prettier": "^2.0.0"
},
"dependencies": {
"autocorrect-node": "^2.4.3",
"cosmiconfig": "^7.0.1",
"synckit": "^0.8.4",
"tslib": "^2.4.0"
"autocorrect-node": "^2.6.2",
"cosmiconfig": "^8.1.3",
"synckit": "^0.8.5",
"tslib": "^2.5.0"
},
"publishConfig": {
"access": "public"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Vitest Snapshot v1
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html

exports[`parser and printer > should format all fixtures > test.css 1`] = `
"/*
Expand Down
2 changes: 1 addition & 1 deletion packages/pkg/test/__snapshots__/engines.spec.ts.snap
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Vitest Snapshot v1
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html

exports[`engines 1`] = `
"{
Expand Down
2 changes: 1 addition & 1 deletion packages/pkg/test/__snapshots__/files.spec.ts.snap
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Vitest Snapshot v1
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html

exports[`files 1`] = `
"{
Expand Down
4 changes: 2 additions & 2 deletions packages/pkg/test/__snapshots__/test.spec.ts.snap
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Vitest Snapshot v1
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html

exports[`preprocess 1`] = `
"{
Expand Down Expand Up @@ -72,7 +72,7 @@ exports[`randomize 1`] = `
},
\\"resolutions\\": {
\\"@babel/core\\": \\"^7.9.0\\",
\\"@babel/preset-env\\": \\"^7.9.5\\",
\\"@babel/preset-env\\": \\"^7.12.1\\",
\\"eslint-plugin-prettier\\": \\"^3.1.2\\",
\\"imagemin-gifsicle\\": \\"^6.0.1\\",
\\"prettier\\": \\"^2.0.4\\",
Expand Down
2 changes: 1 addition & 1 deletion packages/pkg/test/fixtures/fixture1.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"@babel/core": "^7.9.0",
"typescript": "^3.8.3",
"prettier": "^2.0.4",
"@babel/preset-env": "^7.9.5",
"@babel/preset-env": "^7.12.1",
"eslint-plugin-prettier": "^3.1.2"
},
"peerDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/sh/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"dependencies": {
"mvdan-sh": "^0.10.1",
"sh-syntax": "^0.3.7",
"synckit": "^0.8.4"
"synckit": "^0.8.5"
},
"publishConfig": {
"access": "public"
Expand Down
2 changes: 1 addition & 1 deletion packages/sh/test/__snapshots__/fixtures.spec.ts.snap
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Vitest Snapshot v1
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html

exports[`parser and printer > should format all fixtures > .dockerignore 1`] = `
"*.less.json
Expand Down
2 changes: 1 addition & 1 deletion packages/sh/test/__snapshots__/shellscript.spec.ts.snap
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Vitest Snapshot v1
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html

exports[`fatal parse error with meaningful message 1`] = `"a command can only contain words and redirects; encountered )"`;

Expand Down
1 change: 1 addition & 0 deletions packages/sql/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ interface SqlOptions {
| 'singlestoredb'
| 'spark'
| 'sqlite'
| 'transactsql'
| 'tsql'
| 'trino' // default `sql`
keywordCase: 'preserve' | 'upper' | 'lower' // default `preserve`
Expand Down
6 changes: 3 additions & 3 deletions packages/sql/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@
"prettier": "^2.0.0"
},
"dependencies": {
"node-sql-parser": "^4.4.0",
"sql-formatter": "^11.0.2",
"tslib": "^2.4.0"
"node-sql-parser": "^4.6.6",
"sql-formatter": "^12.2.0",
"tslib": "^2.5.0"
},
"publishConfig": {
"access": "public"
Expand Down
15 changes: 8 additions & 7 deletions packages/sql/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import nodeSqlParser, { type AST, type Option } from 'node-sql-parser'
import { type AST, type Option, Parser } from 'node-sql-parser'
import type { Options, ParserOptions, Plugin } from 'prettier'
import { format, Formatter, type FormatOptions } from 'sql-formatter'
import { format, type FormatOptions } from 'sql-formatter'

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

const parser = new nodeSqlParser.Parser()
const parser = new Parser()

const SQL_FORMATTER = 'sql-formatter'
const NODE_SQL_PARSER = 'node-sql-parser'
Expand All @@ -17,6 +17,7 @@ const ENDINGS = {

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

Expand Down Expand Up @@ -137,14 +138,14 @@ const SqlPlugin: Plugin<AST | string> = {
description: 'Trino: https://trino.io',
},
{
value: 'tsql',
value: 'transactsql',
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)',
value: 'tsql',
description:
'SQL Server Transact-SQL: https://docs.microsoft.com/en-us/sql/sql-server/',
},
],
},
Expand Down
5 changes: 2 additions & 3 deletions packages/sql/test/__snapshots__/fixtures.spec.ts.snap
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Vitest Snapshot v1
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html

exports[`parser and printer > should format all fixtures > 144.sql 1`] = `
"CREATE TABLE
Expand All @@ -17,8 +17,7 @@ FROM
WHERE
foo = 'bar';
UPDATE
a
UPDATE a
SET
id = 1
WHERE
Expand Down
2 changes: 1 addition & 1 deletion packages/sql/test/__snapshots__/sql.spec.ts.snap
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Vitest Snapshot v1
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html

exports[`node-sql-parser 1`] = `
"SELECT * FROM \`t\`
Expand Down

0 comments on commit 880ba47

Please sign in to comment.