Permalink
Browse files

Setup ESlint for project; resolves #89. (#97)

* Setup ESlint to project; resolves #89.

- Add ESlint config
- Update gitignore
- Update TravisCI config
- Add Rake task
- Clean-up JS files
- Ignore some JS files
  • Loading branch information...
ruebot authored and ianmilligan1 committed Apr 9, 2018
1 parent cc6e5be commit d15b88b98aaeab7dd63d91600f8bd7e5c23f3f96
@@ -0,0 +1,13 @@
{
"extends": "airbnb-base/legacy",
"globals": {
"jQuery": true,
"$": true,
"sigma": true,
"auk": true
},
"rules": {
"no-param-reassign": [2, { "props": false }],
"func-names": ["error", "never"]
}
}
@@ -33,5 +33,7 @@ metastore_db
public/assets/
vendor/bundle/

/node_modules/

# Ignore application configuration
/config/application.yml
@@ -2,6 +2,9 @@ sudo: false
language: ruby
notifications:
email: false
before_install:
- nvm install node
- npm install
rvm:
- 2.4.2
- 2.3.5
@@ -14,6 +14,7 @@ Rails application for the Archives Unleashed Cloud.
* [Rails](http://rubyonrails.org) 5.1.2 or later
* [Apache Spark](https://spark.apache.org/) 2.2.1 or later
* [GraphPass](https://www.github.com/archivesunleashed/graphpass) 0.1.1 or later
* [NPM](https://www.npmjs.com/) (For testing/ESlint)

## Installation

@@ -25,6 +26,13 @@ Ensure Rails is _not_ running (ports 3000), then:
$ bundle exec rake
```

If you would like to make sure JavaScript files are linted:

```sh
$ npm install
$ bundle exec rake
```

### Run a development server

```sh
@@ -7,4 +7,9 @@ Rails.application.load_tasks
require 'rubocop/rake_task'
RuboCop::RakeTask.new(:rubocop)

task default: %i[rubocop test]
desc 'Run Eslint'
task :eslint do
system './node_modules/.bin/eslint app/assets/javascripts'
end

task default: %i[rubocop eslint test]
@@ -17,6 +17,6 @@
//= require bootstrap-sprockets
//= require_tree .

$(document).ready(function(){
$(document).ready(function () {
$('[data-toggle="tooltip"]').tooltip();
});
@@ -1,13 +1,13 @@
// Action Cable provides the framework to deal with WebSockets in Rails.
// You can generate new channels where WebSocket features live using the `rails generate channel` command.
// You can generate new channels where WebSocket features live using the
// `rails generate channel` command.
//
//= require action_cable
//= require_self
//= require_tree ./channels

(function() {
this.App || (this.App = {});
(function () {
this.App || (this.App = {}); // eslint-disable-line no-unused-expressions

App.cable = ActionCable.createConsumer();

}).call(this);
App.cable = ActionCable.createConsumer(); // eslint-disable-line no-undef
}.call(this));
@@ -1,34 +1,33 @@
$(document).on('turbolinks:load', function() {
if (typeof $("#graph").data("gexf") != 'undefined') {
var gexfFileData = $("#graph").data("gexf");
create_graph(gexfFileData);
}
});

function create_graph(data) {
var so = new sigma("graph");;
if (data != ``) {
data = $.parseXML(data);
sigma.parsers.gexf(
data,
so,
function(y) {
function createGraph(data) {
var so = new sigma('graph'); // eslint-disable-line new-cap
if (data !== '') {
data = $.parseXML(data); // eslint-disable-line no-param-reassign
sigma.parsers.gexf(data, so, function (y) { // eslint-disable-line no-unused-vars
so.settings({
nodeColor: 'default',
edgeColor: 'default',
labelThreshold: 6,
labelThreshold: 6
});
if (so.graph.nodes().length == 0) {
so.graph.addNode({id: "empty",
label: "(This graph is empty.)",
x: 10,
y: 10,
size: 10,
color: '#999'});
if (so.graph.nodes().length === 0) {
so.graph.addNode({
id: 'empty',
label: '(This graph is empty.)',
x: 10,
y: 10,
size: 10,
color: '#999'
});
}
}
);
so.refresh();
} else {
$("#graph").append("Cannot find Gexf file");
}}
});
so.refresh();
} else {
$('#graph').append('Cannot find Gexf file');
}
}

$(document).on('turbolinks:load', function () {
if (typeof $('#graph').data('gexf') !== 'undefined') {
var gexfFileData = $('#graph').data('gexf'); // eslint-disable-line vars-on-top
createGraph(gexfFileData);
}
});

Large diffs are not rendered by default.

Oops, something went wrong.

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
@@ -1,3 +1,5 @@
/* eslint-disable */

/*
SortTable
version 2
@@ -20,52 +20,52 @@ body {
* About Page Customization
*/

.about_h1{
font-family:helvetica;
font-size:44px;
padding-left:10px;
max-width:100%;
margin-left:20px;
}

.about_h3{
font-family:helvetica;
font-size:22px;
border-radius:5px;
border:2px solid grey;
background-color:#f5f5f5;
padding-left:10px;
max-width:100%;
margin-left:20px;
.about_h1 {
font-family: helvetica;
font-size: 44px;
padding-left: 10px;
max-width: 100%;
margin-left: 20px;
}

.about_h3 {
font-family: helvetica;
font-size: 22px;
border-radius: 5px;
border: 2px solid grey;
background-color: #f5f5f5;
padding-left: 10px;
max-width: 100%;
margin-left: 20px;
padding-bottom: 5px;
padding-top: 5px;
}

.about_p{
font-family:helvetica;
font-size:16px;
padding-left:5px;
padding-top:5px;
padding-bottom:5px;
line-height:1.4;
margin-left:20px;
margin-right:25px;
}

.about_ul{
padding-left:40px;
padding-bottom:5px;
}

.about_p {
font-family: helvetica;
font-size: 16px;
padding-left: 5px;
padding-top: 5px;
padding-bottom: 5px;
line-height: 1.4;
margin-left: 20px;
margin-right: 25px;
}

.about_ul {
padding-left: 40px;
padding-bottom: 5px;
list-style-type: square;
line-height:1.4;
line-height: 1.4;
list-style-position: outside;
margin-left:40px;
margin-left: 40px;
}

.about.li{
padding-left:5px;
padding-top:5px;
padding-bottom:10px;
line-height:1.4;
.about.li {
padding-left: 5px;
padding-top: 5px;
padding-bottom: 10px;
line-height: 1.4;
}

/*
@@ -133,10 +133,10 @@ body {
*/

.navbar-brand {
padding: 0;
padding: 0;
}

.navbar-brand >img {
.navbar-brand > img {
height: 40px;
padding-bottom: 5px;
padding-right: 5px;
@@ -162,7 +162,7 @@ body {

.homepage-img {
padding-bottom: 10px;
max-height:100%;
max-height: 100%;
}

/*
Oops, something went wrong.

0 comments on commit d15b88b

Please sign in to comment.