Skip to content

Commit dff8ba5

Browse files
committed
Add code linting
This adds code linting using a .coafile which checks using the ESLintBear, SpaceConsistencyBear, LineLengthBear and InvalidLinkBear. Closes #11
1 parent ef5e1f1 commit dff8ba5

File tree

4 files changed

+61
-4
lines changed

4 files changed

+61
-4
lines changed

.coafile

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
[all]
2+
files = *.js
3+
max_line_length = 80
4+
use_spaces = True
5+
eslint_config = .eslintrc
6+
7+
[all.whitespace]
8+
bears = SpaceConsistencyBear
9+
default_actions = *: ApplyPatchAction
10+
11+
[all.eslint]
12+
bears = ESLintBear
13+
default_actions = *: ApplyPatchAction
14+
15+
[all.linelength]
16+
ignore = generate.js
17+
bears = LineLengthBear
18+
19+
[all.links]
20+
bears = InvalidLinkBear
21+
22+
[json]
23+
files = *.json
24+
ignore = package-lock.json
25+
bears = JSONFormatBear
26+
indent_size = 2
27+
default_actions = *: ApplyPatchAction
28+
29+
[yaml]
30+
files = *.yml, .eslintrc
31+
bears = YAMLLintBear

.eslintrc

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
parserOptions:
3+
ecmaVersion: 2017
4+
plugins:
5+
- prettier
6+
rules:
7+
prettier/prettier:
8+
- error
9+
- singleQuote: true
10+
semi: false
11+
trailingComma: es5
12+
bracketSpacing: true
13+
arrowParens: avoid

.travis.yml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,21 @@
1-
sudo: false
2-
language: node_js
1+
language: python
2+
python: 3.6
3+
4+
before_install:
5+
- nvm install 8
6+
- npm install
7+
- pip3 install coala-bears
8+
- export PATH=$PATH:./node_modules/.bin
9+
- export NODE_PATH=$NODE_PATH:./node_modules
310

411
script:
12+
- coala --non-interactive -V
513
- npm run build
614

715
deploy:
816
provider: pages
917
skip_cleanup: true
10-
github_token: $GITHUB_TOKEN # Set in travis-ci.org dashboard
18+
github_token: $GITHUB_TOKEN
1119
local_dir: out
12-
on:
20+
"on":
1321
branch: master

package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,10 @@
1212
"dependencies": {
1313
"mustache": "^2.3.0",
1414
"node-fetch": "^1.7.3"
15+
},
16+
"devDependencies": {
17+
"eslint": "^4.12.1",
18+
"eslint-plugin-prettier": "^2.3.1",
19+
"prettier": "^1.9.1"
1520
}
1621
}

0 commit comments

Comments
 (0)