Skip to content

Commit 9647ceb

Browse files
committed
integrating @act/data into @act/web
1 parent 5a95e62 commit 9647ceb

File tree

9 files changed

+240
-89
lines changed

9 files changed

+240
-89
lines changed

Diff for: .editorconfig

+3-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ charset = utf-8
66
indent_style = space
77
indent_size = 2
88
insert_final_newline = true
9-
trim_trailing_whitespace = true
9+
trim_trailing_whitespace = false
10+
ij_javascript_enforce_trailing_comma = remove
11+
ij_typescript_enforce_trailing_comma = remove
1012

1113
[*.md]
1214
max_line_length = off

Diff for: .eslintrc.json

+68-28
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,72 @@
11
{
2-
"root": true,
3-
"ignorePatterns": ["**/*"],
4-
"plugins": ["@nrwl/nx"],
5-
"overrides": [
6-
{
7-
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
8-
"rules": {
9-
"@nrwl/nx/enforce-module-boundaries": [
10-
"error",
11-
{
12-
"enforceBuildableLibDependency": true,
13-
"allow": [],
14-
"depConstraints": [
15-
{ "sourceTag": "*", "onlyDependOnLibsWithTags": ["*"] }
16-
]
17-
}
18-
]
19-
}
20-
},
21-
{
22-
"files": ["*.ts", "*.tsx"],
23-
"extends": ["plugin:@nrwl/nx/typescript"],
24-
"rules": {}
2+
"extends": ["airbnb", "prettier"],
3+
"plugins": ["react", "import", "prettier"],
4+
"parser": "@typescript-eslint/parser",
5+
"parserOptions": {
6+
"ecmaFeatures": {
7+
"jsx": true
258
},
26-
{
27-
"files": ["*.js", "*.jsx"],
28-
"extends": ["plugin:@nrwl/nx/javascript"],
29-
"rules": {}
9+
"useJSXTextNode": true,
10+
"project": "./tsconfig.json",
11+
"tsconfigRootDir": "./"
12+
},
13+
"env": {
14+
"es6": true,
15+
"node": true,
16+
"jest": true
17+
},
18+
"rules": {
19+
"react/require-default-props": ["warn", {
20+
"ignoreFunctionalComponents": true
21+
}],
22+
"react-hooks/exhaustive-deps": "warn",
23+
"@typescript-eslint/no-use-before-define": ["off"],
24+
"react/jsx-props-no-spreading": "off",
25+
"no-extra-boolean-cast": "off",
26+
"comma-dangle": ["error", "never"],
27+
"complexity": [
28+
"warn",
29+
{
30+
"max": 5
31+
}
32+
],
33+
"max-depth": [
34+
"error",
35+
{
36+
"max": 2
37+
}
38+
],
39+
"max-params": ["off"],
40+
"import/extensions": ["off"],
41+
"import/no-extraneous-dependencies": ["off"],
42+
"import/prefer-default-export": 0,
43+
"react/jsx-filename-extension": 0,
44+
"react/no-array-index-key": 0,
45+
"react/destructuring-assignment": 0,
46+
"global-require": 0,
47+
"prettier/prettier": [
48+
"error",
49+
{ "singleQuote": true }
50+
],
51+
"@typescript-eslint/no-unused-vars": [
52+
"warn",
53+
{
54+
"args": "all",
55+
"argsIgnorePattern": "^_"
56+
}
57+
],
58+
"@typescript-eslint/switch-exhaustiveness-check": ["error"]
59+
},
60+
"settings": {
61+
"import/resolver": {
62+
"typescript": {},
63+
"node": {
64+
"extensions": [".js", ".ios.js", ".android.js", ".ts", ".tsx", ".jsx"]
65+
}
3066
}
31-
]
67+
},
68+
"globals": {
69+
"JSX":"readonly",
70+
"__DEV__": true
71+
}
3272
}

Diff for: .prettierrc

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
{
2-
"singleQuote": true
3-
}
2+
"semi": true,
3+
"trailingComma": "none",
4+
"singleQuote": true,
5+
"printWidth": 70
6+
}

Diff for: apps/mobile/.eslintrc.json

-14
This file was deleted.

Diff for: apps/mobile/src/app/App.tsx

+16-13
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,22 @@ import { contextBuilder, schema } from '@act/data';
33
import SQLiteAdapter from '@nozbe/watermelondb/adapters/sqlite';
44
import { schemaMigrations } from '@nozbe/watermelondb/Schema/migrations';
55
import withObservables from '@nozbe/with-observables';
6-
import { make } from "../../lib/es6/re/Index.bs";
6+
import { make } from '../../lib/es6/re/Index.bs';
77

88
const adapter = new SQLiteAdapter({
9-
schema,
10-
migrations: schemaMigrations({ migrations: [] })
11-
})
9+
schema,
10+
migrations: schemaMigrations({ migrations: [] })
11+
});
1212

13-
const {sync, entities} = contextBuilder(adapter);
14-
15-
const appWithPosts = withObservables(['post'], () => ({
16-
allPosts: entities.posts.collection.query().observe()
17-
}))
18-
const AppWithPosts = appWithPosts(make)
19-
20-
export default () => <AppWithPosts insertPost={() => entities.posts.insert(() => sync())} />
21-
13+
const { sync, entities } = contextBuilder(adapter);
14+
15+
const appWithPosts = withObservables(['post'], () => ({
16+
allPosts: entities.posts.collection.query().observe()
17+
}));
18+
const AppWithPosts = appWithPosts(make);
19+
20+
export default () => (
21+
<AppWithPosts
22+
insertPost={() => entities.posts.insert(() => sync())}
23+
/>
24+
);

Diff for: apps/web/src/main.tsx

+20-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,24 @@
1+
import 'reflect-metadata';
12
import React from 'react';
23
import ReactDOM from 'react-dom';
34
import App from './app';
5+
import { contextBuilder, schema } from '@act/data';
6+
import LokiJSAdapter from '@nozbe/watermelondb/adapters/lokijs';
7+
import { schemaMigrations } from '@nozbe/watermelondb/Schema/migrations';
8+
import withObservables from '@nozbe/with-observables';
49

5-
ReactDOM.render(
6-
<App />,
7-
document.getElementById('app')
8-
);
10+
const adapter = new LokiJSAdapter({
11+
schema,
12+
migrations: schemaMigrations({ migrations: [] }),
13+
useWebWorker: false,
14+
useIncrementalIndexedDB: true
15+
});
16+
17+
const { sync, entities } = contextBuilder(adapter);
18+
19+
const appWithPosts = withObservables(['post'], () => ({
20+
allPosts: entities.posts.collection.query().observe()
21+
}));
22+
const AppWithPosts = appWithPosts(App);
23+
24+
ReactDOM.render(<AppWithPosts />, document.getElementById('app'));

Diff for: apps/web/webpack.config.ts

+33-19
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,46 @@
11
module.exports = (config, context) => {
2-
return {
3-
...config,
4-
module: {
5-
//...config.module,
6-
rules: [{
2+
return {
3+
...config,
4+
module: {
5+
//...config.module,
6+
rules: [
7+
{
78
test: /\.(ts|js)x?$/,
89
use: {
910
loader: 'babel-loader',
1011
options: {
1112
presets: [
1213
'@babel/preset-env',
13-
"@babel/typescript",
14-
"@babel/preset-react"
14+
'@babel/typescript',
15+
'@babel/preset-react'
1516
],
1617
plugins: [
17-
'@babel/proposal-class-properties'
18-
],
19-
},
18+
[
19+
'@babel/plugin-proposal-decorators',
20+
{ legacy: true }
21+
],
22+
[
23+
'@babel/plugin-proposal-class-properties',
24+
{ loose: true }
25+
],
26+
[
27+
'@babel/plugin-transform-runtime',
28+
{
29+
helpers: true,
30+
regenerator: true
31+
}
32+
]
33+
]
34+
}
2035
},
21-
exclude: /node_modules/,
36+
exclude: /node_modules/
2237
},
2338
{
2439
test: /\.css$/i,
25-
use: ["style-loader", "css-loader"],
26-
},],
27-
},
28-
plugins: [
29-
...config.plugins
30-
],
31-
};
32-
};
40+
use: ['style-loader', 'css-loader']
41+
}
42+
]
43+
},
44+
plugins: [...config.plugins]
45+
};
46+
};

Diff for: package.json

+5-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,9 @@
5858
"tslib": "^2.0.0"
5959
},
6060
"devDependencies": {
61-
"@babel/plugin-proposal-decorators": "^7.13.15",
61+
"@babel/plugin-proposal-class-properties": "^7.13.0",
62+
"@babel/plugin-proposal-decorators": "^7.14.2",
63+
"@babel/plugin-transform-runtime": "^7.14.2",
6264
"@babel/preset-env": "^7.13.15",
6365
"@babel/preset-react": "^7.13.13",
6466
"@nestjs/schematics": "^7.0.0",
@@ -93,10 +95,12 @@
9395
"cypress": "^6.0.1",
9496
"dotenv": "8.2.0",
9597
"eslint": "7.22.0",
98+
"eslint-config-airbnb": "^18.2.1",
9699
"eslint-config-prettier": "8.1.0",
97100
"eslint-plugin-cypress": "^2.10.3",
98101
"eslint-plugin-import": "2.22.1",
99102
"eslint-plugin-jsx-a11y": "6.4.1",
103+
"eslint-plugin-prettier": "^3.4.0",
100104
"eslint-plugin-react": "7.21.5",
101105
"eslint-plugin-react-hooks": "4.2.0",
102106
"fork-ts-checker-webpack-plugin": "^6.2.5",

0 commit comments

Comments
 (0)