Skip to content

Commit 8641a84

Browse files
authored
Switch from flatKeywordList() to flat arrays (#676)
Part of preparations for PR #673 Copied from [my original comment](#673 (comment)): I see there is no distinction in the keyword tokens between `all` and `dataType` / `datatype` / `dataTypes`: https://github.com/sql-formatter-org/sql-formatter/blob/290f3b767492d5e3204866447f9f4e4c098f825f/src/languages/postgresql/postgresql.keywords.ts#L4-L8 https://github.com/sql-formatter-org/sql-formatter/blob/290f3b767492d5e3204866447f9f4e4c098f825f/src/languages/transactsql/transactsql.functions.ts#L78-L83 https://github.com/sql-formatter-org/sql-formatter/blob/290f3b767492d5e3204866447f9f4e4c098f825f/src/languages/snowflake/snowflake.keywords.ts#L102-L106 https://github.com/sql-formatter-org/sql-formatter/blob/290f3b767492d5e3204866447f9f4e4c098f825f/src/languages/transactsql/transactsql.functions.ts#L303-L309 This is because of the `flatKeywordList()` function, which effectively discards the key information: https://github.com/sql-formatter-org/sql-formatter/blob/290f3b767492d5e3204866447f9f4e4c098f825f/src/utils.ts#L18-L20 Because of this, I would like to simplify the `src/languages/*/*.keywords.ts` files to export 1 flat array (with empty lines + comments as separators instead of object keys) and delete the `flatKeywordList()` function - this will prevent unusual, inconsistent naming conventions and also clarify that the object keys do nothing. ## Reviewer notes 1. Best to review this with whitespace changes turned off: https://github.com/sql-formatter-org/sql-formatter/pull/676/files?w=1 2. This PR also enables GitHub Actions workflows CI for pull requests on branches other than `master` and `develop`, so that PRs from community members can be tested on GitHub Actions 3. while removing the object keys, I added comments as such: a. if there was a commented URL above the key, I removed the key and left the URL as the sole comment (eg. in `src/languages/db2i/db2i.functions.ts`) b. if there was no other comment (or if the commented URL was generic, for multiple sections), I left the key name as the comment (eg. in `src/languages/hive/hive.functions.ts`)
2 parents 7978ec3 + 08d9a09 commit 8641a84

37 files changed

+10866
-10778
lines changed

.github/workflows/coveralls.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ jobs:
1313
node-version: [18.x]
1414

1515
steps:
16-
- uses: actions/checkout@v2
16+
- uses: actions/checkout@v4
1717

1818
- name: Use Node.js ${{ matrix.node-version }}
19-
uses: actions/setup-node@v1
19+
uses: actions/setup-node@v4
2020
with:
2121
node-version: ${{ matrix.node-version }}
2222

.github/workflows/webpack.yaml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ name: webpack
22

33
on:
44
pull_request:
5-
branches: [master, develop]
65

76
jobs:
87
build:
@@ -13,10 +12,10 @@ jobs:
1312
node-version: [18.x]
1413

1514
steps:
16-
- uses: actions/checkout@v2
15+
- uses: actions/checkout@v4
1716

1817
- name: Use Node.js ${{ matrix.node-version }}
19-
uses: actions/setup-node@v1
18+
uses: actions/setup-node@v4
2019
with:
2120
node-version: ${{ matrix.node-version }}
2221

0 commit comments

Comments
 (0)