Skip to content

Commit

Permalink
Merge pull request #5 from unicef-polymer/feature--add-linting-tasks
Browse files Browse the repository at this point in the history
Add linting tasks
  • Loading branch information
daniel-tabarcea authored May 29, 2017
2 parents fb0bab1 + 0dacfad commit da0a574
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 2 deletions.
4 changes: 4 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.gitignore
demo/*
test/*
node_modules/*
30 changes: 30 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"extends": ["eslint:recommended", "google"],
"parserOptions": {
"ecmaVersion": 6
},
"env": {
"browser": true
},
"plugins": [
"html"
],
"rules": {
"brace-style": "off",
"new-cap": ["error", { "capIsNewExceptions": ["Polymer"] }],
"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]
},
"globals": {
"Polymer": true
}
}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
bower_components/
node_modules/
18 changes: 17 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,29 @@ $ bower install --save etools-content-panel
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`)
```bash
$ wtc
```
or
or
```bash
$ wtc -p
```
2 changes: 1 addition & 1 deletion etools-content-panel.html
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
</template>

<script>
(function () {
(function() {
'use strict';

Polymer({
Expand Down
12 changes: 12 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name": "etools-content-panel",
"devDependencies": {
"eslint": "^3.19.0",
"eslint-config-google": "^0.7.0",
"eslint-plugin-html": "^2.0.0"
},
"scripts": {
"lint": "npm run lint:javascript && exit 0",
"lint:javascript": "eslint . --ext js,html && exit 0"
}
}

0 comments on commit da0a574

Please sign in to comment.