Skip to content

Commit ffe7dcb

Browse files
committed
chore: new plugin layout
1 parent 45ea8d1 commit ffe7dcb

36 files changed

+676
-321
lines changed

.eslintrc.js

+1-184
Original file line numberDiff line numberDiff line change
@@ -1,186 +1,3 @@
11
module.exports = {
2-
extends: ['plugin:prettier/recommended'],
3-
plugins: ['@nativescript', 'prettier', '@typescript-eslint'],
4-
parser: '@typescript-eslint/parser',
5-
parserOptions: {
6-
ecmaVersion: 2018,
7-
sourceType: 'module',
8-
parser: '@typescript-eslint/parser',
9-
project: 'tsconfig.eslint.json',
10-
extraFileExtensions: ['.vue'],
11-
warnOnUnsupportedTypeScriptVersion: false,
12-
tsconfigRootDir: __dirname,
13-
createDefaultProgram: true
14-
},
15-
rules: {
16-
'prettier/prettier': 'warn',
17-
'@nativescript/no-nativescript-angular-imports': 'warn',
18-
'@nativescript/no-tns-core-modules-imports': 'warn',
19-
'@nativescript/no-duplicate-ns-imports': 'warn',
20-
'@typescript-eslint/adjacent-overload-signatures': 'error',
21-
'@typescript-eslint/array-type': 'error',
22-
'@typescript-eslint/await-thenable': 'error',
23-
'@typescript-eslint/ban-types': 'off',
24-
'@typescript-eslint/class-name-casing': 'off',
25-
'@typescript-eslint/consistent-type-assertions': 'error',
26-
'@typescript-eslint/consistent-type-definitions': 'error',
27-
'@typescript-eslint/explicit-member-accessibility': [
28-
'off',
29-
{
30-
accessibility: 'explicit',
31-
},
32-
],
33-
'@typescript-eslint/indent': [
34-
'error',
35-
4,
36-
{
37-
FunctionDeclaration: {
38-
parameters: 'first',
39-
},
40-
FunctionExpression: {
41-
parameters: 'first',
42-
},
43-
SwitchCase: 1,
44-
},
45-
],
46-
'@typescript-eslint/interface-name-prefix': 'off',
47-
'@typescript-eslint/member-delimiter-style': 'error',
48-
'@typescript-eslint/member-ordering': 'off',
49-
'@typescript-eslint/no-empty-function': 'off',
50-
'@typescript-eslint/no-empty-interface': 'off',
51-
'@typescript-eslint/no-explicit-any': 'off',
52-
'@typescript-eslint/no-floating-promises': 'off',
53-
'@typescript-eslint/no-inferrable-types': 'off',
54-
'@typescript-eslint/no-misused-new': 'off',
55-
'@typescript-eslint/no-namespace': 'off',
56-
'@typescript-eslint/no-parameter-properties': 'off',
57-
'@typescript-eslint/no-require-imports': 'off',
58-
'@typescript-eslint/no-unnecessary-qualifier': 'error',
59-
'@typescript-eslint/no-unnecessary-type-assertion': 'error',
60-
'@typescript-eslint/no-use-before-declare': 'off',
61-
'@typescript-eslint/no-var-requires': 'off',
62-
'@typescript-eslint/prefer-for-of': 'off',
63-
'@typescript-eslint/prefer-function-type': 'error',
64-
'@typescript-eslint/prefer-namespace-keyword': 'error',
65-
'@typescript-eslint/quotes': [
66-
'error',
67-
'single',
68-
{
69-
avoidEscape: true,
70-
},
71-
],
72-
'@typescript-eslint/semi': ['error'],
73-
'@typescript-eslint/space-within-parens': ['off', 'never'],
74-
'@typescript-eslint/triple-slash-reference': 'off',
75-
'@typescript-eslint/type-annotation-spacing': 'error',
76-
'@typescript-eslint/unified-signatures': 'error',
77-
'arrow-body-style': 'error',
78-
'arrow-parens': ['off', 'as-needed'],
79-
camelcase: 'off',
80-
'capitalized-comments': 'off',
81-
complexity: 'off',
82-
'constructor-super': 'error',
83-
curly: ['error', 'multi-line'],
84-
'dot-notation': 'off',
85-
'eol-last': 'error',
86-
eqeqeq: ['error', 'smart'],
87-
'guard-for-in': 'off',
88-
'id-blacklist': ['error', 'any', 'string', 'boolean', 'Undefined'],
89-
'id-match': 'error',
90-
'sort-imports': [
91-
'error',
92-
{
93-
ignoreCase: false,
94-
ignoreDeclarationSort: true,
95-
ignoreMemberSort: false,
96-
memberSyntaxSortOrder: ['none', 'all', 'multiple', 'single'],
97-
},
98-
],
99-
'linebreak-style': 'off',
100-
'max-classes-per-file': 'off',
101-
'max-len': [
102-
'off',
103-
{
104-
ignorePattern: '^import |^export {(.*?)}',
105-
code: 200,
106-
},
107-
],
108-
'new-parens': 'off',
109-
'newline-per-chained-call': 'off',
110-
'no-bitwise': 'off',
111-
'no-caller': 'error',
112-
'no-cond-assign': 'off',
113-
'no-console': [
114-
'off',
115-
{
116-
allow: [
117-
'log',
118-
'warn',
119-
'dir',
120-
'timeLog',
121-
'assert',
122-
'clear',
123-
'count',
124-
'countReset',
125-
'group',
126-
'groupEnd',
127-
'table',
128-
'debug',
129-
'dirxml',
130-
'error',
131-
'groupCollapsed',
132-
'Console',
133-
'profile',
134-
'profileEnd',
135-
'timeStamp',
136-
'context',
137-
],
138-
},
139-
],
140-
'no-constant-condition': 'error',
141-
'no-control-regex': 'off',
142-
'no-debugger': 'error',
143-
'no-duplicate-imports': 'error',
144-
'no-empty': 'off',
145-
'no-eval': 'off',
146-
'no-extra-semi': 'off',
147-
'no-fallthrough': 'error',
148-
'no-invalid-regexp': 'error',
149-
'no-invalid-this': 'off',
150-
'no-irregular-whitespace': 'off',
151-
'no-multiple-empty-lines': 'off',
152-
'no-new-wrappers': 'error',
153-
'no-redeclare': ['error', { builtinGlobals: false }],
154-
'no-regex-spaces': 'error',
155-
'no-return-await': 'error',
156-
'no-shadow': [
157-
'off',
158-
{
159-
hoist: 'all',
160-
},
161-
],
162-
'no-throw-literal': 'error',
163-
'no-trailing-spaces': 'error',
164-
'no-undef-init': 'error',
165-
'no-underscore-dangle': 'off',
166-
'no-unsafe-finally': 'error',
167-
'no-unused-expressions': [
168-
'error',
169-
{
170-
allowTaggedTemplates: true,
171-
allowShortCircuit: true,
172-
},
173-
],
174-
'no-unused-labels': 'error',
175-
'no-var': 'error',
176-
'object-shorthand': 'error',
177-
'one-var': ['off', 'never'],
178-
'prefer-arrow/prefer-arrow-functions': 'off',
179-
'prefer-const': 'error',
180-
'quote-props': 'off',
181-
radix: 'error',
182-
'space-before-function-paren': 'off',
183-
'use-isnan': 'error',
184-
'valid-typeof': 'off',
185-
},
2+
extends: './tools/.eslintrc.js'
1863
};

.gitmodules

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
[submodule "tools"]
2+
path = tools
3+
url = [email protected]:nativescript-community/plugin-seed-tools.git
4+
[submodule "demo-vue"]
5+
path = demo-vue
6+
url = [email protected]:nativescript-community/plugin-seed-demo-vue.git
7+
[submodule "demo-react"]
8+
path = demo-react
9+
url = [email protected]:nativescript-community/plugin-seed-demo-react.git
10+
[submodule "demo-svelte"]
11+
path = demo-svelte
12+
url = [email protected]:nativescript-community/plugin-seed-demo-svelte.git
13+
[submodule "demo-ng"]
14+
path = demo-ng
15+
url = [email protected]:nativescript-community/plugin-seed-demo-ng.git

.prettierignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
package-lock.json
2+
node_modules/
3+
plugin/
4+
docs/

config.json

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"readme": true,
3+
"angular": true,
4+
"demos": [
5+
"ng",
6+
"react",
7+
"svelte",
8+
"vue"
9+
]
10+
}

demo-ng

Submodule demo-ng added at d879a46

demo-react

Submodule demo-react added at 2042796
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
.red {
2+
margin: 0;
3+
padding: 0;
4+
font-weight: bolder;
5+
background-color: blue;
6+
color: green;
7+
font-size: 20pt;
8+
}
9+
10+
body,
11+
html {
12+
margin: 0;
13+
padding: 0;
14+
background-color: purple;
15+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<style>
4+
body {
5+
margin: 0;
6+
width: 100%;
7+
height: 100%;
8+
overflow: hidden;
9+
}
10+
video {
11+
object-fit: cover;
12+
position: absolute;
13+
min-width: 100%;
14+
min-height: 100%;
15+
top: 50%;
16+
left: 50%;
17+
transform: translate(-50%, -50%);
18+
}
19+
</style>
20+
<head>
21+
<title>Blank</title>
22+
</head>
23+
<body>
24+
<video autoplay playsinline style='z-index:-1;'>
25+
</video>
26+
<button onclick="startCam()">startCam</button>
27+
28+
<script>
29+
30+
function startCam() {
31+
console.log('startCam')
32+
const constraints = {
33+
video: true,
34+
};
35+
36+
const video = document.querySelector("video");
37+
38+
navigator.mediaDevices.getUserMedia(constraints).then((stream) => {
39+
video.srcObject = stream;
40+
});
41+
video.onloadedmetadata = function (e) {
42+
video.play();
43+
};
44+
}
45+
46+
</script>
47+
</body>
48+
</html>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<title>Inject stylesheet via x-local</title>
5+
</head>
6+
<body>
7+
<p class="red">RED</p>
8+
</body>
9+
</html>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<title>Load predefined x-local stylesheet</title>
5+
<link rel="stylesheet" type="text/css" href="x-local://local-stylesheet.css" />
6+
</head>
7+
<body>
8+
<p class="red">RED</p>
9+
</body>
10+
</html>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<title>Blank</title>
5+
</head>
6+
<body></body>
7+
</html>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head> </head>
4+
<body></body>
5+
</html>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<script>
5+
function callFromNativeScript() {
6+
console.log("got a message from nativescript");
7+
8+
window.nsWebViewBridge.emit("gotMessage", { huba: "hop" });
9+
}
10+
11+
function getNumber() {
12+
return 42;
13+
}
14+
15+
function getNumberFloat() {
16+
return 3.14;
17+
}
18+
19+
function getBoolean() {
20+
return false;
21+
}
22+
23+
function getString() {
24+
return "string result from webview JS function";
25+
}
26+
27+
function getArray() {
28+
return [1.5, true, "hello"];
29+
}
30+
31+
function getObject() {
32+
return { prop: "test", name: "object-test", values: [42, 3.14] };
33+
}
34+
</script>
35+
</head>
36+
<body>
37+
<p class="red">RED</p>
38+
<div>
39+
<h1>Should overide url?</h1>
40+
<a href="http://google.com">Go to google - should not load</a>
41+
</div>
42+
</body>
43+
</html>

0 commit comments

Comments
 (0)