Skip to content

Commit

Permalink
Merge pull request #39 from unicef-polymer/linting-task
Browse files Browse the repository at this point in the history
Linting tasks
  • Loading branch information
daniel-tabarcea authored Apr 20, 2018
2 parents 63d817c + 2c30e2d commit 11ccfca
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 28 deletions.
22 changes: 11 additions & 11 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,21 @@
"html"
],
"rules": {
"padded-blocks": "off",
"brace-style": "off",
"new-cap": ["error", { "capIsNewExceptions": ["Polymer"] }],
"new-cap": ["error", { "capIsNewExceptions": ["Polymer"], "capIsNewExceptionPattern": "^Etools.." }],
"no-var": "off",
"operator-linebreak": 1,
"no-trailing-spaces": 1,
"valid-jsdoc": 0,
"camelcase": 1,
"guard-for-in": 0,
"comma-dangle": 0,
"prefer-spread": 0,
"linebreak-style": 0,
"require-jsdoc": "off",
"max-len": ["error", 120, 4]
"valid-jsdoc": "off",
"comma-dangle": ["error", "never"],
"max-len": ["error", { "code": 120 }],
"camelcase": ["error", {"properties": "never"}],
"arrow-parens": [2, "as-needed", { "requireForBlockBody": true }]
},
"globals": {
"Polymer": true
"moment": true,
"Promise": true,
"Polymer": true,
"EtoolsLogsMixin": true
}
}
16 changes: 0 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,22 +138,6 @@ $ bower install --save etools-ajax
Install needed dependencies by running: `$ bower install`.
Make sure you have the [Polymer CLI](https://www.npmjs.com/package/polymer-cli) installed. Then run `$ polymer serve` to serve your element application locally.

## Linting the code

Innstall local npm packages (run `npm install`)
Then just run the linting task

```bash
$ npm run lint
```
You should also use polylint. If you don't have Polylint installed run `npm install -g polylint`.
Then just run the linter on each file you wish to check like so

```bash
$ polylint -i filename.html
```
At the moment polylint crashes if it encounters a missing import. If that happens, temporarily comment out such imports and run the command again.

## Running Tests

You need to have `web-component-tester` installed (if not run `npm install -g web-component-tester`)
Expand Down
1 change: 1 addition & 0 deletions etools-ajax-cache-mixin.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
}

ready() {
super.ready();
if(typeof Dexie === 'undefined') {
this.logError('Dexie import missing.', 'etools-ajax');
}
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
"eslint-plugin-html": "^2.0.0"
},
"scripts": {
"lint": "npm run lint:javascript && exit 0",
"lint:javascript": "eslint . --ext js,html && exit 0"
}
}
11 changes: 11 additions & 0 deletions polymer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"lint": {
"rules": [
"polymer-2"
],
"filesToIgnore": [
"demo/*",
"test/*"
]
}
}

0 comments on commit 11ccfca

Please sign in to comment.