diff --git a/.eslintignore b/.eslintignore
new file mode 100644
index 0000000..651ab83
--- /dev/null
+++ b/.eslintignore
@@ -0,0 +1,10 @@
+.github
+.next
+build
+bundles
+coverage
+dist
+lib
+node_modules
+out
+public
diff --git a/.eslintrc.yaml b/.eslintrc.yaml
index fda49f7..bfcc560 100644
--- a/.eslintrc.yaml
+++ b/.eslintrc.yaml
@@ -10,38 +10,38 @@ extends:
- plugin:react-hooks/recommended
- plugin:jest/recommended
- plugin:jest-dom/recommended
-parser: "@babel/eslint-parser"
+parser: '@babel/eslint-parser'
plugins:
- - "@babel"
+ - '@babel'
- jest
- react
- react-hooks
- testing-library
overrides:
- files:
- - "**/__tests__/**/*.[jt]s?(x)"
- - "**/?(*.)+(spec|test).[jt]s?(x)"
+ - '**/__tests__/**/*.[jt]s?(x)'
+ - '**/?(*.)+(spec|test).[jt]s?(x)'
extends:
- - "plugin:testing-library/react"
+ - 'plugin:testing-library/react'
- files:
- - "**/*.ts?(x)"
- parser: "@typescript-eslint/parser"
+ - '**/*.ts?(x)'
+ parser: '@typescript-eslint/parser'
parserOptions:
- tsconfigRootDir: .
- project: ['./tsconfig.json']
+ tsconfigRootDir: .
+ project: ['./tsconfig.json']
extends:
- eslint:recommended
- plugin:@typescript-eslint/eslint-recommended
- plugin:@typescript-eslint/recommended
- plugin:@typescript-eslint/recommended-requiring-type-checking
rules:
- "@typescript-eslint/no-unused-vars":
+ '@typescript-eslint/no-unused-vars':
- error
- - varsIgnorePattern: "^_"
- argsIgnorePattern: "^_"
+ - varsIgnorePattern: '^_'
+ argsIgnorePattern: '^_'
# For compat with jest: https://typescript-eslint.io/rules/unbound-method/
- "@typescript-eslint/unbound-method": "off"
- "jest/unbound-method": "error"
+ '@typescript-eslint/unbound-method': 'off'
+ 'jest/unbound-method': 'error'
rules:
quotes:
- error
diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml
index 2077320..f16b6ce 100644
--- a/.github/workflows/ci.yaml
+++ b/.github/workflows/ci.yaml
@@ -1,14 +1,15 @@
-name: rollbar-react CI
+name: ci
on:
push:
- branches: [ '**' ]
+ branches:
+ - main
pull_request:
- branches: [ main ]
+ branches:
+ - main
jobs:
build:
-
runs-on: ubuntu-latest
strategy:
@@ -16,12 +17,47 @@ jobs:
node-version: [14.x]
steps:
- - uses: actions/checkout@v2
-
- - name: Use Node.js ${{ matrix.node-version }}
- uses: actions/setup-node@v1
- with:
- node-version: ${{ matrix.node-version }}
- - run: npm install
- - run: npm run lint
- - run: npm run test
+ - name: Checkout
+ uses: actions/checkout@v4
+
+ - name: Set up node ${{ matrix.node-version }}
+ uses: actions/setup-node@v4
+ with:
+ node-version: ${{ matrix.node-version }}
+
+ - name: Cache
+ uses: actions/cache@v4
+ with:
+ path: ~/.npm
+ key: ${{ runner.os }}-node-${{ matrix.node-version }}-${{ hashFiles('**/package-lock.json') }}
+ restore-keys: |
+ ${{ runner.os }}-node-${{ matrix.node-version }}-
+ ${{ runner.os }}-node-
+ ${{ runner.os }}-
+
+ - name: Install dependencies
+ run: npm ci
+
+ - name: Install examples/create-react-app dependencies
+ run: npm ci
+ working-directory: ./examples/create-react-app
+
+ - name: Install examples/nextjs dependencies
+ run: npm ci
+ working-directory: ./examples/nextjs
+
+ - name: Install examples/typescript dependencies
+ run: npm ci
+ working-directory: ./examples/typescript
+
+ - name: Lint
+ uses: wearerequired/lint-action@v2
+ with:
+ github_token: ${{ secrets.GITHUB_TOKEN }}
+ prettier: true
+ eslint: true
+ eslint_extensions: js,jsx,ts,tsx
+ eslint_args: '--max-warnings 0'
+
+ - name: Test
+ run: npm run test
diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml
index 444484d..4f40bdf 100644
--- a/.github/workflows/publish.yaml
+++ b/.github/workflows/publish.yaml
@@ -6,16 +6,16 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v2
- # Setup .npmrc file to publish to GitHub Packages
- - uses: actions/setup-node@v2
- with:
- node-version: '12.x'
- registry-url: 'https://registry.npmjs.org'
- # Defaults to the user or organization that owns the workflow file
- # scope: '@rollbar'
- - run: npm install
- - run: npm run build
- - run: npm publish --access public
- env:
- NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
+ - uses: actions/checkout@v2
+ # Setup .npmrc file to publish to GitHub Packages
+ - uses: actions/setup-node@v2
+ with:
+ node-version: "12.x"
+ registry-url: "https://registry.npmjs.org"
+ # Defaults to the user or organization that owns the workflow file
+ # scope: '@rollbar'
+ - run: npm install
+ - run: npm run build
+ - run: npm publish --access public
+ env:
+ NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
diff --git a/.prettierignore b/.prettierignore
new file mode 100644
index 0000000..651ab83
--- /dev/null
+++ b/.prettierignore
@@ -0,0 +1,10 @@
+.github
+.next
+build
+bundles
+coverage
+dist
+lib
+node_modules
+out
+public
diff --git a/.vscode/settings.json b/.vscode/settings.json
new file mode 100644
index 0000000..192c739
--- /dev/null
+++ b/.vscode/settings.json
@@ -0,0 +1,38 @@
+{
+ "[github-actions-workflow]": {
+ "editor.defaultFormatter": "esbenp.prettier-vscode",
+ "editor.formatOnSave": true
+ },
+ "[javascript]": {
+ "editor.defaultFormatter": "esbenp.prettier-vscode",
+ "editor.formatOnSave": true
+ },
+ "[javascriptreact]": {
+ "editor.defaultFormatter": "esbenp.prettier-vscode",
+ "editor.formatOnSave": true
+ },
+ "[json5]": {
+ "editor.defaultFormatter": "esbenp.prettier-vscode",
+ "editor.formatOnSave": true
+ },
+ "[jsonc]": {
+ "editor.defaultFormatter": "esbenp.prettier-vscode",
+ "editor.formatOnSave": true
+ },
+ "[typescript]": {
+ "editor.defaultFormatter": "esbenp.prettier-vscode",
+ "editor.formatOnSave": true
+ },
+ "[typescriptreact]": {
+ "editor.defaultFormatter": "esbenp.prettier-vscode",
+ "editor.formatOnSave": true
+ },
+ "editor.defaultFormatter": "esbenp.prettier-vscode",
+ "editor.formatOnSave": true,
+ "editor.formatOnSaveMode": "file",
+ "editor.tabSize": 2,
+ "editor.codeActionsOnSave": {
+ "source.fixAll.eslint": "explicit"
+ },
+ "files.trimTrailingWhitespace": true
+}
diff --git a/README.md b/README.md
index 3677847..bc8495c 100644
--- a/README.md
+++ b/README.md
@@ -10,7 +10,6 @@
---
-
React features to enhance using Rollbar.js in React Applications.
This SDK provides a wrapper around the base [Rollbar.js] SDK in order to provide an
@@ -18,12 +17,12 @@ SDK that matches the intention of how to build React Apps with a declarative API
hooks and ErrorBoundaries, as well as simplify using Rollbar within a React SPA.
## Key benefits of using Rollbar React are:
+
- **Telemetry:** The telemetry timeline provides a list of “breadcrumbs” events that can help developers understand and fix problems in their client-side javascript. Learn more about telemetry.
- **Automatic error grouping:** Rollbar aggregates Occurrences caused by the same error into Items that represent application issues. Learn more about reducing log noise.
- **Advanced search:** Filter items by many different properties. Learn more about search.
- **Customizable notifications:** Rollbar supports several messaging and incident management tools where your team can get notified about errors and important events by real-time alerts. Learn more about Rollbar notifications.
-
### In Beta
It is currently in a public Beta release right now as we push towards a 1.0 release that will have all of the features
@@ -143,21 +142,17 @@ The simplest way to use the `Provider` is to provide a configuration as the `con
instance of Rollbar for you and provide that to its child tree:
```javascript
-import React from 'react';
-import { Provider } from '@rollbar/react';
+import React from 'react'
+import { Provider } from '@rollbar/react'
// same configuration you would create for the Rollbar.js SDK
const rollbarConfig = {
accessToken: 'POST_CLIENT_ITEM_ACCESS_TOKEN',
environment: 'production',
-};
+}
export function App(props) {
- return (
-
{error.toString()}
Oops, there was an error.
} + fallbackUI={() => ( +Oops, there was an error.
+ )} extra={{ more: 'data' }} callback={() => console.log('an exception was sent to rollbar')} > @@ -51,10 +50,10 @@ function App() {Message: {fullMessage}
- setMessage(event.target.value)} /> + setMessage(event.target.value)} + />{error.toString()}
}Oops, there was an error.
} + fallbackUI={() => ( +Oops, there was an error.
+ )} extra={{ more: 'data' }} callback={() => console.log('an exception was sent to rollbar')} >
Get started by sending a message{' '}
-
- Rollbar React Example -
+Rollbar React Example