Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: prettier outside eslint #1466

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"plugins": ["@malloydata/lint"],
"rules": {
"no-console": "warn",
"prettier/prettier": ["error", {"quoteProps": "preserve"}],
"prettier/prettier": ["off", {"quoteProps": "preserve"}],
"sort-keys": "off",
"no-duplicate-imports": "error",
"no-restricted-imports": [
Expand Down
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
build/
packages/malloy-malloy-sql/src/grammar
packages/malloy-syntax-highlight/**/*.monarch.ts
2 changes: 1 addition & 1 deletion .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"problemMatcher": ["$tsc-watch"],
"group": "build",
"label": "tsc-compile-watch",
"runOptions": { "runOn": "folderOpen" },
"runOptions": {"runOn": "folderOpen"},
"presentation": {
"reveal": "silent",
"revealProblems": "onProblem",
Expand Down
8 changes: 5 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
# Change Log
_Breaking changes indicated with *_

_Breaking changes indicated with \*_

We will use this space to highlight major and/or breaking changes to Malloy.

## v0.2.x

### VS Code helper view windows relocated

To improve discoverability and reduce extra clicking around in VS Code, we've relocated the Help, Connections, and Schema View Windows into the Explorer View. They will only appear when a `.malloy` file is opened.
To improve discoverability and reduce extra clicking around in VS Code, we've relocated the Help, Connections, and Schema View Windows into the Explorer View. They will only appear when a `.malloy` file is opened.

<img width="1365" alt="Screen Shot 2022-08-08 at 11 32 26 AM" src="https://user-images.githubusercontent.com/7178946/183488595-0c88591d-a162-4272-a937-e15261bf50c5.png">


## v0.0.10

### The apply operator is now ? and not :
Expand Down Expand Up @@ -43,6 +43,7 @@ sourceName { where: fieldName ? value1|value2 }
Prior to v0.0.9, lists of things were contained inside `[ ]`. Going forward, the brackets have been removed. Our hope is that this will be one less piece of punctuation to track, and will make it easier to change from a single item in a list to multiple without adding in brackets.

For example, this syntax:

```malloy
query: table('malloy-data.faa.airports') -> {
top: 10
Expand All @@ -64,6 +65,7 @@ query: table('malloy-data.faa.airports') -> {
```

Is now written:

```malloy
query: table('malloy-data.faa.airports') -> {
top: 10
Expand Down
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Malloy

Malloy is an experimental language for describing data relationships and transformations. It is both a semantic modeling language and a querying language that runs queries against a relational database. Malloy currently supports BigQuery and Postgres, as well as querying Parquet and CSV files via DuckDB.

### [Click here](https://github.dev/malloydata/try-malloy/airports.malloy) to try Malloy in your browser!
Expand All @@ -9,16 +10,16 @@ Malloy is an experimental language for describing data relationships and transfo

The easiest way to try Malloy is with our VS Code Extension, which provides a place to create Malloy models, execute queries, get help, and more. VS Code is a text editor and IDE (integrated development environment) that runs on your desktop or in your browser. A few ways to install the extension:

* [I already have VS Code](https://malloydata.github.io/documentation/setup/extension.html#using-the-malloy-extension-on-your-desktop)
* [I use BigQuery and Google Cloud](https://malloydata.github.io/documentation/setup/extension.html#using-the-malloy-extension-on-google-cloud-shell-editor).
* [I have a Github account and want to try Malloy on a `.csv` or `.parquet` file in a repository](https://malloydata.github.io/documentation/setup/extension.html#using-the-malloy-extension-on-github-dev).
- [I already have VS Code](https://malloydata.github.io/documentation/setup/extension.html#using-the-malloy-extension-on-your-desktop)
- [I use BigQuery and Google Cloud](https://malloydata.github.io/documentation/setup/extension.html#using-the-malloy-extension-on-google-cloud-shell-editor).
- [I have a Github account and want to try Malloy on a `.csv` or `.parquet` file in a repository](https://malloydata.github.io/documentation/setup/extension.html#using-the-malloy-extension-on-github-dev).

![show_run](https://user-images.githubusercontent.com/1093458/182458787-ca228186-c954-4a07-b298-f92dbf91e48d.gif)

To get to know the Malloy language, follow [our Quickstart](https://malloydata.github.io/documentation/user_guides/basic.html).

Note: The Malloy VSCode Extension tracks a small amount of anonymous usage data. You can opt out in the extension settings.
[Learn more](https://policies.google.com/technologies/cookies).
[Learn more](https://policies.google.com/technologies/cookies).

## Join the Community

Expand All @@ -44,6 +45,7 @@ To report security issues please see our [security policy](https://github.com/ma
Malloy is not an officially supported Google product.

## Syntax Example

Here is a simple example of a Malloy query:

```malloy
Expand All @@ -57,6 +59,7 @@ run: bigquery.table('malloy-data.faa.flights') -> {
```

In SQL this would be expressed:

```sql
SELECT
carrier,
Expand Down
2 changes: 1 addition & 1 deletion cloudbuild/build-test/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ set -euxo pipefail
nix-shell --quiet --pure --keep PGHOST --keep PGDATABASE --keep PGUSER --command "$(cat <<NIXCMD
set -euxo pipefail
npm ci --loglevel error
npm run lint && npm run build && npm run build-duckdb-db && npm run test-silent
npm run prettier-check && npm run lint && npm run build && npm run build-duckdb-db && npm run test-silent
NIXCMD
)"
38 changes: 19 additions & 19 deletions cloudbuild/deploy/cloudbuild.yaml
Original file line number Diff line number Diff line change
@@ -1,51 +1,51 @@
steps:
- id: git-ssh-key
name: "gcr.io/cloud-builders/gcloud"
secretEnv: ["GITHUB_SSH_KEY"]
entrypoint: "bash"
name: 'gcr.io/cloud-builders/gcloud'
secretEnv: ['GITHUB_SSH_KEY']
entrypoint: 'bash'
args:
- -c
- |
echo "$$GITHUB_SSH_KEY" >> /root/.ssh/id_rsa
chmod 400 /root/.ssh/id_rsa
cp cloudbuild/known_hosts.github /root/.ssh/known_hosts
volumes:
- name: "ssh"
- name: 'ssh'
path: /root/.ssh
- id: nix-quiet-install
name: gcr.io/cloud-builders/docker
args:
- pull
- "-q"
- '-q'
- nixos/nix:2.15.2
- id: proxy-install
name: "nixos/nix:2.15.2"
name: 'nixos/nix:2.15.2'
entrypoint: sh
args:
- -c
- "wget -q -O /workspace/cloud_sql_proxy https://dl.google.com/cloudsql/cloud_sql_proxy.linux.386 && chmod +x /workspace/cloud_sql_proxy"
waitFor: ["nix-quiet-install"]
- 'wget -q -O /workspace/cloud_sql_proxy https://dl.google.com/cloudsql/cloud_sql_proxy.linux.386 && chmod +x /workspace/cloud_sql_proxy'
waitFor: ['nix-quiet-install']
- id: deploy-npm
name: "nixos/nix:2.15.2"
name: 'nixos/nix:2.15.2'
entrypoint: sh
args:
- -c
- "(/workspace/cloud_sql_proxy -enable_iam_login -instances=malloy-303216:us-central1:pg-test=tcp:5432 -log_debug_stdout > /dev/null & sleep 2) && (./cloudbuild/deploy/$TRIGGER_NAME.sh)"
timeout: "1800s"
secretEnv: ["NPM_TOKEN", "GITHUB_SSH_KEY"]
- '(/workspace/cloud_sql_proxy -enable_iam_login -instances=malloy-303216:us-central1:pg-test=tcp:5432 -log_debug_stdout > /dev/null & sleep 2) && (./cloudbuild/deploy/$TRIGGER_NAME.sh)'
timeout: '1800s'
secretEnv: ['NPM_TOKEN', 'GITHUB_SSH_KEY']
env:
- "BRANCH_NAME=$BRANCH_NAME"
- 'BRANCH_NAME=$BRANCH_NAME'
volumes:
- name: "ssh"
- name: 'ssh'
path: /root/.ssh
waitFor: ["git-ssh-key", "proxy-install"]
waitFor: ['git-ssh-key', 'proxy-install']
options:
logging: CLOUD_LOGGING_ONLY
machineType: "E2_HIGHCPU_32"
timeout: "1800s"
machineType: 'E2_HIGHCPU_32'
timeout: '1800s'
availableSecrets:
secretManager:
- versionName: projects/malloy-303216/secrets/npm-publish/versions/latest
env: "NPM_TOKEN"
env: 'NPM_TOKEN'
- versionName: projects/malloy-303216/secrets/github-ssh-key/versions/latest
env: "GITHUB_SSH_KEY"
env: 'GITHUB_SSH_KEY'
8 changes: 7 additions & 1 deletion developing.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,13 @@ npm install
npm run build
```

Use the [VS Code ESLint extension](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) for code formatting, or run `npm run lint --fix`.
Use the [VS Code ESLint extension](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) for highlighting linter errors, or run `npm run lint --fix`.

Use the [VS Code Prettier extension](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) for code formatting, or run `npm run prettier-fix`.
To auto-format files on save:

1. Go to Settings > Workspace, search for "format on save", and turn "Editor: Format on Save" to on
2. Go to Settings > Workspace, search for "formatter", and set "Editor: Default formatter" to Prettier - Code formatter"

The tests can be run via the [VS Code Jest Runner extension](https://marketplace.visualstudio.com/items?itemName=firsttris.vscode-jest-runner). Alternatively, use `npm run test`, or a specific file, like `npm run test test/nomodel.spec.ts`.

Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
"lint-build": "npm run build -w packages/malloy -w packages/malloy-lint",
"lint": "npm run lint-build && gts lint",
"lint-fix": "npm run lint-build && gts fix",
"prettier-fix": "prettier . --write",
"prettier-check": "prettier . --check",
"test": "jest --runInBand",
"test-bigquery": "MALLOY_DATABASE=bigquery jest --runInBand",
"test-postgres": "MALLOY_DATABASE=postgres jest --runInBand",
Expand Down
2 changes: 1 addition & 1 deletion packages/malloy-interfaces/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Malloy Interfaces

This package contains most of the main definitions of the interfaces that are relevant for packages that implement Malloy Connections.
This package contains most of the main definitions of the interfaces that are relevant for packages that implement Malloy Connections.
2 changes: 1 addition & 1 deletion packages/malloy-syntax-highlight/.github/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ Currently, two other dialects of Malloy are supported in addition to the standar

Thus, this package can be pulled into only the Malloy repos that need it and includes a test runner to verify the semantic and visual accuracy of syntax highlighting provided by our TextMate grammars. Additionally, the need to maintain a Monarch grammar for Malloy has necessitated the inclusion of both a script to generate Monarch grammars from ground truth TextMate grammars as well as infrastructure to test all Monarch grammars for parity with their TextMate counterparts.

Please refer to `DEVELOPING.md` for more information on using the tools introduced in this package.
Please refer to `DEVELOPING.md` for more information on using the tools introduced in this package.
2 changes: 1 addition & 1 deletion packages/malloy-syntax-highlight/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ Malloy is an experimental language for describing data relationships and transfo

Currently, two other dialects of Malloy are supported in addition to the standard syntax used in `.malloy` files: the Malloy notebook format (`.malloynb`) and Malloy SQL (`.malloysql`). The purpose of this `npm` package is to mitigate syncing issues across `@malloydata` repositories that depend upon syntax highlight files and to make these assets more easily available for future integrations.

This `npm` package does not include the source files used to develop these syntax highlighting files. If you are interested in using the existing infrastructure to modify, test, or generate these grammar files, please refer to the [malloy monorepo](https://github.com/malloydata/malloy/tree/main/packages/malloy-syntax-highlight) and see `DEVELOPING.md` for steps to do so.
This `npm` package does not include the source files used to develop these syntax highlighting files. If you are interested in using the existing infrastructure to modify, test, or generate these grammar files, please refer to the [malloy monorepo](https://github.com/malloydata/malloy/tree/main/packages/malloy-syntax-highlight) and see `DEVELOPING.md` for steps to do so.
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,30 @@
"name": "Malloy Notebook",
"scopeName": "source.malloy-notebook",
"patterns": [
{ "include": "#comments" },
{ "include": "#malloysql-malloy" },
{ "include": "#malloysql-sql" }
{"include": "#comments"},
{"include": "#malloysql-malloy"},
{"include": "#malloysql-sql"}
],
"repository": {
"malloysql-malloy": {
"begin": ">>>malloy",
"end": "(?=>>>)",
"beginCaptures": {
"0": { "name": "entity.other.attribute.malloy-sql" }
"0": {"name": "entity.other.attribute.malloy-sql"}
},
"name": "meta.embedded.block.malloysql.malloy",
"patterns": [{ "include": "source.malloy" }]
"patterns": [{"include": "source.malloy"}]
},
"malloysql-sql": {
"begin": "(>>>sql)(\\s*connection:.*?(?<!\n)(?<!//))?",
"end": "(?=>>>)",
"beginCaptures": {
"0": { "name": "entity.other.attribute.malloy-sql" },
"1": { "name": "entity.other.attribute.malloy-sql" },
"3": { "name": "comment.line.double-slash" }
"0": {"name": "entity.other.attribute.malloy-sql"},
"1": {"name": "entity.other.attribute.malloy-sql"},
"3": {"name": "comment.line.double-slash"}
},
"name": "meta.embedded.block.malloysql.sql",
"patterns": [{ "include": "source.malloy-sql" }]
"patterns": [{"include": "source.malloy-sql"}]
}
}
}
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
{
"name": "Malloy SQL",
"scopeName": "source.malloy-sql",
"patterns": [{ "include": "#malloysql-sql" }],
"patterns": [{"include": "#malloysql-sql"}],
"repository": {
"malloysql-sql": {
"beginCaptures": {
"0": { "name": "entity.other.attribute.malloy-sql" },
"1": { "name": "entity.other.attribute.malloy-sql" },
"3": { "name": "comment.line.double-slash" }
"0": {"name": "entity.other.attribute.malloy-sql"},
"1": {"name": "entity.other.attribute.malloy-sql"},
"3": {"name": "comment.line.double-slash"}
},
"name": "meta.embedded.block.malloysql.sql",
"patterns": [
{ "include": "#comments" },
{"include": "#comments"},
{
"begin": "%{",
"end": "}%",
"beginCaptures": {
"0": { "name": "punctuation.definition.malloy-sql" }
"0": {"name": "punctuation.definition.malloy-sql"}
},
"endCaptures": {
"0": { "name": "punctuation.definition.malloy-sql" }
"0": {"name": "punctuation.definition.malloy-sql"}
},
"name": "meta.embedded.block.malloy",
"patterns": [{ "include": "source.malloy" }]
"patterns": [{"include": "source.malloy"}]
},
{
"include": "source.sql"
Expand All @@ -35,26 +35,26 @@
"begin": "/\\*",
"end": "\\*/",
"beginCaptures": {
"0": { "name": "punctuation.definition.comment.begin" }
"0": {"name": "punctuation.definition.comment.begin"}
},
"endCaptures": {
"0": { "name": "punctuation.definition.comment.end" }
"0": {"name": "punctuation.definition.comment.end"}
},
"name": "comment.block"
},
{
"begin": "//",
"end": "\\n",
"beginCaptures": {
"0": { "name": "punctuation.definition.comment" }
"0": {"name": "punctuation.definition.comment"}
},
"name": "comment.line.double-slash"
},
{
"begin": "--",
"end": "\\n",
"beginCaptures": {
"0": { "name": "punctuation.definition.comment" }
"0": {"name": "punctuation.definition.comment"}
},
"name": "comment.line.double-hyphen"
}
Expand Down
Loading