@build-chores/eslint-config-lint
v0.9.0
Published
Linting JS projects is complicated.
Downloads
12
Readme
@build-chores/eslint-config-lint
Linting JS projects is complicated.
Synopsis
Lint your JavaScript code. This config is based on Airbnb's base lint configuration and includes support for Prettier, the Flow type checker and promises.
Usage
Install the @build-chores/eslint-config-lint
package into your project:
yarn install --dev @build-chores/eslint-config-lint
Create a .eslintrc
file containing the following snippet. See the example .eslintrc
for a template.
{
"extends": ["@build-chores/lint"]
}
To use flow as well place a .flowconfig
and .flowcoverage
configuration file. See the example flowconfig
and the example .flowcoverage
for templates.
Note that even if flow
isn't use an empty .flowconfig
file has to be created.
This package installs flow-typed
to install flow type definitions. To make it work in this setup the flow-libdefs
wrapper script is provided. It takes the same arguments as flow-typed
.
The following command installs type definitions for your dependencies.
yarn flow-libdefs install
Edit your package.json
to include the following scripts. See the example package.json
for a template.
{
"scripts": {
"fix": "yarn lint --fix",
"flow:coverage": "yarn flow-coverage-report --config ./.flowcoverage",
"flow:gen": "gen-flow-files --out-dir dist src",
"flow:libdefs": "yarn flow-libdefs update",
"lint": "eslint src/**/*.js**"
}
}
Types are checked during the regular linting. If you want to run Flow separated, you can call the flow
command directly with yarn flow
.
See the rules file for details of the ESLint configuration.
You are ready to lint your JavaScript code.
Contribute
Check out our contributing.md to get started.