Skip to content

Commit 6fa2c1f

Browse files
committed
Merge branch 'master' of https://github.com/firebase/firebase-js-sdk to incorporate custom metric and custom attribute validation checking.
2 parents 181445c + 95cbd6f commit 6fa2c1f

File tree

287 files changed

+5314
-2745
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

287 files changed

+5314
-2745
lines changed

config/.eslintrc.json

Lines changed: 177 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,177 @@
1+
{
2+
"env": {
3+
"browser": true,
4+
"es6": true,
5+
"node": true
6+
},
7+
"parser": "@typescript-eslint/parser",
8+
"plugins": [
9+
"@typescript-eslint",
10+
"@typescript-eslint/tslint",
11+
"import"
12+
],
13+
"parserOptions": {
14+
"ecmaVersion": 2015,
15+
"sourceType": "module"
16+
},
17+
"overrides": [
18+
{
19+
"files": [
20+
"**/*.test.ts",
21+
"**/test/**/*.ts"
22+
],
23+
"rules": {
24+
"no-unused-expressions": "off",
25+
"@typescript-eslint/no-explicit-any": "off"
26+
}
27+
}
28+
],
29+
"rules": {
30+
"curly": [
31+
"error",
32+
"all"
33+
],
34+
"guard-for-in": "error",
35+
"no-extra-label": "error",
36+
"no-unused-labels": "error",
37+
"new-parens": "error",
38+
"no-new-wrappers": "error",
39+
"no-debugger": "error",
40+
"no-duplicate-case": "error",
41+
"no-throw-literal": "error",
42+
"no-return-await": "error",
43+
"no-unsafe-finally": "error",
44+
"no-unused-expressions": [
45+
"error",
46+
{
47+
"allowShortCircuit": true
48+
}
49+
],
50+
"no-var": "error",
51+
"object-shorthand": "error",
52+
"prefer-arrow-callback": [
53+
"error",
54+
{
55+
"allowNamedFunctions": true
56+
}
57+
],
58+
"prefer-const": [
59+
"error",
60+
{
61+
"destructuring": "all"
62+
}
63+
],
64+
"radix": "error",
65+
"default-case": "error",
66+
"eqeqeq": [
67+
"error",
68+
"always",
69+
{
70+
"null": "ignore"
71+
}
72+
],
73+
"no-caller": "error",
74+
"no-cond-assign": ["error", "always"],
75+
"use-isnan": "error",
76+
"camelcase": "error",
77+
"id-blacklist": [
78+
"error",
79+
"any",
80+
"number",
81+
"string",
82+
"boolean"
83+
],
84+
"constructor-super": "error",
85+
"import/no-default-export": "error",
86+
"import/no-duplicates": "error",
87+
"import/no-extraneous-dependencies": [
88+
"error",
89+
{
90+
"devDependencies": [
91+
"**/*.test.ts",
92+
"**/test/**/*.ts",
93+
"**/testing/**/*.ts"
94+
],
95+
"peerDependencies": true
96+
}
97+
],
98+
"@typescript-eslint/array-type": [
99+
"error",
100+
"array-simple"
101+
],
102+
"@typescript-eslint/ban-types": [
103+
"error",
104+
{
105+
"types": {
106+
"Object": "Use {} or 'object' instead.",
107+
"String": "Use 'string' instead.",
108+
"Number": "Use 'number' instead.",
109+
"Boolean": "Use 'boolean' instead."
110+
}
111+
}
112+
],
113+
"@typescript-eslint/class-name-casing": "error",
114+
"@typescript-eslint/interface-name-prefix": [
115+
"error",
116+
"never"
117+
],
118+
"@typescript-eslint/prefer-interface": "error",
119+
"@typescript-eslint/explicit-member-accessibility": [
120+
"error",
121+
{
122+
"accessibility": "no-public",
123+
"overrides": {
124+
"parameterProperties": "explicit"
125+
}
126+
}
127+
],
128+
"@typescript-eslint/no-angle-bracket-type-assertion": "error",
129+
"@typescript-eslint/no-explicit-any": "error",
130+
"@typescript-eslint/no-namespace": [
131+
"error",
132+
{
133+
"allowDeclarations": true
134+
}
135+
],
136+
"@typescript-eslint/no-triple-slash-reference": "error",
137+
"@typescript-eslint/no-require-imports": "error",
138+
"@typescript-eslint/no-useless-constructor": "error",
139+
"@typescript-eslint/semi": "error",
140+
"@typescript-eslint/explicit-function-return-type": [
141+
"error",
142+
{
143+
"allowExpressions": true,
144+
"allowTypedFunctionExpressions": true,
145+
"allowHigherOrderFunctions": true
146+
}
147+
],
148+
"@typescript-eslint/no-unused-vars": [
149+
"error",
150+
{
151+
"varsIgnorePattern": "^_",
152+
"argsIgnorePattern": "^_"
153+
}
154+
],
155+
"@typescript-eslint/tslint/config": [
156+
"error",
157+
{
158+
"rules": {
159+
"ban": [true,
160+
{"name": ["it", "skip"]},
161+
{"name": ["it", "only"]},
162+
{"name": ["describe", "skip"]},
163+
{"name": ["describe", "only"]},
164+
{"name": ["xit"]},
165+
{"name": ["xdescribe"]},
166+
{"name": "parseInt", "message": "tsstyle#type-coercion"},
167+
{"name": "parseFloat", "message": "tsstyle#type-coercion"},
168+
{"name": "Array", "message": "tsstyle#array-constructor"}
169+
],
170+
"jsdoc-format": true,
171+
"no-floating-promises": true,
172+
"arrow-return-shorthand": true
173+
}
174+
}
175+
]
176+
}
177+
}

config/functions/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ exports.dataTest = functions.https.onRequest((request, response) => {
3535
value: '3',
3636
'@type': 'type.googleapis.com/google.protobuf.Int64Value',
3737
},*/
38-
string: 'four',
38+
str: 'four',
3939
array: [5, 6],
4040
null: null
4141
}

config/tsconfig.base.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
"compilerOptions": {
44
"declaration": true,
55
"importHelpers": true,
6+
"strictNullChecks": true,
7+
"noImplicitAny": true,
68
"lib": [
79
"es2015",
810
"dom"

integration/browserify/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"test": "karma start --single-run"
88
},
99
"dependencies": {
10-
"firebase": "6.0.3"
10+
"firebase": "6.2.2"
1111
},
1212
"devDependencies": {
1313
"@babel/core": "7.4.4",

integration/firebase-typings/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"test": "tsc index.ts --outDir dist"
77
},
88
"dependencies": {
9-
"firebase": "6.0.3"
9+
"firebase": "6.2.2"
1010
},
1111
"devDependencies": {
1212
"typescript": "3.4.5"

integration/messaging/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"test:manual": "mocha --exit"
99
},
1010
"dependencies": {
11-
"firebase": "6.0.3"
11+
"firebase": "6.2.2"
1212
},
1313
"devDependencies": {
1414
"chai": "4.2.0",

integration/typescript/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"test": "karma start --single-run"
77
},
88
"dependencies": {
9-
"firebase": "6.0.3"
9+
"firebase": "6.2.2"
1010
},
1111
"devDependencies": {
1212
"@babel/core": "7.4.4",

integration/typescript/test/namespace.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
import * as firebase from 'firebase';
1919
import * as namespaceDefinition from '../../shared/namespaceDefinition.json';
20-
import * as validateNamespace from '../../shared/validator';
20+
import validateNamespace from '../../shared/validator';
2121

2222
firebase.initializeApp({
2323
apiKey: 'test-api-key',

integration/typescript/tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
"noImplicitAny": true,
1010
"outDir": "dist",
1111
"target": "ES5",
12-
"sourceMap": true
12+
"sourceMap": true,
13+
"esModuleInterop": true
1314
},
1415
"exclude": [
1516
"node_modules",

integration/webpack/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"test": "karma start --single-run"
88
},
99
"dependencies": {
10-
"firebase": "6.0.3"
10+
"firebase": "6.2.2"
1111
},
1212
"devDependencies": {
1313
"@babel/core": "7.4.4",

packages/app/.eslintrc.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"extends": "../../config/.eslintrc.json",
3+
"parserOptions": {
4+
"project": "tsconfig.json"
5+
}
6+
}

packages/app/index.lite.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,5 @@ import { createFirebaseNamespaceLite } from './src/lite/firebaseNamespaceLite';
1919

2020
export const firebase = createFirebaseNamespaceLite();
2121

22+
// eslint-disable-next-line import/no-default-export
2223
export default firebase;

packages/app/index.node.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@
1818
import { FirebaseNamespace } from '@firebase/app-types';
1919
import { _FirebaseNamespace } from '@firebase/app-types/private';
2020
import { createFirebaseNamespace } from './src/firebaseNamespace';
21+
// Node specific packages.
22+
// @ts-ignore
2123
import Storage from 'dom-storage';
24+
// @ts-ignore
2225
import { XMLHttpRequest } from 'xmlhttprequest';
2326

2427
const _firebase = createFirebaseNamespace() as _FirebaseNamespace;
@@ -35,4 +38,5 @@ _firebase.INTERNAL.extendNamespace({
3538

3639
export const firebase = _firebase as FirebaseNamespace;
3740

41+
// eslint-disable-next-line import/no-default-export
3842
export default firebase;

packages/app/index.rn.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import { createFirebaseNamespace } from './src/firebaseNamespace';
2424
* some of our tests because of duplicate symbols, we are using require syntax
2525
* here
2626
*/
27+
// eslint-disable-next-line @typescript-eslint/no-require-imports
2728
const { AsyncStorage } = require('react-native');
2829

2930
const _firebase = createFirebaseNamespace() as _FirebaseNamespace;
@@ -38,4 +39,5 @@ _firebase.INTERNAL.extendNamespace({
3839

3940
export const firebase = _firebase as FirebaseNamespace;
4041

42+
// eslint-disable-next-line import/no-default-export
4143
export default firebase;

packages/app/index.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,14 @@ import { Logger } from '@firebase/logger';
2323
const logger = new Logger('@firebase/app');
2424

2525
// Firebase Lite detection
26-
if (isBrowser() && 'firebase' in self) {
26+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
27+
if (isBrowser() && (self as any).firebase !== undefined) {
2728
logger.warn(`
2829
Warning: Firebase is already defined in the global scope. Please make sure
2930
Firebase library is only loaded once.
3031
`);
3132

33+
// eslint-disable-next-line
3234
const sdkVersion = ((self as any).firebase as FirebaseNamespace).SDK_VERSION;
3335
if (sdkVersion && sdkVersion.indexOf('LITE') >= 0) {
3436
logger.warn(`
@@ -66,4 +68,5 @@ firebaseNamespace.initializeApp = function() {
6668

6769
export const firebase = firebaseNamespace;
6870

71+
// eslint-disable-next-line import/no-default-export
6972
export default firebase;

packages/app/package.json

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@firebase/app",
3-
"version": "0.4.2",
3+
"version": "0.4.7",
44
"description": "The primary entrypoint to the Firebase JS SDK",
55
"author": "Firebase <[email protected]> (https://firebase.google.com/)",
66
"main": "dist/index.node.cjs.js",
@@ -14,9 +14,11 @@
1414
"dist"
1515
],
1616
"scripts": {
17+
"lint": "eslint -c .eslintrc.json '**/*.ts' --ignore-path '../../.gitignore'",
18+
"lint:fix": "eslint --fix -c .eslintrc.json '**/*.ts' --ignore-path '../../.gitignore'",
1719
"build": "rollup -c",
1820
"dev": "rollup -c -w",
19-
"test": "run-p test:browser test:node",
21+
"test": "run-p lint test:browser test:node",
2022
"test:browser": "karma start --single-run",
2123
"test:browser:debug": "karma start --browsers Chrome --auto-watch",
2224
"test:node": "TS_NODE_CACHE=NO TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\"}' nyc --reporter lcovonly -- mocha test/**/*.test.* --opts ../../config/mocha.node.opts",
@@ -25,8 +27,8 @@
2527
"license": "Apache-2.0",
2628
"dependencies": {
2729
"@firebase/app-types": "0.4.0",
28-
"@firebase/util": "0.2.16",
29-
"@firebase/logger": "0.1.14",
30+
"@firebase/util": "0.2.20",
31+
"@firebase/logger": "0.1.17",
3032
"tslib": "1.9.3",
3133
"dom-storage": "2.1.0",
3234
"xmlhttprequest": "1.8.0"
@@ -58,7 +60,12 @@
5860
"ts-loader": "5.4.5",
5961
"ts-node": "8.1.0",
6062
"typescript": "3.4.5",
61-
"webpack": "4.30.0"
63+
"webpack": "4.30.0",
64+
"eslint": "5.16.0",
65+
"@typescript-eslint/parser": "1.10.2",
66+
"@typescript-eslint/eslint-plugin": "1.10.2",
67+
"@typescript-eslint/eslint-plugin-tslint": "1.10.2",
68+
"eslint-plugin-import": "2.17.3"
6269
},
6370
"repository": {
6471
"directory": "packages/app",

0 commit comments

Comments
 (0)