-
Notifications
You must be signed in to change notification settings - Fork 208
Lint
Dan Connolly edited this page Sep 16, 2021
·
2 revisions
part of Coding Style
To be consistent with Agoric style, packages must use Agoric’s eslint rules and tooling. These are captured in packages, @agoric/eslint-config
and @agoric/eslint-plugin
. These must be configured in each of a project’s package.json
files. The best way to get set up is to graft the most up-to-date properties from an example dapp like dapp-card-store
.
The noteworthy properties are:
-
eslintConfig
, which must at least have"extends": ["@agoric"]
-
prettier
, which must at least have"trailingComma": "all"
and"singleQuote": true
to be compatible with our eslint rules -
devDependencies
, which must include all of the mentionedeslint-plugin
packages because somehow we got this far without these becoming automatic.
By convention, we add scripts
with the names lint
and lint-fix
so yarn lint
and yarn lint-fix
check and auto-fix source files automatically. We check all .js
files, and you may to augment the pattern to reach any other extensions you use like .cjs
or .jsx
.
{
"scripts": {
"lint": "eslint '**/*.{js,jsx}'",
"lint-fix": "eslint --fix '**/*.{js,jsx}'"
}
}