- Node 22 or later.
- pnpm, enabled with
corepack enable(the version is pinned in the rootpackage.json). The repository is one pnpm workspace: rungrok setuponce (it enables pnpm, installs, and removes npm-era leftovers); nevernpm installinside a package. datagrok-tools:npm install -g datagrok-tools(inside the repository, package scripts use the workspace copy automatically).
TypeScript, the bundler and eslint come with the workspace (@datagrok/build-config); nothing else is
installed globally. See packages/BUILD.MD for the build commands.
We are only using pure JavaScript in the packages not yet converted to TypeScript, such as
public/packages/Charts.
We use only TypeScript in all actual and new packages. Avoid using pure JavaScript.
In this public repo, we follow the Google JavaScript Style Guide.
In particular:
-
Add intermediate spaces in
a, b,1, 2, 3,if (...,...) {,a == b, and similar -
Do not add empty lines in the beginning and/or the ending of the code block
-
The default is 2 spaces per tab
-
We are not strict about braces for code blocks of a single statement and trailing commas .
-
The eslint configuration is one file at the repository root (
.eslintrc.json); packages carry none.pnpm run lintin a package (orpnpm turbo run lint) applies it. -
pnpm-lock.yamlat the repository root is the only lockfile. Commit it wheneverpnpm installchanges it; never add apackage-lock.json. -
Document your code when there is a need for it, but do not overdo it. For instance, there is no reason to include information that is already in the function/class signature, such as types of parameters. Often, a one-liner is enough.
If you are using WebStorm IDE, we recommend you to stick to its defaults for JS/TS formatting, except for the spaces settings: change its default value of 4 to 2.
Thank you for following the style!
Inside the repository, eslint and the TypeScript parser are workspace devDependencies and the one
configuration lives in .eslintrc.json at the root: run pnpm run lint in a package, or
pnpm turbo run lint for everything. A standalone package created with grok create gets the same
rule set through @datagrok/build-config; run npm run lint there.
Check our git recommendations to work with the repository