Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitda8af44

Browse files
authored
feat: enforce action.type (#36)
- action.type must be a string or Symbol (the latter may or may not bedropped, so test support can also be removed easily)- use npm scripts instead of Makefile- use Babel 6- use nyc for code coverage and coveralls- test against latest versions of Node LTS- add editorconfig- upgrade all dependencies except eslint-plugin-import- Remove unnecessary test helper- Add yarn.lock
1 parent9634938 commitda8af44

File tree

14 files changed

+3297
-61
lines changed

14 files changed

+3297
-61
lines changed

‎.babelrc‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
{
2-
"stage":0,
3-
"loose":"all"
2+
"presets": ["stage-0", ["es2015", {"loose":true }]],
3+
"env": {
4+
"test": {
5+
"plugins": ["istanbul"]
6+
}
7+
}
48
}

‎.editorconfig‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
root =true
2+
3+
[*]
4+
5+
# Change these settings to your own preference
6+
indent_style =space
7+
indent_size =2
8+
9+
# We recommend you to keep these unchanged
10+
end_of_line =lf
11+
charset =utf-8
12+
trim_trailing_whitespace =true
13+
insert_final_newline =true
14+
15+
[*.md]
16+
trim_trailing_whitespace =false

‎.eslintrc‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"extends": "eslint-config-airbnb",
2+
"extends": "eslint-config-airbnb-base",
33
"env": {
44
"mocha": true,
55
"node": true
@@ -8,8 +8,8 @@
88
"expect": true
99
},
1010
"rules": {
11-
"padded-blocks": 0,
12-
"no-use-before-define":[2, "nofunc"],
13-
"no-unused-expressions":0
11+
"no-use-before-define": 0,
12+
"no-unused-expressions":0,
13+
"import/no-extraneous-dependencies":["error", {"devDependencies": ["!test/**/*.js"]}]
1414
}
1515
}

‎.gitignore‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@ node_modules
22
coverage
33
*.log
44
lib
5+
.idea
6+
.nyc_output

‎.npmignore‎

Lines changed: 0 additions & 5 deletions
This file was deleted.

‎.travis.yml‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
sudo:false
12
language:node_js
23
node_js:
3-
-"iojs"
4+
-"stable"
5+
-4
6+
7+
after_success:"cat ./coverage/lcov.info | ./node_modules/.bin/coveralls"

‎Makefile‎

Lines changed: 0 additions & 24 deletions
This file was deleted.

‎package.json‎

Lines changed: 41 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,17 @@
33
"version":"0.6.1",
44
"description":"A human-friendly standard for Flux action objects",
55
"main":"lib/index.js",
6+
"files": [
7+
"lib"
8+
],
69
"scripts": {
7-
"test":"make test",
8-
"prepublish":"make clean build"
10+
"prebuild":"npm run clean",
11+
"build":"babel src --out-dir lib",
12+
"clean":"rimraf lib/",
13+
"lint":"eslint src/ test/",
14+
"prepublish":"npm test && npm run build",
15+
"pretest":"npm run lint",
16+
"test":"cross-env NODE_ENV=test nyc mocha"
917
},
1018
"keywords": [
1119
"flux",
@@ -16,15 +24,39 @@
1624
"author":"Andrew Clark <acdlite@me.com>",
1725
"license":"MIT",
1826
"devDependencies": {
19-
"babel":"^5.6.14",
20-
"babel-core":"^5.6.15",
21-
"babel-eslint":"^4.1.8",
27+
"babel-cli":"^6.16.0",
28+
"babel-core":"^6.17.0",
29+
"babel-eslint":"^7.0.0",
30+
"babel-plugin-istanbul":"^2.0.1",
31+
"babel-preset-es2015":"^6.16.0",
32+
"babel-preset-stage-0":"^6.16.0",
2233
"chai":"^3.0.0",
23-
"eslint":"^0.24.0",
24-
"eslint-config-airbnb":"0.0.6",
25-
"mocha":"^2.2.5"
34+
"coveralls":"^2.11.14",
35+
"cross-env":"^3.1.1",
36+
"eslint":"^3.7.1",
37+
"eslint-config-airbnb-base":"^8.0.0",
38+
"eslint-plugin-import":"^1.0.0",
39+
"mocha":"^3.0.0",
40+
"nyc":"^8.3.0",
41+
"rimraf":"^2.5.4"
2642
},
2743
"dependencies": {
28-
"lodash.isplainobject":"^3.2.0"
44+
"lodash.isplainobject":"^4.0.6",
45+
"lodash.isstring":"^4.0.1",
46+
"lodash.issymbol":"^4.0.1"
47+
},
48+
"nyc": {
49+
"all":true,
50+
"sourceMap":false,
51+
"instrument":false,
52+
"reporter": [
53+
"text-summary",
54+
"lcov"
55+
],
56+
"check-coverage":true,
57+
"lines":100,
58+
"statements":100,
59+
"functions":100,
60+
"branches":100
2961
}
3062
}

‎src/__tests__/init.js‎

Lines changed: 0 additions & 2 deletions
This file was deleted.

‎src/index.js‎

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
importisPlainObjectfrom'lodash.isplainobject';
2-
3-
constvalidKeys=[
4-
'type',
5-
'payload',
6-
'error',
7-
'meta'
8-
];
9-
10-
functionisValidKey(key){
11-
returnvalidKeys.indexOf(key)>-1;
12-
}
2+
importisStringfrom'lodash.isstring';
3+
importisSymbolfrom'lodash.issymbol';
134

145
exportfunctionisFSA(action){
156
return(
167
isPlainObject(action)&&
17-
typeofaction.type!=='undefined'&&
8+
(isString(action.type)||isSymbol(action.type))&&
189
Object.keys(action).every(isValidKey)
1910
);
2011
}
2112

2213
exportfunctionisError(action){
2314
returnaction.error===true;
2415
}
16+
17+
functionisValidKey(key){
18+
return[
19+
'type',
20+
'payload',
21+
'error',
22+
'meta',
23+
].indexOf(key)>-1;
24+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp