Skip to content

Commit f82ec89

Browse files
Merge pull request #55 from leandrosimoes/chore/add-prettier-in-lint-command
chore(): add prettier on lint
2 parents 70dea29 + 401b163 commit f82ec89

File tree

8 files changed

+129
-135
lines changed

8 files changed

+129
-135
lines changed

package/.eslintignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node_modules/
2+
android/
3+
.vscode/

package/.eslintrc

Lines changed: 43 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,43 @@
1-
{
2-
"root": true,
3-
"extends": [
4-
"airbnb",
5-
"prettier"
6-
],
7-
"rules": {
8-
"radix": 0,
9-
"no-prototype-builtins": 0,
10-
"no-return-await": 0,
11-
"no-empty": 0,
12-
"no-param-reassign": 0,
13-
"react-hooks/exhaustive-deps": 0,
14-
"react/static-property-placement": 0,
15-
"react/jsx-filename-extension": [
16-
1,
17-
{
18-
"extensions": [
19-
".js",
20-
".jsx"
21-
]
22-
}
23-
],
24-
"@typescript-eslint/no-empty-function": 0,
25-
"import/prefer-default-export": 0,
26-
"import/extensions": 0,
27-
"import/named": 0,
28-
"import/no-named-as-default": 0,
29-
"import/no-named-as-default-member": 0,
30-
"prettier/prettier": [
31-
"error",
32-
{
33-
"trailingComma": "es5",
34-
"singleQuote": true,
35-
"printWidth": 100
36-
}
37-
]
38-
},
39-
"plugins": [
40-
"import",
41-
"jsx-a11y",
42-
"prettier",
43-
"react",
44-
"react-hooks"
45-
],
46-
"settings": {
47-
"import/resolver": {
48-
"node": {
49-
"extensions": [".js", ".jsx"],
50-
"paths": ["src"]
51-
}
52-
}
53-
},
54-
"ignorePatterns": ["*.d.ts"]
55-
}
1+
{
2+
"root": true,
3+
"extends": ["airbnb", "prettier"],
4+
"rules": {
5+
"radix": 0,
6+
"no-prototype-builtins": 0,
7+
"no-return-await": 0,
8+
"no-empty": 0,
9+
"no-param-reassign": 0,
10+
"react-hooks/exhaustive-deps": 0,
11+
"react/static-property-placement": 0,
12+
"react/jsx-filename-extension": [
13+
1,
14+
{
15+
"extensions": [".js", ".jsx"]
16+
}
17+
],
18+
"@typescript-eslint/no-empty-function": 0,
19+
"import/prefer-default-export": 0,
20+
"import/extensions": 0,
21+
"import/named": 0,
22+
"import/no-named-as-default": 0,
23+
"import/no-named-as-default-member": 0,
24+
"prettier/prettier": [
25+
"error",
26+
{
27+
"trailingComma": "es5",
28+
"singleQuote": true,
29+
"printWidth": 100
30+
}
31+
]
32+
},
33+
"plugins": ["import", "jsx-a11y", "prettier", "react", "react-hooks"],
34+
"settings": {
35+
"import/resolver": {
36+
"node": {
37+
"extensions": [".js", ".jsx"],
38+
"paths": ["src"]
39+
}
40+
}
41+
},
42+
"ignorePatterns": ["*.d.ts"]
43+
}

package/.prettierignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node_modules/
2+
android/
3+
.vscode/

package/.vscode/settings.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
{
2-
"typescript.tsdk": "./node_modules/typescript/lib",
3-
"editor.formatOnSave": false,
4-
"editor.codeActionsOnSave": {
5-
"source.fixAll.eslint": true
6-
},
7-
}
1+
{
2+
"typescript.tsdk": "./node_modules/typescript/lib",
3+
"editor.formatOnSave": false,
4+
"editor.codeActionsOnSave": {
5+
"source.fixAll.eslint": true
6+
}
7+
}

package/README.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,18 @@
22

33
React Native Android Notification Listener is a library that allows you to listen for status bar notifications from all applications. (Android Only)
44

5-
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/bfbf75b8e92f446481f5ce4b0d077b0b)](https://app.codacy.com/manual/leandrosimoes/react-native-android-notification-listener?utm_source=github.com\&utm_medium=referral\&utm_content=leandrosimoes/react-native-android-notification-listener\&utm_campaign=Badge_Grade_Dashboard)
5+
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/bfbf75b8e92f446481f5ce4b0d077b0b)](https://app.codacy.com/manual/leandrosimoes/react-native-android-notification-listener?utm_source=github.com&utm_medium=referral&utm_content=leandrosimoes/react-native-android-notification-listener&utm_campaign=Badge_Grade_Dashboard)
66
[![npm version](https://badge.fury.io/js/react-native-android-notification-listener.svg)](https://badge.fury.io/js/react-native-android-notification-listener)
77
![Node.js Package](https://github.com/leandrosimoes/react-native-android-notification-listener/workflows/Node%2Ejs%20Package/badge.svg)
88

99
## Installation
1010

11-
* For React Native greater or equal then 0.68.0
12-
- `$ yarn add react-native-android-notification-listener`
13-
* For React Native between 0.65.1 and 0.67.4
14-
- `$ yarn add [email protected]`
15-
* For React Native less then 0.65
16-
- `$ yarn add [email protected]`
11+
- For React Native greater or equal then 0.68.0
12+
- `$ yarn add react-native-android-notification-listener`
13+
- For React Native between 0.65.1 and 0.67.4
14+
- `$ yarn add [email protected]`
15+
- For React Native less then 0.65
16+
- `$ yarn add [email protected]`
1717

1818
## Usage
1919

@@ -55,16 +55,16 @@ const headlessNotificationListener = async ({ notification }) => {/**
5555
* "icon": string (base64),
5656
* "image": string (base64), // WARNING! THIS MAY NOT WORK FOR SOME APPLICATIONS SUCH TELEGRAM AND WHATSAPP
5757
* }
58-
*
58+
*
5959
* Note that these properties depend on the sender configuration so many times a lot of them will be empty
6060
*/
61-
61+
6262
if (notification) {
6363
/**
6464
* You could store the notifications in an external API.
6565
* I'm using AsyncStorage in the example project.
6666
*/
67-
67+
6868
...
6969
}
7070
}
@@ -73,9 +73,9 @@ const headlessNotificationListener = async ({ notification }) => {/**
7373
* This should be required early in the sequence
7474
* to make sure the JS execution environment is setup before other
7575
* modules are required.
76-
*
76+
*
7777
* Your entry file (index.js) would be the better place for it.
78-
*
78+
*
7979
* PS: I'm using here the constant RNAndroidNotificationListenerHeadlessJsName to ensure
8080
* that I register the headless with the right name
8181
*/
@@ -91,10 +91,10 @@ For more details, see the `example/` project in this repository
9191
Yes, there are some nuances that you should concern about. For example, since Headless JS runs in a standalone "Task" you can't interact directly with it by the touch UI.
9292
For more information about using Headless JS in React Native, I suggest you take a look at the official documentation [here](https://reactnative.dev/docs/headless-js-android).
9393

94-
***
94+
---
9595

9696
"I keep receiving the warning `registerHeadlessTask or registerCancellableHeadlessTask called multiple times for the same key '${taskKey}'`, is that a problem?
9797

9898
No, this warning is here, where you can see that the task providers are stored in a set, and there's no way to delete them, so react is just complaining about the fact that we are overwriting it.
9999

100-
***
100+
---

package/index.d.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
export declare type RNAndroidNotificationListenerPermissionStatus = 'unknown' | 'authorized' | 'denied'
2-
export declare const RNAndroidNotificationListenerHeadlessJsName = 'RNAndroidNotificationListenerHeadlessJs'
3-
4-
export declare function requestPermission(): void
5-
export declare function getPermissionStatus(): Promise<RNAndroidNotificationListenerPermissionStatus>
1+
export declare type RNAndroidNotificationListenerPermissionStatus = 'unknown' | 'authorized' | 'denied'
2+
export declare const RNAndroidNotificationListenerHeadlessJsName = 'RNAndroidNotificationListenerHeadlessJs'
3+
4+
export declare function requestPermission(): void
5+
export declare function getPermissionStatus(): Promise<RNAndroidNotificationListenerPermissionStatus>

package/package.json

Lines changed: 53 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,55 @@
11
{
2-
"name": "react-native-android-notification-listener",
3-
"title": "React Native Android Notification Listener",
4-
"version": "5.0.1",
5-
"description": "React Native Android Notification Listener - Listen for status bar notifications from all applications",
6-
"main": "index.js",
7-
"typings": "index.d.ts",
8-
"scripts": {
9-
"lint": "eslint . --ext .js,.jsx,.ts,.tsx",
10-
"lint:fix": "eslint . --ext .js,.jsx,.ts,.tsx --fix",
11-
"prepare": "cd .. && husky install && cd package"
12-
},
13-
"repository": {
14-
"type": "git",
15-
"url": "git+https://github.com/leandrosimoes/react-native-android-notification-listener.git",
16-
"baseUrl": "https://github.com/leandrosimoes/react-native-android-notification-listener"
17-
},
18-
"keywords": [
19-
"react-native",
20-
"android",
21-
"notification",
22-
"listener"
23-
],
24-
"author": {
25-
"name": "Leandro Simões",
26-
"email": "[email protected]"
27-
},
28-
"license": "MIT",
29-
"licenseFilename": "LICENSE",
30-
"readmeFilename": "README.md",
31-
"peerDependencies": {
32-
"react": "^18.0.0",
33-
"react-native": ">=0.69.0"
34-
},
35-
"devDependencies": {
36-
"@commitlint/cli": "^17.3.0",
37-
"@commitlint/config-conventional": "^17.3.0",
38-
"@react-native-community/eslint-config": "^3.0.3",
39-
"@types/react-native": "^0.69.0",
40-
"@types/react-redux": "^7.1.24",
41-
"eslint": "^8.18.0",
42-
"eslint-config-airbnb": "^19.0.4",
43-
"eslint-config-prettier": "^8.5.0",
44-
"eslint-import-resolver-node": "^0.3.6",
45-
"eslint-plugin-import": "^2.26.0",
46-
"eslint-plugin-jsx-a11y": "^6.6.0",
47-
"eslint-plugin-prettier": "^4.0.0",
48-
"eslint-plugin-react": "^7.30.1",
49-
"eslint-plugin-react-hooks": "^4.6.0",
50-
"husky": "^8.0.2",
51-
"prettier": "^2.7.1",
52-
"react": "^18.0.0",
53-
"react-native": "^0.69.0"
54-
}
2+
"name": "react-native-android-notification-listener",
3+
"title": "React Native Android Notification Listener",
4+
"version": "5.0.1",
5+
"description": "React Native Android Notification Listener - Listen for status bar notifications from all applications",
6+
"main": "index.js",
7+
"typings": "index.d.ts",
8+
"scripts": {
9+
"lint": "eslint . --ext .js,.jsx,.ts,.tsx && prettier . -c",
10+
"lint:fix": "eslint . --ext .js,.jsx,.ts,.tsx --fix && prettier -w .",
11+
"prepare": "cd .. && husky install && cd package"
12+
},
13+
"repository": {
14+
"type": "git",
15+
"url": "git+https://github.com/leandrosimoes/react-native-android-notification-listener.git",
16+
"baseUrl": "https://github.com/leandrosimoes/react-native-android-notification-listener"
17+
},
18+
"keywords": [
19+
"react-native",
20+
"android",
21+
"notification",
22+
"listener"
23+
],
24+
"author": {
25+
"name": "Leandro Simões",
26+
"email": "[email protected]"
27+
},
28+
"license": "MIT",
29+
"licenseFilename": "LICENSE",
30+
"readmeFilename": "README.md",
31+
"peerDependencies": {
32+
"react": "^18.0.0",
33+
"react-native": ">=0.69.0"
34+
},
35+
"devDependencies": {
36+
"@commitlint/cli": "^17.3.0",
37+
"@commitlint/config-conventional": "^17.3.0",
38+
"@react-native-community/eslint-config": "^3.0.3",
39+
"@types/react-native": "^0.69.0",
40+
"@types/react-redux": "^7.1.24",
41+
"eslint": "^8.18.0",
42+
"eslint-config-airbnb": "^19.0.4",
43+
"eslint-config-prettier": "^8.5.0",
44+
"eslint-import-resolver-node": "^0.3.6",
45+
"eslint-plugin-import": "^2.26.0",
46+
"eslint-plugin-jsx-a11y": "^6.6.0",
47+
"eslint-plugin-prettier": "^4.0.0",
48+
"eslint-plugin-react": "^7.30.1",
49+
"eslint-plugin-react-hooks": "^4.6.0",
50+
"husky": "^8.0.2",
51+
"prettier": "^2.8.1",
52+
"react": "^18.0.0",
53+
"react-native": "^0.69.0"
54+
}
5555
}

package/yarn.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5064,7 +5064,7 @@ prettier-linter-helpers@^1.0.0:
50645064
dependencies:
50655065
fast-diff "^1.1.2"
50665066

5067-
prettier@^2.7.1:
5067+
prettier@^2.8.1:
50685068
version "2.8.1"
50695069
resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.8.1.tgz#4e1fd11c34e2421bc1da9aea9bd8127cd0a35efc"
50705070
integrity sha512-lqGoSJBQNJidqCHE80vqZJHWHRFoNYsSpP9AjFhlhi9ODCJA541svILes/+/1GM3VaL/abZi7cpFzOpdR9UPKg==

0 commit comments

Comments
 (0)