Skip to content
This repository has been archived by the owner on Dec 29, 2022. It is now read-only.

Commit

Permalink
Add ESLint and fixup errors (#951)
Browse files Browse the repository at this point in the history
* Add ESLint and fixup errors

* Update config to include recommended. Fixup errors

* Add cascading eslintrc

* Run npm test
  • Loading branch information
robdodson authored and abdonrd committed Dec 13, 2016
1 parent fae9961 commit 2a02784
Show file tree
Hide file tree
Showing 15 changed files with 64 additions and 28 deletions.
16 changes: 16 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"extends": ["eslint:recommended", "google"],
"env": {
"browser": true
},
"plugins": [
"html"
],
"rules": {
"no-var": "off",
"new-cap": ["error", { "capIsNewExceptions": ["Polymer"] }]
},
"globals": {
"Polymer": true
}
}
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ before_script:
- npm install -g bower polymer-cli
- bower install
script:
- xvfb-run polymer test
- xvfb-run npm test
5 changes: 3 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,11 @@
// Setup Polymer options
window.Polymer = {
dom: 'shadow',
lazyRegister: true
lazyRegister: true,
};

// Load webcomponentsjs polyfill if browser does not support native Web Components
// Load webcomponentsjs polyfill if browser does not support native
// Web Components
(function() {
'use strict';

Expand Down
13 changes: 13 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"name": "polymer-starter-kit",
"license": "BSD-3-Clause",
"devDependencies": {
"eslint": "^3.12.0",
"eslint-config-google": "^0.7.1",
"eslint-plugin-html": "^1.7.0"
},
"scripts": {
"lint": "eslint . --ext js,html; exit 0;",
"test": "npm run lint && polymer test"
}
}
7 changes: 6 additions & 1 deletion service-worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,9 @@
* Code distributed by Google as part of the polymer project is also
* subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
*/
console.info('Service worker disabled for development, will be generated at build time.');

/* eslint no-console: ["error", { allow: ["info"] }] */

console.info(
'Service worker disabled for development, will be generated at build time.'
);
13 changes: 4 additions & 9 deletions src/my-app.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,19 +46,14 @@

.drawer-list a {
display: block;

padding: 0 16px;

text-decoration: none;

color: var(--app-secondary-color);

line-height: 40px;
}

.drawer-list a.iron-selected {
color: black;

font-weight: bold;
}
</style>
Expand Down Expand Up @@ -113,12 +108,12 @@
page: {
type: String,
reflectToAttribute: true,
observer: '_pageChanged'
}
observer: '_pageChanged',
},
},

observers: [
'_routePageChanged(routeData.page)'
'_routePageChanged(routeData.page)',
],

_routePageChanged: function(page) {
Expand All @@ -137,7 +132,7 @@

_showPage404: function() {
this.page = 'view404';
}
},
});
</script>
</dom-module>
2 changes: 1 addition & 1 deletion src/my-view1.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ <h1>View One</h1>

<script>
Polymer({
is: 'my-view1'
is: 'my-view1',
});
</script>
</dom-module>
2 changes: 1 addition & 1 deletion src/my-view2.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ <h1>View Two</h1>

<script>
Polymer({
is: 'my-view2'
is: 'my-view2',
});
</script>
</dom-module>
2 changes: 1 addition & 1 deletion src/my-view3.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ <h1>View Three</h1>

<script>
Polymer({
is: 'my-view3'
is: 'my-view3',
});
</script>
</dom-module>
2 changes: 1 addition & 1 deletion src/my-view404.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

<script>
Polymer({
is: 'my-view404'
is: 'my-view404',
});
</script>
</dom-module>
7 changes: 0 additions & 7 deletions src/shared-styles.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
.card {
margin: 24px;
padding: 16px;

color: #757575;
border-radius: 5px;
background-color: #fff;
Expand All @@ -26,25 +25,19 @@

.circle {
display: inline-block;

width: 64px;
height: 64px;

text-align: center;

color: #555;
border-radius: 50%;
background: #ddd;

font-size: 30px;
line-height: 64px;
}

h1 {
margin: 16px 0;

color: #212121;

font-size: 22px;
}
</style>
Expand Down
7 changes: 5 additions & 2 deletions sw-precache-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,14 @@
* Code distributed by Google as part of the polymer project is also
* subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
*/

/* eslint-env node */

module.exports = {
staticFileGlobs: [
'/index.html',
'/manifest.json',
'/bower_components/webcomponentsjs/webcomponents-lite.min.js'
'/bower_components/webcomponentsjs/webcomponents-lite.min.js',
],
navigateFallback: 'index.html'
navigateFallback: 'index.html',
};
10 changes: 10 additions & 0 deletions test/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"env": {
"mocha": true
},
"globals": {
"assert": false,
"fixture": false,
"WCT": false
}
}
2 changes: 1 addition & 1 deletion test/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<script>
WCT.loadSuites([
'my-view1.html?dom=shady',
'my-view1.html?dom=shadow'
'my-view1.html?dom=shadow',
]);
</script>
</body>
Expand Down
2 changes: 1 addition & 1 deletion test/my-view1.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
test('Number in circle should be 1', function() {
var circle = Polymer.dom(home.root).querySelector('.circle');
assert.equal(circle.textContent, '1');
})
});
});
</script>
</body>
Expand Down

0 comments on commit 2a02784

Please sign in to comment.