Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 0 additions & 25 deletions .eslintrc.js

This file was deleted.

2 changes: 1 addition & 1 deletion auth/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*/

// auth is used as a namespace to access types
// eslint-disable-next-line @typescript-eslint/no-unused-vars
import {Auth} from 'firebase/auth';
import {onAuthStateChanged, onIdTokenChanged, getIdToken} from 'firebase/auth';
import {Observable, from, of} from 'rxjs';
Expand Down
54 changes: 54 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import { defineConfig } from 'eslint/config';
import eslint from '@eslint/js';
import globals from 'globals';
import jsdoc from 'eslint-plugin-jsdoc';
import tseslint from 'typescript-eslint';

export default defineConfig([
{
name: 'Project - Ignores',
ignores: ['dist/**', 'node_modules/**', '.firebase/**', '.yarn/**'],
},
{
name: 'ESLint JS - Recommended',
extends: [
eslint.configs.recommended,
...tseslint.configs.recommended,
],
},
{
name: 'Project - TypeScript',
files: ['**/*.ts'],
plugins: {
jsdoc,
},
languageOptions: {
globals: {
...globals.browser,
...globals.node,
},
parserOptions: {
ecmaVersion: 2021,
sourceType: 'module',
},
},
rules: {
'max-len': 'off',
'no-empty': ['error', { allowEmptyCatch: true }],
'no-unused-vars': 'off',
'@typescript-eslint/no-empty-object-type': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-unused-vars': ['error', { caughtErrors: 'none' }],
'@typescript-eslint/no-wrapper-object-types': 'off',
'jsdoc/check-param-names': 'warn',
'jsdoc/require-jsdoc': 'warn',
'jsdoc/require-param': 'warn',
'jsdoc/require-param-description': 'warn',
'jsdoc/require-param-type': 'warn',
'jsdoc/require-returns': ['warn', { forceRequireReturn: true }],
'jsdoc/require-returns-description': 'warn',
'jsdoc/require-returns-type': 'warn',
'jsdoc/valid-types': 'warn',
},
},
]);
4 changes: 2 additions & 2 deletions firestore/fromRef.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ import {DocumentReference, DocumentData, SnapshotListenOptions, Query, DocumentS

const DEFAULT_OPTIONS = {includeMetadataChanges: false};

/* eslint-disable @typescript-eslint/no-explicit-any */
export function fromRef<T=DocumentData>(ref: DocumentReference<T>, options?: SnapshotListenOptions): Observable<DocumentSnapshot<T>>;
export function fromRef<T=DocumentData>(ref: Query<T>, options?: SnapshotListenOptions): Observable<QuerySnapshot<T>>;
export function fromRef(
ref: any,
options: SnapshotListenOptions=DEFAULT_OPTIONS,
): Observable<any> {
/* eslint-enable @typescript-eslint/no-explicit-any */
return new Observable((subscriber) => {
const unsubscribe = onSnapshot(ref, options, {
next: subscriber.next.bind(subscriber),
Expand Down
2 changes: 1 addition & 1 deletion functions/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*/

// function is used as a namespace to access types
// eslint-disable-next-line @typescript-eslint/no-unused-vars
import {httpsCallable as vanillaHttpsCallable} from 'firebase/functions';
import {from, Observable} from 'rxjs';
import {map} from 'rxjs/operators';
Expand Down
23 changes: 12 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@
"url": "https://github.com/firebaseextended/rxfire.git"
},
"scripts": {
"lint": "eslint -c .eslintrc.js '**/*.ts' --ignore-path './.gitignore'",
"lint:fix": "eslint --fix -c .eslintrc.js '**/*.ts' --ignore-path './.gitignore'",
"lint": "eslint \"**/*.ts\"",
"lint:fix": "eslint --fix \"**/*.ts\"",
"build": "run-s build:**",
"build:clean": "rm -rf dist",
"build:types": "tsc --emitDeclarationOnly",
Expand All @@ -95,23 +95,24 @@
"@babel/core": "^7.12.10",
"@babel/preset-env": "^7.12.11",
"@babel/preset-typescript": "^7.12.7",
"@rollup/plugin-commonjs": "^15.1.0",
"@rollup/plugin-node-resolve": "^9.0.0",
"@rollup/plugin-typescript": "^8.1.0",
"@rollup/plugin-commonjs": "^29.0.3",
"@rollup/plugin-node-resolve": "^16.0.3",
"@rollup/plugin-typescript": "^12.3.0",
"@eslint/js": "^10.0.1",
"@types/jest": "^29.5.4",
"@typescript-eslint/eslint-plugin": "^6.4.1",
"@typescript-eslint/parser": "^6.4.1",
"typescript-eslint": "^8.70.1",
"babel-jest": "^29.6.4",
"cross-fetch": "^3.1.4",
"eslint": "^7.32.0",
"eslint-config-google": "^0.14.0",
"eslint": "^10.11.0",
"eslint-plugin-jsdoc": "^62.9.0",
"firebase": "^10.0.0",
"glob": "^7.1.6",
"glob": "^13.0.6",
"globals": "^17.12.0",
"jest": "^29.6.4",
"jest-environment-jsdom": "^29.6.4",
"md5": "^2.3.0",
"npm-run-all": "^4.1.5",
"rollup": "^2.33.2",
"rollup": "^4.63.5",
"rollup-plugin-generate-package-json": "^3.2.0",
"rxjs": "^7.0.0",
"tslib": "^2.6.0",
Expand Down
30 changes: 3 additions & 27 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ import { resolve, dirname, relative, join } from 'path';
import resolveModule from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import typescript from '@rollup/plugin-typescript';
import { peerDependencies, dependencies } from './package.json';
import { sync as globSync } from 'glob';
import { globSync } from 'glob';
import { readFileSync } from 'fs';
import generatePackageJson from 'rollup-plugin-generate-package-json';

const { peerDependencies, dependencies } = JSON.parse(readFileSync('./package.json', { encoding: 'utf-8' }));
const packageJsonPaths = globSync('**/package.json', { ignore: ['node_modules/**', 'dist/**', 'test/**'] });
const packages = packageJsonPaths.reduce((acc, path) => {
const pkg = JSON.parse(readFileSync(path, { encoding: 'utf-8'} ));
Expand Down Expand Up @@ -61,30 +61,6 @@ const external = [
'rxjs/operators'
];

const globals = {
//rxfire: GLOBAL_NAME,
rxjs: 'rxjs',
tslib: 'tslib',
...Object.values(packages).reduce((acc, {name}) => (acc[name] = name.replace(/\//g, '.'), acc), {}),
'firebase/firestore': 'firebase.firestore',
'firebase/firestore/lite': 'firebase.firestore-lite',
'firebase/auth': 'firebase.auth',
'firebase/functions': 'firebase.functions',
'firebase/storage': 'firebase.storage',
'firebase/database': 'firebase.database',
'firebase/remote-config': 'firebase.remote-config',
'firebase/performance': 'firebase.performance',
'@firebase/firestore': 'firebase.firestore',
'@firebase/firestore/lite': 'firebase.firestore-lite',
'@firebase/auth': 'firebase.auth',
'@firebase/functions': 'firebase.functions',
'@firebase/storage': 'firebase.storage',
'@firebase/database': 'firebase.database',
'@firebase/remote-config': 'firebase.remote-config',
'@firebase/performance': 'firebase.performance',
'rxjs/operators': 'rxjs.operators',
};

export default Object.keys(packages)
.map(component => {
const baseContents = packages[component];
Expand Down Expand Up @@ -120,7 +96,7 @@ export default Object.keys(packages)
plugins: [
...plugins,
// TS sourceMaps conflict with Rollup sourceMaps
typescript({ sourceMap: false }),
typescript({ sourceMap: false, compilerOptions: { declaration: false } }),
generatePackageJson({ outputFolder, baseContents }),
],
external
Expand Down
4 changes: 2 additions & 2 deletions test/database.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
* limitations under the License.
*/

/* eslint-disable @typescript-eslint/no-floating-promises */

// app/database is used as namespaces to access types
// eslint-disable-next-line @typescript-eslint/no-unused-vars
import {initializeApp, FirebaseApp} from 'firebase/app';
import {
Database,
Expand Down
4 changes: 2 additions & 2 deletions test/firestore-lite.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
* limitations under the License.
*/

/* eslint-disable @typescript-eslint/no-floating-promises */

// app is used as namespaces to access types
// eslint-disable-next-line @typescript-eslint/no-unused-vars
import {
collection,
docData,
Expand Down
4 changes: 2 additions & 2 deletions test/firestore.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
* limitations under the License.
*/

/* eslint-disable @typescript-eslint/no-floating-promises */

// app is used as namespaces to access types
// eslint-disable-next-line @typescript-eslint/no-unused-vars
import {
collection,
collectionChanges,
Expand Down
2 changes: 1 addition & 1 deletion test/functions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

/* eslint-disable @typescript-eslint/no-floating-promises */

import {initializeApp, FirebaseApp} from 'firebase/app';
import {getFunctions, connectFunctionsEmulator, Functions} from 'firebase/functions';
Expand Down
4 changes: 2 additions & 2 deletions test/storage.pending-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ const rando = (): string => [
class MockTask {
_resolve: (value: any) => void;
_reject: (reason?: any) => void;
_state_changed_cbs: Array<(snapshot: UploadTaskSnapshot) => {}> = []; // eslint-disable-line camelcase
_state_change = (progress: any) => { // eslint-disable-line camelcase
_state_changed_cbs: Array<(snapshot: UploadTaskSnapshot) => {}> = [];
_state_change = (progress: any) => {
this.snapshot = progress;
this._state_changed_cbs.forEach((it) => it(progress));
if (progress.state === 'canceled') {
Expand Down
Loading
Loading