Skip to content

Commit cb660a7

Browse files
authored
add github action to enforce code lint (#83)
* update npm ignore * add lint script * fix eslint errors * add lint github action on push and PR
1 parent f9c75e9 commit cb660a7

File tree

4 files changed

+31
-11
lines changed

4 files changed

+31
-11
lines changed

.github/workflows/lint.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: run eslint on code
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
lint:
7+
runs-on: ubuntu-latest
8+
9+
steps:
10+
- uses: actions/checkout@v2
11+
- name: install modules
12+
run: yarn
13+
- name: run lint
14+
run: yarn lint
15+
env:
16+
CI: true

.npmignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
11
docs/*
22
website/*
3+
.eslintrc.js
4+
.prettierrc.js
5+
.github/*
6+
.vscode/*

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"description": "A simple wrapper around the youtube iframe js API for react native",
55
"main": "index.js",
66
"scripts": {
7+
"lint": "eslint index.js src",
78
"test": "echo \"Error: no test specified\" && exit 1"
89
},
910
"repository": {

src/constants.js

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
export const PLAY_MODE = true;
32
export const PAUSE_MODE = false;
43
export const MUTE_MODE = true;
@@ -15,11 +14,11 @@ export const PLAYER_STATES_NAMES = {
1514

1615
export const PLAYER_STATES = {
1716
'-1': PLAYER_STATES_NAMES.UNSTARTED,
18-
'0': PLAYER_STATES_NAMES.ENDED,
19-
'1': PLAYER_STATES_NAMES.PLAYING,
20-
'2': PLAYER_STATES_NAMES.PAUSED,
21-
'3': PLAYER_STATES_NAMES.BUFFERING,
22-
'5': PLAYER_STATES_NAMES.VIDEO_CUED,
17+
0: PLAYER_STATES_NAMES.ENDED,
18+
1: PLAYER_STATES_NAMES.PLAYING,
19+
2: PLAYER_STATES_NAMES.PAUSED,
20+
3: PLAYER_STATES_NAMES.BUFFERING,
21+
5: PLAYER_STATES_NAMES.VIDEO_CUED,
2322
};
2423

2524
export const PLAYER_ERROR_NAMES = {
@@ -30,11 +29,11 @@ export const PLAYER_ERROR_NAMES = {
3029
};
3130

3231
export const PLAYER_ERROR = {
33-
'2': PLAYER_ERROR_NAMES.INVALID_PARAMETER,
34-
'5': PLAYER_ERROR_NAMES.HTML5_ERROR,
35-
'100': PLAYER_ERROR_NAMES.VIDEO_NOT_FOUND,
36-
'101': PLAYER_ERROR_NAMES.EMBED_NOT_ALLOWED,
37-
'150': PLAYER_ERROR_NAMES.EMBED_NOT_ALLOWED,
32+
2: PLAYER_ERROR_NAMES.INVALID_PARAMETER,
33+
5: PLAYER_ERROR_NAMES.HTML5_ERROR,
34+
100: PLAYER_ERROR_NAMES.VIDEO_NOT_FOUND,
35+
101: PLAYER_ERROR_NAMES.EMBED_NOT_ALLOWED,
36+
150: PLAYER_ERROR_NAMES.EMBED_NOT_ALLOWED,
3837
};
3938

4039
export const CUSTOM_USER_AGENT =

0 commit comments

Comments
 (0)