Skip to content
This repository was archived by the owner on Dec 28, 2023. It is now read-only.

Commit fec2c97

Browse files
authored
hubert / Running husky prettier (#271)
1 parent 91b0512 commit fec2c97

File tree

104 files changed

+3394
-3643
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

104 files changed

+3394
-3643
lines changed

.eslintignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
11
public/demos/demos/*
2+
tsconfig.json
3+
tsconfig.node.json
4+
state/state.js

.eslintrc.js

Lines changed: 102 additions & 107 deletions
Original file line numberDiff line numberDiff line change
@@ -1,116 +1,111 @@
11
/* eslint-disable */
22
module.exports = {
3-
env: {
4-
browser: true,
5-
es6: true,
6-
es2021: true,
7-
node: true,
8-
cypress: true,
9-
},
10-
extends: [
11-
"eslint:recommended",
12-
"plugin:react/recommended",
13-
"plugin:@typescript-eslint/recommended",
14-
"plugin:import/recommended",
15-
"plugin:import/errors",
16-
"plugin:import/warnings",
17-
"plugin:import/typescript",
18-
],
19-
parser: "@typescript-eslint/parser",
20-
parserOptions: {
21-
ecmaFeatures: {
22-
jsx: true,
3+
env: {
4+
browser: true,
5+
es6: true,
6+
es2021: true,
7+
node: true,
238
},
24-
ecmaVersion: "latest",
25-
sourceType: "module",
26-
},
27-
plugins: ["react", "@typescript-eslint"],
28-
rules: {
29-
"react/react-in-jsx-scope": "off",
30-
camelcase: 0,
31-
// semi : ["error", "always"],
32-
"array-callback-return": 0,
33-
"arrow-body-style": 0,
34-
"brace-style": ["error", "1tbs", { allowSingleLine: true }],
35-
curly: 0,
36-
// "comma-dangle" : ["error", "always-multiline"],
37-
"eol-last": ["error", "always"],
38-
"func-names": ["error", "never"],
39-
"key-spacing": 0,
40-
"max-classes-per-file": ["warn", 2],
41-
// "keyword-spacing" : ["error", { after: true }],
42-
"lines-between-class-members": 0,
43-
indent: 0,
44-
// "max-len": ["error", { code: 120, "ignoreComments": true }],
45-
"no-extra-semi": "error",
46-
"no-console": "error",
47-
"no-else-return": ["error", { allowElseIf: true }],
48-
"no-multi-assign": 0,
49-
"no-multi-spaces": [
50-
2,
51-
{
52-
exceptions: {
53-
BinaryExpression: true,
54-
VariableDeclarator: true,
55-
ImportDeclaration: true,
56-
},
57-
},
58-
],
59-
"no-param-reassign": ["error", { props: false }],
60-
"no-restricted-globals": 0,
61-
"no-script-url": 0,
62-
// "no-trailing-spaces" : ["error", { skipBlankLines: true }],
63-
"object-curly-spacing": [
64-
"error",
65-
"always",
66-
{ arraysInObjects: true, objectsInObjects: true },
9+
extends: [
10+
'eslint:recommended',
11+
'plugin:react/recommended',
12+
'plugin:@typescript-eslint/recommended',
13+
'plugin:import/recommended',
14+
'plugin:import/errors',
15+
'plugin:import/warnings',
16+
'plugin:import/typescript',
6717
],
68-
"one-var": ["error", { initialized: "never", uninitialized: "always" }],
69-
"prefer-destructuring": 0,
70-
quotes: 0,
71-
// "space-in-parens" : ["error", "never"],
72-
"space-infix-ops": "error",
73-
// "space-unary-ops" : "error",
74-
"no-multiple-empty-lines": ["error", { max: 1, maxEOF: 1 }],
18+
parser: '@typescript-eslint/parser',
19+
parserOptions: {
20+
ecmaFeatures: {
21+
jsx: true,
22+
},
23+
ecmaVersion: 'latest',
24+
sourceType: 'module',
25+
},
26+
plugins: ['react', '@typescript-eslint'],
27+
rules: {
28+
'react/react-in-jsx-scope': 'off',
29+
camelcase: 0,
30+
// semi : ["error", "always"],
31+
'array-callback-return': 0,
32+
'arrow-body-style': 0,
33+
'brace-style': ['error', '1tbs', { allowSingleLine: true }],
34+
curly: 0,
35+
// "comma-dangle" : ["error", "always-multiline"],
36+
'eol-last': ['error', 'always'],
37+
'func-names': ['error', 'never'],
38+
'key-spacing': 0,
39+
'max-classes-per-file': ['warn', 2],
40+
// "keyword-spacing" : ["error", { after: true }],
41+
'lines-between-class-members': 0,
42+
indent: 0,
43+
// "max-len": ["error", { code: 120, "ignoreComments": true }],
44+
'no-extra-semi': 'error',
45+
'no-console': 'error',
46+
'no-else-return': ['error', { allowElseIf: true }],
47+
'no-multi-assign': 0,
48+
'no-multi-spaces': [
49+
2,
50+
{
51+
exceptions: {
52+
BinaryExpression: true,
53+
VariableDeclarator: true,
54+
ImportDeclaration: true,
55+
},
56+
},
57+
],
58+
'no-param-reassign': ['error', { props: false }],
59+
'no-restricted-globals': 0,
60+
'no-script-url': 0,
61+
// "no-trailing-spaces" : ["error", { skipBlankLines: true }],
62+
'object-curly-spacing': ['error', 'always', { arraysInObjects: true, objectsInObjects: true }],
63+
'one-var': ['error', { initialized: 'never', uninitialized: 'always' }],
64+
'prefer-destructuring': 0,
65+
quotes: 0,
66+
// "space-in-parens" : ["error", "never"],
67+
'space-infix-ops': 'error',
68+
// "space-unary-ops" : "error",
69+
'no-multiple-empty-lines': ['error', { max: 1, maxEOF: 1 }],
7570

76-
// import rules
77-
"import/no-extraneous-dependencies": [
78-
"error",
79-
{
80-
devDependencies: [
81-
"**/__tests__/**/*.js",
82-
"**/test*.js",
83-
"**/*.test.js*",
84-
"**/*.spec.js",
85-
"**/*.spec.jsx",
71+
// import rules
72+
'import/no-extraneous-dependencies': [
73+
'error',
74+
{
75+
devDependencies: [
76+
'**/__tests__/**/*.js',
77+
'**/test*.js',
78+
'**/*.test.js*',
79+
'**/*.spec.js',
80+
'**/*.spec.jsx',
81+
],
82+
},
8683
],
87-
},
88-
],
8984

90-
"import/no-useless-path-segments": "error",
91-
"import/order": [
92-
0, // TODO: we should turn this to error after we sorted our import orders.
93-
{
94-
groups: [["builtin", "external"], "internal", "sibling", "parent"],
95-
"newlines-between": "ignore",
96-
},
97-
],
98-
"import/prefer-default-export": 0,
99-
"import/extensions": ["warn", "never", { jsx: "never", json: "always" }],
100-
"no-sequences": ["warn"],
85+
'import/no-useless-path-segments': 'error',
86+
'import/order': [
87+
0, // TODO: we should turn this to error after we sorted our import orders.
88+
{
89+
groups: [['builtin', 'external'], 'internal', 'sibling', 'parent'],
90+
'newlines-between': 'ignore',
91+
},
92+
],
93+
'import/prefer-default-export': 0,
94+
'import/extensions': ['warn', 'never', { jsx: 'never', json: 'always' }],
95+
'no-sequences': ['warn'],
10196

102-
// react rules
103-
// "jsx-quotes" : ["error", "prefer-single"],
104-
// "react/jsx-closing-bracket-location": ["error", { selfClosing: "line-aligned", nonEmpty: "line-aligned" }],
105-
// "react/jsx-closing-tag-location" : "error",
106-
// "react/jsx-first-prop-new-line" : ["error", "multiline-multiprop"],
107-
// "react/jsx-indent" : ["error", 4],
108-
// "react/jsx-indent-props" : ["error", 4],
109-
// "react/jsx-max-props-per-line" : ["error", { when: "multiline" }],
110-
// "react/jsx-tag-spacing" : ["error", { closingSlash: "never", beforeSelfClosing: "always" }],
111-
"react/prop-types": 0,
112-
"react/self-closing-comp": "error",
113-
"react/no-unescaped-entities": 0,
114-
// "react/sort-prop-types" : ["error", { ignoreCase: true, sortShapeProp: true }],
115-
},
97+
// react rules
98+
// "jsx-quotes" : ["error", "prefer-single"],
99+
// "react/jsx-closing-bracket-location": ["error", { selfClosing: "line-aligned", nonEmpty: "line-aligned" }],
100+
// "react/jsx-closing-tag-location" : "error",
101+
// "react/jsx-first-prop-new-line" : ["error", "multiline-multiprop"],
102+
// "react/jsx-indent" : ["error", 4],
103+
// "react/jsx-indent-props" : ["error", 4],
104+
// "react/jsx-max-props-per-line" : ["error", { when: "multiline" }],
105+
// "react/jsx-tag-spacing" : ["error", { closingSlash: "never", beforeSelfClosing: "always" }],
106+
'react/prop-types': 0,
107+
'react/self-closing-comp': 'error',
108+
'react/no-unescaped-entities': 0,
109+
// "react/sort-prop-types" : ["error", { ignoreCase: true, sortShapeProp: true }],
110+
},
116111
};

.husky/pre-commit

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env sh
2+
. "$(dirname -- "$0")/_/husky.sh"
3+
4+
npm run format

.prettierignore

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,15 @@ _site/
44
_data/
55
config/
66
examples/
7-
public/
7+
public/
8+
api-data/
9+
state.js
10+
*.d.ts
11+
*.config.ts
12+
*.config.js
13+
*.config.tsx
14+
*.config.json
15+
*.tsconfig.json
16+
*.tsconfig.node.json
17+
README.md
18+
vercel.json

README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,13 @@ Moreover, having these extensions will help you to speed up the development proc
4848
npm install
4949
```
5050

51-
5251
5. **To start developing:**
5352

5453
```sh
5554
npm run dev
5655
```
5756

58-
1. Release to staging:
57+
1. Release to staging:
5958

6059
Merging to master (squash and merge) will automatically release the last commit to the staging server https://staging-api.deriv.com/
6160

@@ -67,7 +66,7 @@ Releasing to production requires a tag using the following format:
6766

6867
## How to contribute
6968

70-
PRs are based on the master branch
69+
PRs are based on the master branch
7170

7271
1. Create branch from the latest master branch
7372

@@ -89,4 +88,4 @@ PRs are based on the master branch
8988

9089
## Test link deployment
9190

92-
Upon creating PR, [Vercel](https://vercel.com/) will auto-generate a test link inside the PR. you can use that to preview the test link for the changes you have made.
91+
Upon creating PR, [Vercel](https://vercel.com/) will auto-generate a test link inside the PR. you can use that to preview the test link for the changes you have made.

cypress/e2e/api.deriv.com.cy.js

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ const derivAPIEvents = {
161161
},
162162
CLICK_LOGO: function () {
163163
cy.get('[data-testid="home_logo"]').click();
164-
}
164+
},
165165
};
166166

167167
const derivAPIStates = {
@@ -171,7 +171,9 @@ const derivAPIStates = {
171171
cy.contains(/ways to earn with deriv api/i).should('be.visible');
172172
cy.contains(/register your app with deriv/i).should('be.visible');
173173
cy.contains(/sign up as an affiliate, build your app/i).should('be.visible');
174-
cy.contains(/sign up as a payment agent/i).should('be.visible').scrollIntoView();
174+
cy.contains(/sign up as a payment agent/i)
175+
.should('be.visible')
176+
.scrollIntoView();
175177
},
176178
playground: () => {
177179
// checkScroll(); TODO children states cause scroll to not be at top
@@ -183,8 +185,12 @@ const derivAPIStates = {
183185
},
184186
documetnation: () => {
185187
isScrollOnTop();
186-
cy.contains(/Quickstart to Deriv API/i).should('be.visible').scrollIntoView();
187-
cy.contains(/Keep alive/i).should('be.visible').scrollIntoView();
188+
cy.contains(/Quickstart to Deriv API/i)
189+
.should('be.visible')
190+
.scrollIntoView();
191+
cy.contains(/Keep alive/i)
192+
.should('be.visible')
193+
.scrollIntoView();
188194
},
189195
faq: () => {
190196
isScrollOnTop();
@@ -218,25 +224,25 @@ const derivAPIStates = {
218224
cy.get('[data-testid="apiTokenInput"]').should('have.value', Cypress.env('DERIV_API_TOKEN'));
219225
},
220226
displayAuthDoc: () => {
221-
cy.get('[data-testid=apiDropdown]')
222-
.contains(/authorize/i)
227+
cy.get('[data-testid=apiDropdown]').contains(/authorize/i);
223228
cy.get('[data-testid=playgroundDocs]')
224229
.should('be.visible')
225230
.contains(/authorize/i);
226231
},
227232
displaySelectedDoc: () => {
228233
cy.get('[data-testid=apiDropdown]')
229-
.contains(/authorize/i)
230-
.should('not.exist');
234+
.contains(/authorize/i)
235+
.should('not.exist');
231236
cy.get('[data-testid=playgroundDocs]')
232-
.should('be.visible')
233-
// should not contain authorize
234-
.contains(/authorize/i).should('not.exist');
237+
.should('be.visible')
238+
// should not contain authorize
239+
.contains(/authorize/i)
240+
.should('not.exist');
235241
},
236242
selecting_api: () => {
237243
// data-testid searchInput should be in focus
238244
cy.get('[data-testid="searchInput"]').should('have.focus');
239-
}
245+
},
240246
};
241247

242248
// cypress check if the scroll is at the top of the page

cypress/fixtures/example.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "Using fixtures to represent data",
3-
"email": "hello@cypress.io",
4-
"body": "Fixtures are a great way to mock data for responses to routes"
2+
"name": "Using fixtures to represent data",
3+
"email": "hello@cypress.io",
4+
"body": "Fixtures are a great way to mock data for responses to routes"
55
}

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
"lint": "eslint .",
1111
"lint:fix": "eslint --fix",
1212
"format": "prettier --write './**/*.{js,jsx,ts,tsx,css,md,json}' --config ./.prettierrc",
13-
"e2e": "cypress open"
13+
"e2e": "cypress open",
14+
"prepare": "husky install"
1415
},
1516
"dependencies": {
1617
"@cypress/code-coverage": "^3.10.0",

0 commit comments

Comments
 (0)