This repository was archived by the owner on Dec 6, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 54
[WIP] Eslint integration #70
Open
duckontheweb
wants to merge
8
commits into
wbyoung:master
Choose a base branch
from
duckontheweb:eslint
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
2483a0f
Remove jscs and jshint dependencies
796814f
Basic running install of eslint
e282168
Create eslint configs consistent with current project style
12bd748
Add npm-debug.log to .gitignore
60f82a8
Clean up JSDocs lint errors
55dcbe9
Clean up style-related lint errors
c28f3da
Clean up shadowed variables
3cde23a
Use .eslintrc files instead of .yml for eslint configs
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
{ | ||
"env": { | ||
"node": true | ||
}, | ||
|
||
"extends": [ | ||
"airbnb-base", | ||
"./.eslintrc-es6" | ||
], | ||
|
||
"parserOptions": { | ||
"sourceType": "script" | ||
}, | ||
|
||
"rules": { | ||
"curly": ["error", "all"], | ||
"no-undefined": "error", | ||
"strict": ["error", "global"], | ||
"comma-dangle": ["error", "always-multiline"], | ||
"no-mixed-spaces-and-tabs": ["error", "smart-tabs"], | ||
"no-empty": "off", | ||
"func-style": ["error", "expression"], | ||
"keyword-spacing": ["error", { | ||
"overrides": { | ||
"function": { | ||
"after": false | ||
} | ||
} | ||
}], | ||
"no-multiple-empty-lines": "off", | ||
"max-len": ["error", 80], | ||
"max-lines": ["error", 1000], | ||
"padding-line-between-statements": ["error", { | ||
"blankLine": "always", | ||
"prev": "*", | ||
"next": "export" | ||
}, { | ||
"blankLine": "always", | ||
"prev": "directive", | ||
"next": "*" | ||
}], | ||
"consistent-this": ["error", "self"], | ||
"space-before-function-paren": ["error", "never"], | ||
"valid-jsdoc": "error", | ||
"func-names": "off", | ||
"consistent-return": "off", | ||
"no-console": "off", | ||
"indent": ["error", 2, { | ||
"MemberExpression": 0, | ||
"CallExpression": { | ||
"arguments": "off" | ||
}, | ||
"FunctionExpression": { | ||
"parameters": "off" | ||
} | ||
}], | ||
"function-paren-newline": "off", | ||
"one-var": "off", | ||
"padded-blocks": "off", | ||
"global-require": "off", | ||
"no-underscore-dangle": "off", | ||
"vars-on-top": "off", | ||
"no-param-reassign": "off", | ||
"one-var-declaration-per-line": "off", | ||
"no-return-assign": "off", | ||
"no-mixed-operators": "off", | ||
"brace-style": "off", | ||
"wrap-iife": ["error", "inside"] | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"env": { | ||
"es6": "off" | ||
}, | ||
|
||
"rules": { | ||
"prefer-arrow-callback": "off", | ||
"prefer-template": "off", | ||
"prefer-destructuring": "off", | ||
"import/no-unresolved": "off", | ||
"no-var": "off", | ||
"object-shorthand": "off", | ||
"prefer-rest-params": "off" | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
npm-debug.log | ||
/node_modules | ||
/coverage |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,7 +15,7 @@ var isNoEntry = require('../util/codes').isNoEntry; | |
* @private | ||
* @function setup.install.~moduleVersion | ||
* @param {String} module The path to the module. | ||
* @return {Promise} | ||
* @return {Promise} Promise that resolves to version number. | ||
*/ | ||
var moduleVersion = function(module) { | ||
return fs.readFile(path.join(module, 'package.json'), 'utf8') | ||
|
@@ -32,7 +32,8 @@ var moduleVersion = function(module) { | |
* @function setup.install.~install | ||
* @param {String} src The source location. | ||
* @param {String} dst The destination location. | ||
* @return {Promise} | ||
* @return {Promise} Promise that resolves to a string indicating if the / | ||
* module was updated or complete. | ||
*/ | ||
var install = function(src, dst) { | ||
var srcVersion, dstVersion; | ||
|
@@ -63,7 +64,8 @@ var install = function(src, dst) { | |
* | ||
* @private | ||
* @function setup.install.~avn | ||
* @return {Promise} | ||
* @return {Promise} Promise that resolves when install avn setup is complete / | ||
* and indicates if any action took place. | ||
*/ | ||
var avn = function() { | ||
var src = path.resolve(path.join(__dirname, '../..')) + '/'; | ||
|
@@ -81,11 +83,12 @@ var avn = function() { | |
* | ||
* @private | ||
* @function setup.install.~plugins | ||
* @return {Promise} | ||
* @return {Promise} Promise that resolves when plugin installation is / | ||
* complete and indicates if any action took place. | ||
*/ | ||
var plugins = function() { | ||
return installedPlugins().then(function(plugins) { | ||
return Promise.all(plugins.map(function(plugin) { | ||
return installedPlugins().then(function(_plugins) { | ||
return Promise.all(_plugins.map(function(plugin) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the no-underscore-dangle rule should be erroring here; can we pick a better name, like |
||
var src = plugin.path + '/'; | ||
var dst = path.join(process.env.HOME, | ||
path.join('.avn/plugins', plugin.moduleName)); | ||
|
@@ -104,7 +107,8 @@ var plugins = function() { | |
* | ||
* @private | ||
* @function setup.install.all | ||
* @return {Promise} | ||
* @return {Promise} Promise that resolves when avn and plugins have been / | ||
* installed. | ||
* @see {@link plugins.~all} | ||
*/ | ||
module.exports.all = function() { | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,16 +10,16 @@ var path = require('path'); | |
* | ||
* @private | ||
* @function setup.plugins.~modules | ||
* @return {Promise} | ||
* @return {Promise} Promise that resolves to a list of plugins. | ||
*/ | ||
var modules = function() { | ||
return Promise.resolve() | ||
.then(function() { return npm.loadAsync(); }) | ||
.then(function(npm) { | ||
npm.config.set('spin', false); | ||
npm.config.set('global', true); | ||
npm.config.set('depth', 0); | ||
return Promise.promisify(npm.commands.list)([], true); | ||
.then(function(_npm) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same throughout; let's please not add leading underscores to things :-) |
||
_npm.config.set('spin', false); | ||
_npm.config.set('global', true); | ||
_npm.config.set('depth', 0); | ||
return Promise.promisify(_npm.commands.list)([], true); | ||
}) | ||
.then(function(data) { return data; }); | ||
}; | ||
|
@@ -31,7 +31,8 @@ var modules = function() { | |
* | ||
* @private | ||
* @function setup.plugins.installed | ||
* @return {Promise} | ||
* @return {Promise} Promise that resolves to a list of globally installed / | ||
* plugins. | ||
*/ | ||
module.exports.installed = function() { | ||
return Promise.resolve() | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,8 +11,8 @@ | |
"avn": "./bin-public/avn" | ||
}, | ||
"scripts": { | ||
"test": "jshint . && jscs . && istanbul cover node_modules/.bin/_mocha --report html --", | ||
"test-travis": "jshint . && jscs . && istanbul cover node_modules/.bin/_mocha --report lcovonly --" | ||
"test": "eslint lib && istanbul cover node_modules/.bin/_mocha --report html --", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i'd recommend adding this in |
||
"test-travis": "eslint lib && istanbul cover node_modules/.bin/_mocha --report lcovonly --" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
|
@@ -45,9 +45,10 @@ | |
"chai-as-promised": "^5.1.0", | ||
"concat-stream": "^1.4.6", | ||
"coveralls": "^2.10.0", | ||
"eslint": "4.11.0", | ||
"eslint-config-airbnb-base": "12.1.0", | ||
"eslint-plugin-import": "2.8.0", | ||
"istanbul": "^0.4.2", | ||
"jscs": "^3.0.4", | ||
"jshint": "^2.8.0", | ||
"mocha": "^2.0.1", | ||
"sinon": "^1.10.2", | ||
"sinon-chai": "^2.8.0", | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is a file named "es6" turning off the es6 env?
also, why is this a separate file at all, instead of just being in the root eslintrc?