Skip to content

Commit 5c83c98

Browse files
committed
add oxlint for examples folder
1 parent 21d6f36 commit 5c83c98

File tree

12 files changed

+208
-249
lines changed

12 files changed

+208
-249
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@ jobs:
1919
- name: "Install"
2020
run: bun install --frozen-lockfile
2121

22-
- name: "[Test] Linting"
23-
run: yarn lint
22+
- name: "Lint"
23+
run: bun run lint

.oxlintrc.json

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
{
22
"$schema": "./node_modules/oxlint/configuration_schema.json",
3-
"plugins": [
4-
"unicorn",
5-
"typescript",
6-
"oxc"
7-
],
3+
"plugins": ["unicorn", "typescript", "oxc"],
84
"categories": {},
95
"rules": {
106
"for-direction": "warn",
@@ -50,7 +46,7 @@
5046
"no-unused-expressions": "warn",
5147
"no-unused-labels": "warn",
5248
"no-unused-private-class-members": "warn",
53-
"no-unused-vars": "warn",
49+
"no-unused-vars": "error",
5450
"no-useless-backreference": "warn",
5551
"no-useless-catch": "warn",
5652
"no-useless-escape": "warn",
@@ -140,4 +136,4 @@
140136
},
141137
"globals": {},
142138
"ignorePatterns": []
143-
}
139+
}
Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
{
2+
"plugins": ["unicorn", "typescript", "oxc"],
3+
"categories": {},
4+
"rules": {
5+
"for-direction": "warn",
6+
"no-async-promise-executor": "warn",
7+
"no-caller": "warn",
8+
"no-class-assign": "warn",
9+
"no-compare-neg-zero": "warn",
10+
"no-cond-assign": "warn",
11+
"no-const-assign": "warn",
12+
"no-constant-binary-expression": "warn",
13+
"no-constant-condition": "warn",
14+
"no-control-regex": "warn",
15+
"no-debugger": "warn",
16+
"no-delete-var": "warn",
17+
"no-dupe-class-members": "warn",
18+
"no-dupe-else-if": "warn",
19+
"no-dupe-keys": "warn",
20+
"no-duplicate-case": "warn",
21+
"no-empty-character-class": "warn",
22+
"no-empty-pattern": "warn",
23+
"no-empty-static-block": "warn",
24+
"no-eval": "warn",
25+
"no-ex-assign": "warn",
26+
"no-extra-boolean-cast": "warn",
27+
"no-func-assign": "warn",
28+
"no-global-assign": "warn",
29+
"no-import-assign": "warn",
30+
"no-invalid-regexp": "warn",
31+
"no-irregular-whitespace": "warn",
32+
"no-loss-of-precision": "warn",
33+
"no-new-native-nonconstructor": "warn",
34+
"no-nonoctal-decimal-escape": "warn",
35+
"no-obj-calls": "warn",
36+
"no-self-assign": "warn",
37+
"no-setter-return": "warn",
38+
"no-shadow-restricted-names": "warn",
39+
"no-sparse-arrays": "warn",
40+
"no-this-before-super": "warn",
41+
"no-unassigned-vars": "warn",
42+
"no-unsafe-finally": "warn",
43+
"no-unsafe-negation": "warn",
44+
"no-unsafe-optional-chaining": "warn",
45+
"no-unused-expressions": "warn",
46+
"no-unused-labels": "warn",
47+
"no-unused-private-class-members": "warn",
48+
"no-unused-vars": "error",
49+
"no-useless-backreference": "warn",
50+
"no-useless-catch": "warn",
51+
"no-useless-escape": "warn",
52+
"no-useless-rename": "warn",
53+
"no-with": "warn",
54+
"require-yield": "warn",
55+
"use-isnan": "warn",
56+
"valid-typeof": "warn",
57+
"oxc/bad-array-method-on-arguments": "warn",
58+
"oxc/bad-char-at-comparison": "warn",
59+
"oxc/bad-comparison-sequence": "warn",
60+
"oxc/bad-min-max-func": "warn",
61+
"oxc/bad-object-literal-comparison": "warn",
62+
"oxc/bad-replace-all-arg": "warn",
63+
"oxc/const-comparisons": "warn",
64+
"oxc/double-comparisons": "warn",
65+
"oxc/erasing-op": "warn",
66+
"oxc/missing-throw": "warn",
67+
"oxc/number-arg-out-of-range": "warn",
68+
"oxc/only-used-in-recursion": "warn",
69+
"oxc/uninvoked-array-callback": "warn",
70+
"typescript/await-thenable": "warn",
71+
"typescript/no-array-delete": "warn",
72+
"typescript/no-base-to-string": "warn",
73+
"typescript/no-duplicate-enum-values": "warn",
74+
"typescript/no-duplicate-type-constituents": "warn",
75+
"typescript/no-extra-non-null-assertion": "warn",
76+
"typescript/no-floating-promises": "warn",
77+
"typescript/no-for-in-array": "warn",
78+
"typescript/no-implied-eval": "warn",
79+
"typescript/no-meaningless-void-operator": "warn",
80+
"typescript/no-misused-new": "warn",
81+
"typescript/no-misused-spread": "warn",
82+
"typescript/no-non-null-asserted-optional-chain": "warn",
83+
"typescript/no-redundant-type-constituents": "warn",
84+
"typescript/no-this-alias": "warn",
85+
"typescript/no-unnecessary-parameter-property-assignment": "warn",
86+
"typescript/no-unsafe-declaration-merging": "warn",
87+
"typescript/no-unsafe-unary-minus": "warn",
88+
"typescript/no-useless-empty-export": "warn",
89+
"typescript/no-wrapper-object-types": "warn",
90+
"typescript/prefer-as-const": "warn",
91+
"typescript/require-array-sort-compare": "warn",
92+
"typescript/restrict-template-expressions": "warn",
93+
"typescript/triple-slash-reference": "warn",
94+
"typescript/unbound-method": "warn",
95+
"unicorn/no-await-in-promise-methods": "warn",
96+
"unicorn/no-empty-file": "warn",
97+
"unicorn/no-invalid-fetch-options": "warn",
98+
"unicorn/no-invalid-remove-event-listener": "warn",
99+
"unicorn/no-new-array": "warn",
100+
"unicorn/no-single-promise-in-promise-methods": "warn",
101+
"unicorn/no-thenable": "warn",
102+
"unicorn/no-unnecessary-await": "warn",
103+
"unicorn/no-useless-fallback-in-spread": "warn",
104+
"unicorn/no-useless-length-check": "warn",
105+
"unicorn/no-useless-spread": "warn",
106+
"unicorn/prefer-set-size": "warn",
107+
"unicorn/prefer-string-starts-ends-with": "warn"
108+
},
109+
"settings": {
110+
"jsx-a11y": {
111+
"polymorphicPropName": null,
112+
"components": {},
113+
"attributes": {}
114+
},
115+
"next": {
116+
"rootDir": []
117+
},
118+
"react": {
119+
"formComponents": [],
120+
"linkComponents": []
121+
},
122+
"jsdoc": {
123+
"ignorePrivate": false,
124+
"ignoreInternal": false,
125+
"ignoreReplacesDocs": true,
126+
"overrideReplacesDocs": true,
127+
"augmentsExtendsReplacesDocs": false,
128+
"implementsReplacesDocs": false,
129+
"exemptDestructuredRootsFromChecks": false,
130+
"tagNamePreference": {}
131+
}
132+
},
133+
"env": {
134+
"builtin": true
135+
},
136+
"globals": {},
137+
"ignorePatterns": ["ios/**", "android/**", "vendor/**"]
138+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
android
2+
ios
3+
vendor

examples/RNOneSignalTS/.prettierrc.js

Lines changed: 0 additions & 5 deletions
This file was deleted.

examples/RNOneSignalTS/App.tsx

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,7 @@
66
*/
77

88
import { StatusBar, StyleSheet, useColorScheme, View } from 'react-native';
9-
import {
10-
SafeAreaProvider,
11-
useSafeAreaInsets,
12-
} from 'react-native-safe-area-context';
9+
import { SafeAreaProvider } from 'react-native-safe-area-context';
1310
import OSDemo from './OSDemo';
1411

1512
function App() {
@@ -24,8 +21,6 @@ function App() {
2421
}
2522

2623
function AppContent() {
27-
const safeAreaInsets = useSafeAreaInsets();
28-
2924
return (
3025
<View style={styles.container}>
3126
<OSDemo name="OneSignal" />

examples/RNOneSignalTS/OSButtons.tsx

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as React from 'react';
2-
import { StyleSheet, Text, View } from 'react-native';
2+
import { Text, View } from 'react-native';
33
import { OneSignal } from 'react-native-onesignal';
44
import { renderButtonView } from './Helpers';
55
// Remove: import {Text, Divider} from '@react-native-material/core';
@@ -75,7 +75,6 @@ class OSButtons extends React.Component<Props> {
7575
const clearAllTriggersButton = renderButtonView(
7676
'Clear all triggers',
7777
() => {
78-
const triggerValue = this.props.inputFieldValue;
7978
loggingFunction(`Clearing all triggers`);
8079
OneSignal.InAppMessages.clearTriggers();
8180
},
@@ -621,11 +620,4 @@ class OSButtons extends React.Component<Props> {
621620
}
622621
}
623622

624-
const styles = StyleSheet.create({
625-
greeting: {
626-
color: '#999',
627-
fontWeight: 'bold',
628-
},
629-
});
630-
631623
export default OSButtons;

examples/RNOneSignalTS/OSConsole.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
*
88
* @format
99
*/
10-
1110
import React from 'react';
1211
import {
1312
Platform,
@@ -41,7 +40,7 @@ class OSConsole extends React.Component<Props, State> {
4140
<ScrollView
4241
nestedScrollEnabled={true}
4342
style={styles.scrollView}
44-
ref={scrollView => {
43+
ref={(scrollView) => {
4544
this.scrollView = scrollView;
4645
}}
4746
onContentSizeChange={() => this.scrollToEnd()}

examples/RNOneSignalTS/OSDemo.tsx

Lines changed: 45 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -46,68 +46,74 @@ class OSDemo extends React.Component<Props, State> {
4646
// enablePushToUpdate: true,
4747
// });
4848

49-
OneSignal.Notifications.addEventListener('foregroundWillDisplay', event => {
50-
this.OSLog('OneSignal: notification will show in foreground:', event);
51-
let notif = event.getNotification();
52-
53-
const cancelButton = {
54-
text: 'Cancel',
55-
onPress: () => {
56-
event.preventDefault();
57-
},
58-
style: 'cancel',
59-
};
60-
61-
const completeButton = {
62-
text: 'Display',
63-
onPress: () => {
64-
event.getNotification().display();
65-
},
66-
};
67-
68-
Alert.alert(
69-
'Display notification?',
70-
notif.title,
71-
[cancelButton, completeButton],
72-
{
73-
cancelable: true,
74-
},
75-
);
76-
});
49+
OneSignal.Notifications.addEventListener(
50+
'foregroundWillDisplay',
51+
(event) => {
52+
this.OSLog('OneSignal: notification will show in foreground:', event);
53+
let notif = event.getNotification();
54+
55+
const cancelButton = {
56+
text: 'Cancel',
57+
onPress: () => {
58+
event.preventDefault();
59+
},
60+
style: 'cancel',
61+
};
62+
63+
const completeButton = {
64+
text: 'Display',
65+
onPress: () => {
66+
event.getNotification().display();
67+
},
68+
};
69+
70+
Alert.alert(
71+
'Display notification?',
72+
notif.title,
73+
[cancelButton, completeButton],
74+
{
75+
cancelable: true,
76+
},
77+
);
78+
},
79+
);
7780

78-
OneSignal.Notifications.addEventListener('click', event => {
81+
OneSignal.Notifications.addEventListener('click', (event) => {
7982
this.OSLog('OneSignal: notification clicked:', event);
8083
});
8184

82-
OneSignal.InAppMessages.addEventListener('click', event => {
85+
OneSignal.InAppMessages.addEventListener('click', (event) => {
8386
this.OSLog('OneSignal IAM clicked:', event);
8487
});
8588

86-
OneSignal.InAppMessages.addEventListener('willDisplay', event => {
89+
OneSignal.InAppMessages.addEventListener('willDisplay', (event) => {
8790
this.OSLog('OneSignal: will display IAM: ', event);
8891
});
8992

90-
OneSignal.InAppMessages.addEventListener('didDisplay', event => {
93+
OneSignal.InAppMessages.addEventListener('didDisplay', (event) => {
9194
this.OSLog('OneSignal: did display IAM: ', event);
9295
});
9396

94-
OneSignal.InAppMessages.addEventListener('willDismiss', event => {
97+
OneSignal.InAppMessages.addEventListener('willDismiss', (event) => {
9598
this.OSLog('OneSignal: will dismiss IAM: ', event);
9699
});
97100

98-
OneSignal.InAppMessages.addEventListener('didDismiss', event => {
101+
OneSignal.InAppMessages.addEventListener('didDismiss', (event) => {
99102
this.OSLog('OneSignal: did dismiss IAM: ', event);
100103
});
101104

102-
OneSignal.User.pushSubscription.addEventListener('change', subscription => {
103-
this.OSLog('OneSignal: subscription changed:', subscription);
104-
});
105+
OneSignal.User.pushSubscription.addEventListener(
106+
'change',
107+
(subscription) => {
108+
this.OSLog('OneSignal: subscription changed:', subscription);
109+
},
110+
);
105111

106-
OneSignal.Notifications.addEventListener('permissionChange', granted => {
112+
OneSignal.Notifications.addEventListener('permissionChange', (granted) => {
107113
this.OSLog('OneSignal: permission changed:', granted);
108114
});
109115

110-
OneSignal.User.addEventListener('change', event => {
116+
OneSignal.User.addEventListener('change', (event) => {
111117
this.OSLog('OneSignal: user changed: ', event);
112118
});
113119
}

examples/RNOneSignalTS/__tests__/App.test.tsx

Lines changed: 0 additions & 13 deletions
This file was deleted.

0 commit comments

Comments
 (0)