Skip to content

Commit

Permalink
[AIRFLOW-2783][Airflow 2783] Implement eslint for JS code check
Browse files Browse the repository at this point in the history
Closes apache#3641 from verdan/AIRFLOW-2783-eslint
  • Loading branch information
verdan authored and bolkedebruin committed Jul 26, 2018
1 parent 10b6ca5 commit 604ea1d
Show file tree
Hide file tree
Showing 7 changed files with 1,326 additions and 30 deletions.
2 changes: 2 additions & 0 deletions .rat-excludes
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
.coverage
.coveragerc
.codecov.yml
.eslintrc
.eslintignore
.rat-excludes
requirements.txt
.*log
Expand Down
16 changes: 16 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -299,3 +299,19 @@ npm run dev
Should you add or upgrade a npm package, which involves changing `package.json`, you'll need to re-run `npm install`
and push the newly generated `package-lock.json` file so we get the reproducible build.

#### Javascript Style Guide

We try to enforce a more consistent style and try to follow the JS community guidelines.
Once you add or modify any javascript code in the project, please make sure it follows the guidelines
defined in [Airbnb JavaScript Style Guide](https://github.com/airbnb/javascript).
Apache Airflow uses [ESLint](https://eslint.org/) as a tool for identifying and reporting on patterns in JavaScript,
which can be used by running any of the following commands.

```bash
# Check JS code in .js and .html files, and report any errors/warnings
npm run lint

# Check JS code in .js and .html files, report any errors/warnings and fix them if possible
npm run lint:fix
```

8 changes: 8 additions & 0 deletions airflow/www_rbac/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
**/*{.,-}min.js
**/*.sh
**/*.py
gantt-chart-d3v2.js
jqClock.min.js
coverage/**
static/dist/*
static/docs/*
5 changes: 5 additions & 0 deletions airflow/www_rbac/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"extends": "airbnb-base",
"parser": "babel-eslint",
"plugins": [ "html" ]
}
Loading

0 comments on commit 604ea1d

Please sign in to comment.