yarn
is used instead of npm
.
While, this project does not use flow
, this ESLint plugin is required because the configuration extends react-app
, which requires this plugin.
ESLint is being used to lint the repo, as a whole. Within ./packages/plexus
(for now), @typescript-eslint/eslint-plugin
is used to apply ESLint to TypeScript. This application is localized to plexus via configuring ./packages/plexus/.eslintrc.js
for TypeScript, which means the change in settings is only applied to subdirectories of ./packages/plexus
. This package works really well, but there are quite a few issues it doesn't catch. For that, we use the TypeScript compiler.
In the project root, typescript
is used to bolster the linting of TypeScript files. tsc
catches quite a few issues that ESLint does not pick up on.
In ./packages/plexus
, typescript
is used to generate type declarations for the ES module build. See ./packages/plexus/BUILD.md
for details.
Create React App (CRA) is used as the build-tooling for the Jaeger UI website. In 2.1.2+ CRA introduced a guard for the start
, build
and test
scripts which checks the version of NPM packages available to make sure they're consistent with CRA's expectations (reference). This process checks node_modules
in parent directories and errors if an unexpected package version is encountered.
To avoid a world of pain, the nohoist
feature of yarn
workspaces is leveraged. CRA and it's dependencies are local to ./packages/jaeger-ui/node_modules
instead of ./node_modules
, i.e. they're not hoisted. This ensures CRA is using the packages it expects to use.
Unfortunately, the CRA check is not savvy to yarn
workspaces and errors even though the yarn
workspace-magic ensures the right packages are actually used by the CRA scripts. So, the escape hatch provided by CRA is used to skip the check: the envvar SKIP_PREFLIGHT_CHECK=true
, set in ./packages/jaeger-ui/.env
.
lerna run build
executes the build in each of ./packages/*
sub-packages.
This applies ESLint to the repo, as a whole. The TypeScript linting has a distinct configuration, which is a descendent of ./.eslintrc.js
. See TypeScript, above.
This is an amalgamation of linting scripts that run to make sure things are all-good. It's run in CI (travis) and as part of a pre-commit hook.
prettier-lint
tsc-lint
eslint
check-license
Runs after the top-level yarn install
. This ensures ./packages/plexus
builds and is available to ./packages/jaeger-ui
.
prettier-comment
is just an explanation for why the ./node_module/.bin/bin-prettier.js
path is used instead of just yarn prettier etc
; it's due to an issue with yarn
.
prettier
formats the code.
prettier-lint
runs bin-prettier
in the --list-different
mode, which only outputs filenames if they would be changed by prettier formatting. If any such files are encountered, the program exits with a non-zero code. This is handy for blocking CI and pre-commits.
tsc
is run with the --noEmit
option to bolster linting of TypeScript files. See TypeScript, above.
tsc-lint-debug
is for diagnosing problems with linking, resolving files, or aliases in TypeScript code. It lists the files involved in the compilation.
Runs the lint
and test
scripts.
Pretty basic.
Note: This configuration is extended by ./packages/plexus/.eslintrc.js
.
Currently ./packages/plexus
doesn't have any tests... But, when it does, .travis.yml
needs to be updated to send coverage info for all ./packages/*
to codecov.io. (Ticket)
yarn install --frozen-lockfile
ensures installs in CI fail if they would typically mutate the lockfile.
We should probably audit our use of lerna
to make sure a) it's necessary and b) it's idiomatic if it is necessary. We have ended up relying quite a bit on yarn
workspaces, which has reduced the relevance of lerna
. (Ticket)
Used to configure the tsc-lint
script and, in theory, the IDE (such as VS Code).
A few notable compiler settings:
lib
skipLibCheck
- Maybe worth reevaluating in the futurestrict
- ImportantnoEmit
- We're using this for linting, after allinclude
- We've included./typgings
here because it turned out to be a lot simpler than configuringtypes
,typeRoots
andpaths
This is relevant for ./packages/plexus/src/LayoutManager/getLayout.tsx
and the viz.js
package.
I wasn't able to get much in the line of error messaging, so I'm pretty vague on this.
The version of viz.js
in use (1.8.1) ships with an index.d.ts
file, but it has some issues. ./typings/custom.d.ts
defines an alternate type declaration for viz.js
by targeting viz.js/viz.js
. It was necessary use ./typings/index.d.ts
to refer to ./typings/custom.d.ts
. Then, importing the modules main file, which is viz.js/viz.js
, will use the alternate type declaration.