Skip to content

Commit 1fb73f0

Browse files
authored
Merge pull request #31 from FormidableLabs/feature/trailing-commas
Update prettier and eslint rules to enforce trailing comma
2 parents ac996b2 + a696d95 commit 1fb73f0

File tree

6 files changed

+326
-17
lines changed

6 files changed

+326
-17
lines changed

.eslintrc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
---
22
extends:
33
- formidable
4+
- prettier
45
plugins:
56
- jest
67
env:
@@ -16,3 +17,6 @@ rules:
1617
- off
1718
arrow-parens:
1819
- off
20+
comma-dangle:
21+
- 2
22+
- always-multiline

.prettierrc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
22
"printWidth": 100,
3-
"singleQuote": true
3+
"singleQuote": true,
4+
"semi": true
45
}

index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,9 @@ export default class AppAuth {
6161
return await fetch(openidConfig.revocation_endpoint, {
6262
method: 'POST',
6363
headers: {
64-
'Content-Type': 'application/x-www-form-urlencoded'
64+
'Content-Type': 'application/x-www-form-urlencoded',
6565
},
66-
body: `token=${tokenToRevoke}${sendClientId ? `&client_id=${this.config.clientId}` : ''}`
66+
body: `token=${tokenToRevoke}${sendClientId ? `&client_id=${this.config.clientId}` : ''}`,
6767
}).catch(error => {
6868
throw new Error('Failed to revoke token', error);
6969
});

index.spec.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ jest.mock('react-native', () => ({
44
NativeModules: {
55
RNAppAuth: {
66
authorize: jest.fn(),
7-
refresh: jest.fn()
8-
}
9-
}
7+
refresh: jest.fn(),
8+
},
9+
},
1010
}));
1111

1212
describe('AppAuth', () => {
@@ -16,7 +16,7 @@ describe('AppAuth', () => {
1616
const config = {
1717
issuer: 'test-issuer',
1818
redirectUrl: 'test-redirectUrl',
19-
clientId: 'test-clientId'
19+
clientId: 'test-clientId',
2020
};
2121

2222
beforeAll(() => {

package.json

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,14 @@
55
"main": "index.js",
66
"scripts": {
77
"test": "jest",
8-
"lint": "eslint ."
8+
"lint": "eslint .",
9+
"precommit": "lint-staged"
10+
},
11+
"lint-staged": {
12+
"*.js": [
13+
"eslint --fix",
14+
"git add"
15+
]
916
},
1017
"files": [
1118
"package.json",
@@ -44,11 +51,14 @@
4451
"babel-preset-env": "^1.6.1",
4552
"eslint": "2.10.2",
4653
"eslint-config-formidable": "^3.0.0",
54+
"eslint-config-prettier": "^2.9.0",
4755
"eslint-plugin-filenames": "^1.2.0",
4856
"eslint-plugin-import": "^2.8.0",
4957
"eslint-plugin-jest": "^21.3.2",
58+
"husky": "^0.14.3",
5059
"invariant": "^2.2.2",
5160
"jest": "^21.2.1",
61+
"lint-staged": "^6.1.0",
5262
"react": "^16.1.1",
5363
"react-native": "^0.50.3"
5464
},

0 commit comments

Comments
 (0)