Skip to content

Commit

Permalink
chore: Update devDependencies, ESLint config, and require 100% test c…
Browse files Browse the repository at this point in the history
…overage
  • Loading branch information
nwoltman committed Nov 2, 2019
1 parent 104e7b8 commit ab4099a
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 210 deletions.
195 changes: 2 additions & 193 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,198 +1,6 @@
{
"root": true,
"parserOptions": {
"ecmaVersion": 2017
},
"env": {
"es6": true,
"node": true
},
"rules": {
"array-bracket-newline": [2, "consistent"],
"array-bracket-spacing": 2,
"array-callback-return": 2,
"arrow-parens": [2, "as-needed", {"requireForBlockBody": true}],
"arrow-spacing": 2,
"block-scoped-var": 2,
"block-spacing": 2,
"brace-style": 2,
"camelcase": 2,
"class-methods-use-this": 1,
"comma-dangle": [2, {
"arrays": "always-multiline",
"objects": "always-multiline",
"imports": "always-multiline",
"exports": "always-multiline",
"functions": "never"
}],
"comma-spacing": 2,
"comma-style": 2,
"computed-property-spacing": 2,
"consistent-return": 2,
"constructor-super": 2,
"curly": 2,
"dot-location": [2, "property"],
"dot-notation": 2,
"eol-last": 2,
"eqeqeq": 2,
"for-direction": 2,
"func-call-spacing": 2,
"func-style": [2, "declaration", {"allowArrowFunctions": true}],
"function-paren-newline": [2, "consistent"],
"getter-return": 2,
"handle-callback-err": [2, "^(?:err(?:or)?)$"],
"indent": [2, 2, {"SwitchCase": 1}],
"key-spacing": 2,
"keyword-spacing": 2,
"lines-around-directive": [2, {"before": "never", "after": "always"}],
"lines-between-class-members": [2, "always", {"exceptAfterSingleLine": true}],
"max-len": [2, 100, {
"ignorePattern": "^import |^const \\w+ = require\\(",
"ignoreUrls": true,
"ignoreTemplateLiterals": true,
"ignoreRegExpLiterals": true
}],
"max-nested-callbacks": [2, 3],
"multiline-ternary": [2, "always-multiline"],
"new-cap": 2,
"new-parens": 2,
"no-array-constructor": 2,
"no-await-in-loop": 2,
"no-buffer-constructor": 2,
"no-case-declarations": 2,
"no-class-assign": 2,
"no-compare-neg-zero": 2,
"no-console": 2,
"no-const-assign": 2,
"no-constant-condition": 2,
"no-control-regex": 2,
"no-delete-var": 2,
"no-dupe-class-members": 2,
"no-dupe-keys": 2,
"no-duplicate-case": 2,
"no-else-return": 2,
"no-empty": 2,
"no-empty-character-class": 2,
"no-empty-pattern": 2,
"no-eval": 2,
"no-ex-assign": 2,
"no-extend-native": 2,
"no-extra-bind": 2,
"no-extra-boolean-cast": 2,
"no-extra-label": 2,
"no-extra-semi": 2,
"no-fallthrough": 2,
"no-floating-decimal": 2,
"no-func-assign": 2,
"no-implied-eval": 2,
"no-invalid-regexp": 2,
"no-irregular-whitespace": [2, {"skipStrings": false}],
"no-label-var": 2,
"no-labels": [2, {"allowLoop": true}],
"no-lone-blocks": 2,
"no-lonely-if": 2,
"no-loop-func": 2,
"no-mixed-spaces-and-tabs": 2,
"no-multi-spaces": 2,
"no-multi-str": 2,
"no-multiple-empty-lines": [2, {"max": 2, "maxEOF": 1}],
"no-negated-condition": 1,
"no-nested-ternary": 2,
"no-new": 2,
"no-new-object": 2,
"no-new-require": 2,
"no-new-symbol": 2,
"no-new-wrappers": 2,
"no-octal-escape": 2,
"no-proto": 2,
"no-redeclare": [2, {"builtinGlobals": true}],
"no-regex-spaces": 2,
"no-return-assign": [2, "always"],
"no-return-await": 2,
"no-script-url": 2,
"no-self-assign": 2,
"no-self-compare": 2,
"no-sequences": 2,
"no-shadow": [2, {"allow": ["err"], "builtinGlobals": true}],
"no-shadow-restricted-names": 2,
"no-sparse-arrays": 2,
"no-tabs": 2,
"no-template-curly-in-string": 2,
"no-this-before-super": 2,
"no-throw-literal": 2,
"no-trailing-spaces": 2,
"no-undef": 2,
"no-undef-init": 2,
"no-unexpected-multiline": 2,
"no-unmodified-loop-condition": 2,
"no-unneeded-ternary": [2, {"defaultAssignment": true}],
"no-unreachable": 2,
"no-unsafe-finally": 2,
"no-unsafe-negation": 2,
"no-unused-expressions": [2, {"allowShortCircuit": true}],
"no-unused-labels": 2,
"no-unused-vars": [2, {"ignoreRestSiblings": true}],
"no-use-before-define": [2, {"functions": false}],
"no-useless-call": 2,
"no-useless-computed-key": 2,
"no-useless-concat": 2,
"no-useless-escape": 2,
"no-useless-rename": 2,
"no-useless-return": 2,
"no-void": 2,
"no-warning-comments": 1,
"no-whitespace-before-property": 2,
"no-with": 2,
"object-curly-newline": [2, {"consistent": true}],
"object-curly-spacing": 2,
"object-property-newline": [2, {"allowAllPropertiesOnSameLine": true}],
"object-shorthand": 2,
"one-var": [2, "never"],
"one-var-declaration-per-line": 2,
"operator-assignment": [1, "always"],
"operator-linebreak": 2,
"padding-line-between-statements": [2,
{"blankLine": "always", "prev": "*", "next": "class"},
{"blankLine": "always", "prev": "class", "next": "*"},
{"blankLine": "always", "prev": "*", "next": "function"},
{"blankLine": "always", "prev": "function", "next": "*"}
],
"prefer-arrow-callback": [2, {"allowNamedFunctions": true}],
"prefer-const": 2,
"prefer-destructuring": [2, {
"VariableDeclarator": {"array": false, "object": true},
"AssignmentExpression": {"array": false, "object": false}
}],
"prefer-numeric-literals": 2,
"prefer-promise-reject-errors": 2,
"prefer-rest-params": 2,
"prefer-spread": 2,
"quote-props": [2, "as-needed"],
"quotes": [2, "single", {"avoidEscape": true}],
"require-await": 2,
"require-yield": 2,
"rest-spread-spacing": 2,
"semi": 2,
"space-before-blocks": 2,
"space-before-function-paren": [2, {
"anonymous": "never",
"named": "never",
"asyncArrow": "always"
}],
"space-in-parens": 2,
"space-infix-ops": 2,
"space-unary-ops": 2,
"spaced-comment": [2, "always", {"block": {"balanced": true}}],
"strict": [2, "global"],
"switch-colon-spacing": 2,
"symbol-description": 1,
"template-curly-spacing": 2,
"template-tag-spacing": 2,
"use-isnan": 2,
"valid-typeof": 2,
"wrap-iife": [2, "inside"],
"yoda": [2, "never", {"exceptRange": true}]
},
"extends": "@nwoltman/eslint-config",
"overrides": [
{
"files": ["test/**/*.js"],
Expand All @@ -205,6 +13,7 @@
"max-len": 0,
"new-cap": 0,
"no-sync": 0,
"padded-blocks": 0,
"prefer-arrow-callback": 0
}
}
Expand Down
38 changes: 22 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,43 +2,49 @@
"name": "@medley/serve-favicon",
"version": "0.1.2",
"description": "Medley plugin for serving the default favicon",
"license": "MIT",
"author": "Nathan Woltman <nwoltman@outlook.com>",
"main": "serve-favicon.js",
"files": [
"serve-favicon.js"
],
"engines": {
"node": ">=6"
},
"license": "MIT",
"author": "Nathan Woltman <nwoltman@outlook.com>",
"repository": {
"type": "git",
"url": "git+https://github.com/medleyjs/serve-favicon.git"
},
"repository": "github:medleyjs/serve-favicon",
"homepage": "https://github.com/medleyjs/serve-favicon#readme",
"bugs": {
"url": "https://github.com/medleyjs/serve-favicon/issues"
},
"bugs": "https://github.com/medleyjs/serve-favicon/issues",
"keywords": [
"serve",
"favicon",
"medley"
],
"nyc": {
"reporter": [
"html",
"text-summary"
],
"check-coverage": true,
"branches": 100,
"lines": 100,
"statements": 100
},
"dependencies": {
"etag": "^1.8.1"
},
"devDependencies": {
"@medley/medley": "~0.12.0",
"@medley/self-request": "~0.3.0",
"coveralls": "^3.0.4",
"eslint": "^5.16.0",
"mocha": "^6.1.4",
"@medley/medley": "~0.13.0",
"@medley/self-request": "~0.4.0",
"@nwoltman/eslint-config": "~0.5.1",
"coveralls": "^3.0.7",
"eslint": "^6.6.0",
"mocha": "^6.2.2",
"nyc": "^14.1.1"
},
"scripts": {
"lint": "eslint *.js test/*.js",
"test-only": "nyc --reporter=html --reporter=text-summary mocha",
"test": "npm run lint && npm run test-only",
"test-only": "nyc mocha",
"test": "eslint *.js test/*.js && nyc mocha",
"coveralls": "nyc report --reporter=text-lcov | coveralls"
}
}
2 changes: 1 addition & 1 deletion serve-favicon.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const DEFAULT_MAX_AGE = 60 * 60 * 24 * 365; // 1 year
function serveFavicon(app, options) {
const favicon = Buffer.isBuffer(options.favicon)
? options.favicon
: fs.readFileSync(options.favicon);
: fs.readFileSync(options.favicon); // eslint-disable-line no-sync
const etagValue = etag(favicon);

const maxAge = typeof options.maxAge === 'number'
Expand Down

0 comments on commit ab4099a

Please sign in to comment.