Skip to content

Commit cac5d9f

Browse files
authored
Updates for 0.11 (#11)
* Updates for 0.11 * eslint * eslint --fix
1 parent 54ac432 commit cac5d9f

File tree

10 files changed

+89
-90
lines changed

10 files changed

+89
-90
lines changed

.eslintrc

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{
2+
"env": {
3+
"node": true,
4+
},
5+
"rules": {
6+
"valid-jsdoc": [2, {
7+
"prefer": { "return": "returns" },
8+
"requireReturn": true,
9+
"requireParamDescription": true,
10+
"requireReturnDescription": false
11+
}],
12+
"camelcase": 1,
13+
"no-multi-spaces": 0,
14+
"comma-spacing": 1,
15+
"comma-style": [2, "first"],
16+
"consistent-return": 0,
17+
"eol-last": 1,
18+
"indent": [1, 4],
19+
"no-use-before-define": [2, "nofunc"],
20+
"no-process-exit": 0,
21+
"no-trailing-spaces": 1,
22+
"no-underscore-dangle": 0,
23+
"no-unused-vars": 1,
24+
"space-infix-ops": 1,
25+
"quotes": [1, "single"],
26+
"semi": [1, "always"],
27+
"semi-spacing": 1,
28+
"strict": [2, "global"],
29+
"yoda": [1, "never"]
30+
},
31+
"globals": {
32+
"describe": true,
33+
"it": true,
34+
"before": true,
35+
"beforeEach": true,
36+
"after": true,
37+
"afterEach": true
38+
}
39+
}

.gitignore

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
/.*
22
!/.gitignore
3-
!/.jscsrc
4-
!/.jshintrc
3+
!/.eslintrc
54
!/.travis.yml
65
/bower_components/
76
/node_modules/

.jscsrc

-17
This file was deleted.

.jshintrc

-19
This file was deleted.

.travis.yml

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ script:
99
- bower install --production
1010
- npm run -s build
1111
- bower install
12-
- npm test
1312
after_success:
1413
- >-
1514
test $TRAVIS_TAG &&

bower.json

+5-5
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@
1616
"package.json"
1717
],
1818
"dependencies": {
19-
"purescript-console": "^2.0.0",
20-
"purescript-node-streams": "^2.0.0",
21-
"purescript-node-process": "^3.0.0",
22-
"purescript-options": "^2.0.0",
23-
"purescript-foreign": "^3.0.0"
19+
"purescript-console": "^3.0.0",
20+
"purescript-node-streams": "^3.0.0",
21+
"purescript-node-process": "^4.0.0",
22+
"purescript-options": "^3.0.0",
23+
"purescript-foreign": "^4.0.0"
2424
}
2525
}

package.json

+5-7
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,13 @@
22
"private": true,
33
"scripts": {
44
"clean": "rimraf output && rimraf .pulp-cache",
5-
"build": "jshint src && jscs src && pulp build --censor-lib --strict",
6-
"test": "pulp build -I test"
5+
"build": "eslint src && pulp build -- --censor-lib --strict"
76
},
87
"devDependencies": {
9-
"jscs": "^3.0.7",
10-
"jshint": "^2.9.4",
11-
"pulp": "^9.0.1",
12-
"purescript-psa": "^0.3.9",
13-
"purescript": "^0.10.1",
8+
"eslint": "^3.17.1",
9+
"pulp": "^11.0.0",
10+
"purescript-psa": "^0.5.0",
11+
"purescript": "^0.11.1",
1412
"rimraf": "^2.5.4"
1513
}
1614
}

src/Node/ReadLine.js

+33-33
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,53 @@
11
/* global exports */
2-
"use strict";
2+
'use strict';
33

44
// module Node.ReadLine
55

66
exports.createInterfaceImpl = function (options) {
7-
return function () {
8-
var readline = require("readline");
9-
return readline.createInterface({
10-
input: options.input,
11-
output: options.output,
12-
completer: options.completer && function (line) {
13-
var res = options.completer(line)();
14-
return [res.completions, res.matched];
15-
},
16-
terminal: options.terminal,
17-
historySize: options.historySize
18-
});
19-
};
7+
return function () {
8+
var readline = require('readline');
9+
return readline.createInterface(
10+
{ input: options.input
11+
, output: options.output
12+
, completer: options.completer && function (line) {
13+
var res = options.completer(line)();
14+
return [res.completions, res.matched];
15+
}
16+
, terminal: options.terminal
17+
, historySize: options.historySize
18+
});
19+
};
2020
};
2121

2222
exports.close = function (readline) {
23-
return function () {
24-
readline.close();
25-
};
23+
return function () {
24+
readline.close();
25+
};
2626
};
2727

2828
exports.prompt = function (readline) {
29-
return function () {
30-
readline.prompt();
31-
};
29+
return function () {
30+
readline.prompt();
31+
};
3232
};
3333

3434
exports.setPrompt = function (prompt) {
35-
return function (length) {
36-
return function (readline) {
37-
return function () {
38-
readline.setPrompt(prompt, length);
39-
};
35+
return function (length) {
36+
return function (readline) {
37+
return function () {
38+
readline.setPrompt(prompt, length);
39+
};
40+
};
4041
};
41-
};
4242
};
4343

4444
exports.setLineHandler = function (readline) {
45-
return function (callback) {
46-
return function () {
47-
readline.removeAllListeners("line");
48-
readline.on("line", function (line) {
49-
callback(line)();
50-
});
45+
return function (callback) {
46+
return function () {
47+
readline.removeAllListeners('line');
48+
readline.on('line', function (line) {
49+
callback(line)();
50+
});
51+
};
5152
};
52-
};
5353
};

src/Node/ReadLine.purs

+5-5
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ module Node.ReadLine
2121

2222
import Prelude
2323

24-
import Control.Monad.Eff (Eff)
24+
import Control.Monad.Eff (kind Effect, Eff)
2525
import Control.Monad.Eff.Console (CONSOLE)
2626
import Control.Monad.Eff.Exception (EXCEPTION)
2727

@@ -34,10 +34,10 @@ import Node.Stream (Readable, Writable)
3434
-- | A handle to a console interface.
3535
-- |
3636
-- | A handle can be created with the `createInterface` function.
37-
foreign import data Interface :: *
37+
foreign import data Interface :: Type
3838

3939
-- | The effect of interacting with a stream via an `Interface`
40-
foreign import data READLINE :: !
40+
foreign import data READLINE :: Effect
4141

4242
foreign import createInterfaceImpl
4343
:: forall eff
@@ -83,8 +83,8 @@ createInterface input opts = createInterfaceImpl
8383
-- | Create an interface with the specified completion function.
8484
createConsoleInterface
8585
:: forall eff
86-
. Completer (readline :: READLINE, console :: CONSOLE, err :: EXCEPTION | eff)
87-
-> Eff (readline :: READLINE, console :: CONSOLE, err :: EXCEPTION | eff) Interface
86+
. Completer (readline :: READLINE, console :: CONSOLE, exception :: EXCEPTION | eff)
87+
-> Eff (readline :: READLINE, console :: CONSOLE, exception :: EXCEPTION | eff) Interface
8888
createConsoleInterface compl =
8989
createInterface stdin
9090
$ output := stdout

test/Main.purs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import Control.Monad.Eff.Exception (EXCEPTION)
88

99
import Node.ReadLine (READLINE, prompt, close, setLineHandler, setPrompt, noCompletion, createConsoleInterface)
1010

11-
main :: forall eff. Eff (readline::READLINE, console::CONSOLE, err :: EXCEPTION | eff) Unit
11+
main :: forall eff. Eff (readline :: READLINE, console :: CONSOLE, exception :: EXCEPTION | eff) Unit
1212
main = do
1313
interface <- createConsoleInterface noCompletion
1414
setPrompt "> " 2 interface

0 commit comments

Comments
 (0)