Skip to content

Commit

Permalink
chore: add ESLint
Browse files Browse the repository at this point in the history
  • Loading branch information
dferber90 committed Sep 25, 2018
1 parent 23af90c commit 322e3e4
Show file tree
Hide file tree
Showing 5 changed files with 965 additions and 7 deletions.
13 changes: 13 additions & 0 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
extends:
- airbnb-base
- prettier
env:
node: true
# Not a real browser, but jsdom is available.
# This is good enough.
browser: true
plugins:
- prettier
rules:
global-require: 0
"prettier/prettier": "error"
2 changes: 2 additions & 0 deletions debug.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const { DOMElement, DOMCollection } = prettyFormat.plugins;

function prettyDOM(htmlElement, maxLength, options) {
if (htmlElement.documentElement) {
// eslint-disable-next-line no-param-reassign
htmlElement = htmlElement.documentElement;
}

Expand All @@ -20,4 +21,5 @@ function prettyDOM(htmlElement, maxLength, options) {
: debugContent;
}

// eslint-disable-next-line no-console
module.exports = (el = document) => console.log(prettyDOM(el));
1 change: 1 addition & 0 deletions generateImage.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ const merge = require("lodash.merge");
const debug = require("./debug");

const addArg = (opts, arg) => {
// eslint-disable-next-line no-param-reassign
if (!Array.isArray(opts.launch.args)) opts.launch.args = [];

if (!opts.launch.args.includes(arg)) {
Expand Down
11 changes: 11 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
"version": "3.0.2",
"description": "Generate screenshots of jsdom",
"main": "index.js",
"scripts": {
"lint": "eslint ."
},
"repository": {
"type": "git",
"url": "git+https://github.com/dferber90/jsdom-screenshot.git"
Expand All @@ -21,6 +24,7 @@
},
"dependencies": {
"connect": "3.6.6",
"eslint-plugin-prettier": "2.6.2",
"finalhandler": "1.1.1",
"lodash.merge": "^4.6.1",
"pretty-format": "23.6.0",
Expand All @@ -29,5 +33,12 @@
},
"engines": {
"node": ">=8"
},
"devDependencies": {
"eslint": "5.6.0",
"eslint-config-airbnb-base": "13.1.0",
"eslint-config-prettier": "3.1.0",
"eslint-plugin-import": "2.14.0",
"prettier": "1.14.3"
}
}
Loading

0 comments on commit 322e3e4

Please sign in to comment.