Skip to content

Commit

Permalink
Merge pull request #3167 from aitbw/aitbw/js-linting
Browse files Browse the repository at this point in the history
Add basic tooling for JS linting
  • Loading branch information
tvdeyen authored May 20, 2019
2 parents ba905a7 + 9a5b898 commit f017429
Show file tree
Hide file tree
Showing 9 changed files with 80 additions and 2 deletions.
46 changes: 46 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"extends": "airbnb-base",
"rules": {
"camelcase": 0,
"comma-dangle": 0,
"dot-notation": 0,
"func-names": 0,
"no-console": 0,
"no-extra-semi": 0,
"no-global-assign": ["error", {
"exceptions": ["Tabs"]
}],
"no-redeclare": 0,
"no-shadow": 0,
"no-undef": "error",
"no-unused-vars": 0,
"no-use-before-define": 0,
"no-var": 0,
"object-shorthand": 0,
"operator-linebreak": 0,
"prefer-arrow-callback": 0,
"prefer-destructuring": 0,
"prefer-template": 0,
"quotes": 0,
"radix": 0,
"space-before-function-paren": 0,
"vars-on-top": 0
},
"globals": {
"$": "readonly",
"accounting": "readonly",
"addVariantFromStockLocation": "writable",
"adjustShipmentItems": "writable",
"document": "readonly",
"error": "writable",
"flatpickr": "readonly",
"Handlebars": "readonly",
"json": "writable",
"message": "writable",
"shipments": "writable",
"Sortable": "readonly",
"Spree": "readonly",
"Turbolinks": "readonly",
"window": "readonly"
}
}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,6 @@ tags
.sass-cache
.localeapp
.yardoc
node_modules
yarn.lock
package-lock.json
5 changes: 3 additions & 2 deletions .hound.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ erb_lint:
enabled: true
scss:
enabled: false
javascript:
enabled: false
eslint:
enabled: true
config_file: .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//= require solidus_admin/Sortable
/* eslint no-unused-vars: "off" */

Spree.ready(function() {
var sortable_tables = document.querySelectorAll('table.sortable');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/* global Tabs */
/* eslint no-redeclare: "off" */

Tabs = (function() {
function Tabs(el) {
Expand Down
1 change: 1 addition & 0 deletions backend/app/assets/javascripts/spree/backend/shipments.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Shipments AJAX API
/* eslint no-extra-semi: "off", no-unused-vars: "off" */

var ShipmentAddVariantView = Backbone.View.extend({
events: {
Expand Down
2 changes: 2 additions & 0 deletions backend/app/assets/javascripts/spree/backend/translation.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* eslint no-console: "off" */

(function() {
// Resolves string keys with dots in a deeply nested object
// http://stackoverflow.com/a/22129960/4405214
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Require this file if you plan to use Turbolinks in the Solidus admin
// It is necessary because extensions may use JS libs that make use of
// jQuery.ready instead of Spree.ready
/* eslint no-console: "off" */

Spree.jQueryReady = $.fn.ready;

Expand Down
22 changes: 22 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"name": "solidus",
"author": "Solidus Team",
"homepage": "https://solidus.io/",
"version": "2.8.2",
"description": "A free, open-source e-commerce platform that gives you complete control over your store",
"repository": {
"type": "git",
"url": "git+https://github.com/solidusio/solidus.git"
},
"bugs": "https://github.com/solidusio/solidus/issues",
"license": "BSD-3-Clause",
"scripts": {
"lint": "find . -path \"**\/app\/assets\/javascripts\/*.js\" | grep -f .gitignore | xargs eslint"
},
"devDependencies": {
"eslint": "5.3.0",
"eslint-config-airbnb": "^17.1.0",
"eslint-config-airbnb-base": "13.1.0",
"eslint-plugin-import": "^2.14.0"
}
}

0 comments on commit f017429

Please sign in to comment.