Skip to content

Commit

Permalink
add eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
caub committed Aug 24, 2021
1 parent c071b85 commit 33febea
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 7 deletions.
22 changes: 22 additions & 0 deletions .eslintrc
@@ -0,0 +1,22 @@
{
"extends": [
"eslint:recommended"
],
"env": {
"node": true,
"es6": false,
},
"globals": {
"Promise": true // used only when no callback are passed
},
"rules": {
"no-control-regex": "warn",
"no-prototype-builtins": "warn",
"indent": ["warn", 2, {"SwitchCase": 1}],
"linebreak-style": ["warn", "unix"],
"quotes": ["warn", "single"],
"no-unused-vars": "warn",
"no-sequences": "error",
"no-unused-expressions": "error",
}
}
3 changes: 3 additions & 0 deletions .travis.yml
Expand Up @@ -5,4 +5,7 @@ node_js:
- "4"
- "5"

before_script:
- npx eslint . --quiet

sudo: false
2 changes: 1 addition & 1 deletion lib/prompt.js
Expand Up @@ -523,7 +523,7 @@ prompt.getInput = function (prop, callback) {
// Calculate the raw length and colorize the prompt
//
length = raw.join('').length;
raw[0] = raw[0];
// raw[0] = raw[0];
msg = raw.join('');

if (schema.help) {
Expand Down
3 changes: 2 additions & 1 deletion package.json
Expand Up @@ -25,7 +25,8 @@
"winston": "2.x"
},
"devDependencies": {
"vows": "0.7.0"
"eslint": "^7.32.0",
"vows": "^0.7.0"
},
"main": "./lib/prompt",
"scripts": {
Expand Down
6 changes: 3 additions & 3 deletions test/helpers.js
Expand Up @@ -90,12 +90,12 @@ helpers.schema = {
properties: {
oldschema: {
message: 'Enter your username',
validator: /^[\w|\-]+$/,
validator: /^[\w|-]+$/,
warning: 'username can only be letters, numbers, and dashes',
empty: false
},
riffwabbles: {
pattern: /^[\w|\-]+$/,
pattern: /^[\w|-]+$/,
message: 'riffwabbles can only be letters, numbers, and dashes',
default: 'foobizzles'
},
Expand Down Expand Up @@ -127,7 +127,7 @@ helpers.schema = {
type: 'boolean'
},
username: {
pattern: /^[\w|\-]+$/,
pattern: /^[\w|-]+$/,
message: 'Username can only be letters, numbers, and dashes'
},
notblank: {
Expand Down
4 changes: 2 additions & 2 deletions test/prompt-test.js
Expand Up @@ -22,11 +22,11 @@ function grab () {
complete = { schema: {} };

names.forEach(function (name) {
complete.path = [name],
complete.path = [name];
complete.schema = schema.properties[name];
});
return complete;
};
}

//
// Reset the prompt for mock testing
Expand Down

0 comments on commit 33febea

Please sign in to comment.