Skip to content

Commit

Permalink
Added eslint + standard config (#25)
Browse files Browse the repository at this point in the history
* fixes the array index unset issue

* added eslint and standard config

* fixes linting errors and runs lint on travis

* added linting step to prepublishOnly
  • Loading branch information
bali182 authored and sdgluck committed Mar 31, 2017
1 parent 16e9137 commit d4190df
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 4 deletions.
3 changes: 3 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "standard"
}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
node_modules
.idea
npm-debug.log
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ node_js:
- "6.9"
script:
- npm run assertfilesize
- npm run lint
- npm test
notifications:
email: false
Expand Down
6 changes: 3 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/** @returns {Array|Object} */
function mewt(target) {
function mewt (target) {
const multiRet = 'push pop shift unshift'
const mutArrMethods = 'reverse sort splice fill copyWithin'
const nonMutArrMethods = 'filter map concat slice'
const mutationTraps = ['setPrototypeOf', 'defineProperty', 'deleteProperty']

const isA = Array.isArray(target)
const clone = isA ? v => [...v] : v => Object.assign({}, v)

Expand Down Expand Up @@ -45,7 +45,7 @@ function mewt(target) {

let proxyHandler = {
get: (_, prop) => {
return api[prop] || target[prop] && ({}.hasOwnProperty.call(target, prop) ? target[prop] : override(prop))
return api[prop] || (target[prop] && ({}.hasOwnProperty.call(target, prop) ? target[prop] : override(prop)))
}
}

Expand Down
7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,20 @@
"main": "lib/index.js",
"scripts": {
"build": "rimraf lib && babili index.js -d lib",
"lint": "eslint index.js",
"test": "npm run build && jest",
"prepublishOnly": "npm run build",
"prepublishOnly": "npm run lint && npm run build",
"filesize": "node -e \"console.log(require('fs').statSync('lib/index.js').size + ' bytes')\"",
"assertfilesize": "node -e \"require('assert')((require('fs').statSync('lib/index.js').size) < 1024, 'file size exceeds 1KB')\""
},
"author": "Sam Gluck <sdgluck@gmail.com>",
"license": "MIT",
"devDependencies": {
"babili": "0.0.12",
"eslint": "^3.18.0",
"eslint-config-standard": "^7.1.0",
"eslint-plugin-promise": "^3.5.0",
"eslint-plugin-standard": "^2.1.1",
"jest": "^19.0.2",
"rimraf": "^2.6.1"
},
Expand Down

0 comments on commit d4190df

Please sign in to comment.