Skip to content

Commit

Permalink
using more NodeJS best practices
Browse files Browse the repository at this point in the history
- switching to gulp from grunt
- switching from jshint to eslint
- changing test to use expect
- move bin/ to lib/ fixing package
  • Loading branch information
haysclark committed Jan 20, 2017
1 parent 3ba0e69 commit 9fb5cb2
Show file tree
Hide file tree
Showing 19 changed files with 415 additions and 125 deletions.
Binary file added .DS_Store
Binary file not shown.
28 changes: 16 additions & 12 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,21 +1,25 @@
# EditorConfig helps developers define and maintain consistent
# coding styles between different editors and IDEs
# editorconfig.org
# EditorConfig is awesome: http://EditorConfig.org

root = true


[*]
charset = utf-8
end_of_line = lf

# Change these settings to your own preference
indent_style = tab
# indent_size = 4
[*.js]
indent_style = space
indent_size = 4
trim_trailing_whitespace = true
insert_final_newline = true

# We recommend you to keep these unchanged
end_of_line = lf
charset = utf-8
[*.{json,xml}]
indent_style = space
indent_size = 2
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false
[*.{md,txt}]
indent_style = space
indent_size = 4
trim_trailing_whitespace = false
insert_final_newline = false
160 changes: 160 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
{
"root": true,
"parser": "espree",
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "script",
"ecmaFeatures": {}
},
"plugins": [],
"env": {
"node": true
},
"globals": {
"Promise": false
},
"rules": {

// Possible Errors (fully reviewed 2016-07-05)

"no-cond-assign": 2,
"no-console": 0,
"no-constant-condition": 2,
"no-control-regex": 2,
"no-debugger": 2,
"no-dupe-args": 2,
"no-dupe-keys": 2,
"no-duplicate-case": 2,
"no-empty": [2, { "allowEmptyCatch": false }],
"no-empty-character-class": 2,
"no-ex-assign": 2,
"no-extra-boolean-cast": 2,
"no-extra-parens": [2, "all"],
"no-extra-semi": 2,
"no-func-assign": 2,
"no-inner-declarations": [2, "functions"],
"no-invalid-regexp": 2,
"no-irregular-whitespace": [2, { "skipComments": false }],
"no-negated-in-lhs": 2,
"no-obj-calls": 2,
"no-prototype-builtins": 2,
"no-regex-spaces": 2,
"no-sparse-arrays": 2,
"no-unexpected-multiline": 2,
"no-unreachable": 2,
"no-unsafe-finally": 2,
"use-isnan": 2,
"valid-jsdoc": 0,
"valid-typeof": 2,

// Best Practices

"accessor-pairs": 2,
"curly": [2, "multi-line"],
"dot-location": [2, "property"],
"eqeqeq": 2,
"no-caller": 2,
"no-empty-pattern": 0, // for ES6 destructuring
"no-eval": 2,
"no-extend-native": 2,
"no-extra-bind": 2,
"no-fallthrough": 2,
"no-floating-decimal": 2,
"no-implied-eval": 2,
"no-iterator": 2,
"no-labels": 2,
"no-lone-blocks": 2,
"no-magic-numbers": 0,
"no-multi-spaces": 2,
"no-multi-str": 2,
"no-native-reassign": 2,
"no-new": 2,
"no-new-func": 2,
"no-new-wrappers": 2,
"no-octal": 2,
"no-octal-escape": 2,
"no-proto": 2,
"no-redeclare": 2,
"no-return-assign": [2, "except-parens"],
"no-self-assign": 2,
"no-self-compare": 2,
"no-sequences": 2,
"no-throw-literal": 2,
"no-unmodified-loop-condition": 2,
"no-useless-call": 2,
"no-useless-escape": 2,
"no-with": 2,
"wrap-iife": [2, "inside"],
"yoda": 2,

// Strict Mode (fully reviewed 2016-07-05)

"strict": [2, "safe"],

// Variables (fully reviewed 2016-07-05)

"init-declarations": [2, "always"],
"no-catch-shadow": 0,
"no-delete-var": 2,
"no-label-var": 2,
"no-restricted-globals": 0,
"no-shadow": [2, { "builtinGlobals": false, "hoist": "all", "allow": [] }],
"no-shadow-restricted-names": 2,
"no-undef": [2, { "typeof": true }],
"no-undef-init": 2,
"no-undefined": 0,
"no-unused-vars": [2, { "vars": "local", "args": "none", "caughtErrors": "none" }],
"no-use-before-define": [2, { "functions": false, "classes": true }],

// Node.js and CommonJS (fully reviewed 2016-07-05)

"callback-return": 0,
"global-require": 0,
"handle-callback-err": [2, "^(err|error)$" ],
"no-mixed-requires": 0,
"no-new-require": 2,
"no-path-concat": 2,
"no-process-env": 2,
"no-process-exit": 2,
"no-restricted-modules": 0,
"no-sync": 2,

// Stylistic Issues

"block-spacing": 2,
"brace-style": [2, "1tbs", { "allowSingleLine": true }],
"camelcase": [2, { "properties": "never" }],
"comma-dangle": [2, "never"],
"comma-spacing": 2,
"comma-style": 2,
"eol-last": 2,
"indent": [2, 4, { "SwitchCase": 1 }],
"jsx-quotes": 0,
"key-spacing": 2,
"keyword-spacing": 2,
"new-cap": 0,
"new-parens": 2,
"no-array-constructor": 2,
"no-mixed-spaces-and-tabs": 2,
"no-multiple-empty-lines": [2, { "max": 2, "maxBOF": 0, "maxEOF": 1 }],
"no-new-object": 2,
"no-plusplus": [2, { "allowForLoopAfterthoughts": false }],
"no-spaced-func": 2,
"no-trailing-spaces": 2,
"no-unneeded-ternary": [2, { "defaultAssignment": false }],
"no-whitespace-before-property": 2,
"one-var": 0,
"operator-linebreak": [2, "after", { "overrides": { "?": "before", ":": "before" } }],
"padded-blocks": 0,
"quotes": [2, "single", "avoid-escape"],
"semi": [2, "always"],
"semi-spacing": 2,
"space-before-blocks": 2,
"space-before-function-paren": [2, {"anonymous": "always", "named": "never"}],
"space-in-parens": 0,
"space-infix-ops": 0,
"space-unary-ops": 2,
"spaced-comment": 0

}
}
14 changes: 11 additions & 3 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
.idea
node_modules
coverage
test

.editorconfig
.eslintrc.json
.git
.gitignore
.publishrc
.travis.yml
node_modules
spec
coverage
gulpfile.js

.DS_Store
npm-debug.log
13 changes: 13 additions & 0 deletions .publishrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"validations": {
"vulnerableDependencies": true,
"uncommittedChanges": true,
"untrackedFiles": true,
"sensitiveData": true,
"branch": "master",
"gitTag": true
},
"confirm": true,
"publishTag": "latest",
"prePublishScript": "npm run test-publish"
}
8 changes: 4 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
language: node_js
node_js:
- "6.2"
sudo: false

after_success:
- ./node_modules/.bin/istanbul cover -x '**/spec/**' ./node_modules/mocha/bin/_mocha --report lcovonly -- --recursive --require spec/helpers/chai.js spec && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage
node_js:
- "4"
- "6"
23 changes: 0 additions & 23 deletions Gruntfile.js

This file was deleted.

5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
Marine Traffic Self Reporter [![Build Status](https://travis-ci.org/haysclark/marinetraffic-reportbuilder.svg)](https://travis-ci.org/haysclark/marinetraffic-reportbuilder)[![Coverage Status](https://coveralls.io/repos/github/haysclark/marinetraffic-reportbuilder/badge.svg?branch=develop)](https://coveralls.io/github/haysclark/marinetraffic-reportbuilder?branch=develop)[![npm version](https://badge.fury.io/js/marinetraffic-reportbuilder.svg)](http://badge.fury.io/js/marinetraffic-reportbuilder)
===========================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================
Marine Traffic Self Reporter
============================
[![Build Status](https://travis-ci.org/haysclark/marinetraffic-reportbuilder.svg)](https://travis-ci.org/haysclark/marinetraffic-reportbuilder) [![Coverage Status](https://coveralls.io/repos/github/haysclark/marinetraffic-reportbuilder/badge.svg?branch=develop)](https://coveralls.io/github/haysclark/marinetraffic-reportbuilder?branch=develop) [![Dependencies Status](https://david-dm.org/haysclark/marinetraffic-reportbuilder.svg)](https://david-dm.org) [![Known Vulnerabilities](https://snyk.io/test/github/haysclark/marinetraffic-reportbuilder/badge.svg)](https://snyk.io/test/github/haysclark/marinetraffic-reportbuilder)

A builder for creating Marine Traffic position reports.

Expand Down
7 changes: 0 additions & 7 deletions grunt/jshint.yaml

This file was deleted.

2 changes: 0 additions & 2 deletions grunt/mocha_istanbul.yaml

This file was deleted.

5 changes: 0 additions & 5 deletions grunt/mochacli.yaml

This file was deleted.

Loading

0 comments on commit 9fb5cb2

Please sign in to comment.