Skip to content

Commit 4ddc15f

Browse files
authored
feat!: add msw alternative for mocking (#169)
fix: upgrade node to v18 fix: update yarn to v4 feat: add a GraaspDevTools component feat: transform Contexts from HOC to components for nesting
1 parent 1aca8c9 commit 4ddc15f

Some content is hidden

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

82 files changed

+11330
-16862
lines changed

.eslintignore

+4
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,7 @@
33
dist/*
44
# data definition files
55
**/*.d.ts
6+
# jest config
7+
jest.config.ts
8+
coverage/*
9+
commitlint.config.js

.eslintrc

+110-12
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,127 @@
11
{
2-
"parser": "@typescript-eslint/parser",
32
"extends": [
3+
"airbnb",
4+
"airbnb-typescript",
5+
"plugin:import/typescript", // this is needed because airbnb uses eslint-plugin-import
6+
"prettier",
7+
"plugin:react/recommended",
8+
"plugin:react-hooks/recommended",
49
"plugin:@typescript-eslint/recommended"
510
],
11+
"plugins": ["@typescript-eslint", "prettier", "react-hooks"],
12+
"env": {
13+
"browser": true,
14+
"node": true,
15+
"mocha": true,
16+
"jest": true
17+
},
18+
"globals": {
19+
"cy": true,
20+
"Cypress": true
21+
},
22+
"parser": "@typescript-eslint/parser",
623
"parserOptions": {
7-
"ecmaVersion": 2018,
24+
"project": "./tsconfig.eslint.json",
25+
"ecmaFeatures": {
26+
"jsx": true
27+
},
28+
"ecmaVersion": "latest",
829
"sourceType": "module"
930
},
1031
"rules": {
11-
"semi": [
32+
"react/prop-types": "off",
33+
"react/no-array-index-key": "off",
34+
"react/jsx-props-no-spreading": "off",
35+
"react/destructuring-assignment": "off",
36+
"react/require-default-props": "off",
37+
"react/react-in-jsx-scope": "off",
38+
"@typescript-eslint/ban-ts-comment": "off",
39+
"import/no-import-module-exports": "off",
40+
"import/no-extraneous-dependencies": [
1241
"error",
13-
"always"
42+
{
43+
"devDependencies": true
44+
}
1445
],
15-
"quotes": [
46+
"no-console": ["warn", { "allow": ["warn", "error", "debug", "info"] }],
47+
"import/prefer-default-export": "off",
48+
"prettier/prettier": "error",
49+
"import/extensions": [
1650
"error",
17-
"single"
51+
"ignorePackages",
52+
{
53+
"ts": "never",
54+
"js": "never",
55+
"tsx": "never"
56+
}
57+
],
58+
"@typescript-eslint/explicit-function-return-type": [
59+
"error",
60+
{
61+
"allowExpressions": true,
62+
"allowHigherOrderFunctions": true,
63+
"allowTypedFunctionExpressions": true
64+
}
1865
],
19-
"@typescript-eslint/explicit-function-return-type": "off",
20-
"@typescript-eslint/no-explicit-any": 1,
21-
"@typescript-eslint/no-inferrable-types": [
66+
"@typescript-eslint/no-var-requires": "off",
67+
"global-require": "off",
68+
"react-hooks/rules-of-hooks": "error",
69+
"react-hooks/exhaustive-deps": "warn",
70+
"comma-dangle": "off",
71+
"@typescript-eslint/comma-dangle": "off",
72+
"react/jsx-one-expression-per-line": "off",
73+
"react/jsx-filename-extension": [
2274
"warn",
2375
{
24-
"ignoreParameters": true
76+
"extensions": [".tsx"]
77+
}
78+
],
79+
"react/function-component-definition": [
80+
2,
81+
{
82+
"namedComponents": "arrow-function"
2583
}
2684
],
27-
"@typescript-eslint/no-unused-vars": "warn"
28-
}
85+
// eslint rule reports false error
86+
"no-shadow": "off",
87+
"@typescript-eslint/no-shadow": ["error"],
88+
"@typescript-eslint/no-unused-vars": [
89+
"warn",
90+
{
91+
"argsIgnorePattern": "^_",
92+
"varsIgnorePattern": "^_",
93+
"caughtErrorsIgnorePattern": "^_"
94+
}
95+
]
96+
},
97+
"settings": {
98+
// "import/extensions": [".js", ".jsx", ".ts", ".tsx"],
99+
"import/parsers": {
100+
"@typescript-eslint/parser": [".ts", ".tsx"]
101+
},
102+
"import/resolver": {
103+
"typescript": {
104+
"alwaysTryTypes": true
105+
},
106+
"node": {
107+
"extensions": [".js", ".jsx", ".ts", ".tsx"]
108+
}
109+
}
110+
},
111+
"overrides": [
112+
{
113+
// enable the rule specifically for TypeScript files
114+
"files": ["*.ts", "*.tsx"],
115+
"rules": {
116+
"@typescript-eslint/explicit-function-return-type": [
117+
"off"
118+
// {
119+
// "allowExpressions": true,
120+
// "allowHigherOrderFunctions": true,
121+
// "allowTypedFunctionExpressions": true
122+
// }
123+
]
124+
}
125+
}
126+
]
29127
}

.github/workflows/test.yml

-5
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,6 @@ jobs:
99
steps:
1010
- uses: actions/checkout@v3
1111

12-
- name: Use Node.js 16.x
13-
uses: actions/setup-node@v3
14-
with:
15-
node-version: 16.x
16-
1712
- name: Yarn Install and Cache
1813
uses: graasp/graasp-deploy/.github/actions/yarn-install-and-cache@v1
1914

.prettierrc

+5-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,9 @@
22
"trailingComma": "all",
33
"tabWidth": 2,
44
"semi": true,
5-
"singleQuote": true
5+
"singleQuote": true,
6+
"importOrder": ["^react", "^@?mui", "^@?graasp", "<THIRD_PARTY_MODULES>", "^@/", "^[./]"],
7+
"importOrderSeparation": true,
8+
"importOrderSortSpecifiers": true,
9+
"plugins": ["@trivago/prettier-plugin-sort-imports"]
610
}

.yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs

-546
This file was deleted.

.yarn/releases/yarn-3.6.1.cjs

-874
This file was deleted.

.yarn/releases/yarn-4.0.1.cjs

+893
Large diffs are not rendered by default.

.yarnrc.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
checksumBehavior: update
22

3+
compressionLevel: mixed
4+
35
defaultSemverRangePrefix: ""
46

5-
nodeLinker: node-modules
7+
enableGlobalCache: false
68

7-
plugins:
8-
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
9-
spec: "@yarnpkg/plugin-interactive-tools"
9+
nodeLinker: node-modules
1010

11-
yarnPath: .yarn/releases/yarn-3.6.1.cjs
11+
yarnPath: .yarn/releases/yarn-4.0.1.cjs

README.md

+1-6
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,7 @@ import {
4343

4444
const values = configureQueryClient({
4545
GRAASP_APP_KEY: process.env.REACT_APP_GRAASP_APP_KEY,
46-
// build mock parent window given cypress (app) context or mock data
47-
targetWindow: process.env.REACT_APP_ENABLE_MOCK_API === 'true'
48-
? buildMockParentWindow(
49-
buildMockLocalContext(window.appContext),
50-
)
51-
: window.parent,
46+
isStandalone: MOCK_API,
5247
});
5348
export values;
5449
```

example/README.md

-5
This file was deleted.

example/package.json

-44
This file was deleted.

example/public/favicon.ico

-3.78 KB
Binary file not shown.

example/public/index.html

-46
This file was deleted.

example/public/manifest.json

-15
This file was deleted.

example/src/App.tsx

-35
This file was deleted.

example/src/configureQueryClient.ts

-12
This file was deleted.

example/src/index.tsx

-12
This file was deleted.

0 commit comments

Comments
 (0)