forked from firebase/firebase-functions
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheslint.config.js
More file actions
112 lines (108 loc) · 4.51 KB
/
eslint.config.js
File metadata and controls
112 lines (108 loc) · 4.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
const { FlatCompat } = require("@eslint/eslintrc");
const js = require("@eslint/js");
const path = require("path");
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all
});
module.exports = [
{
ignores: [
"lib/",
"dev/",
"node_modules/",
"coverage/",
"docgen/",
"v1/",
"v2/",
"logger/",
"dist/",
"spec/fixtures/",
"scripts/**/*.js",
"scripts/**/*.mjs",
"protos/",
".prettierrc.js",
"eslint.config.*",
"tsdown.config.*",
"scripts/bin-test/sources/esm-ext/index.mjs",
],
},
...compat.extends(
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking",
"plugin:jsdoc/recommended",
"google",
"prettier"
),
{
languageOptions: {
parser: require("@typescript-eslint/parser"),
parserOptions: {
project: "tsconfig.json",
tsconfigRootDir: __dirname,
},
ecmaVersion: 2022
},
plugins: {
"prettier": require("eslint-plugin-prettier"),
},
rules: {
"jsdoc/newline-after-description": "off",
"jsdoc/require-jsdoc": ["warn", { publicOnly: true }],
"jsdoc/check-tag-names": ["warn", { definedTags: ["alpha", "remarks", "typeParam", "packageDocumentation", "hidden"] }],
"no-restricted-globals": ["error", "name", "length"],
"prefer-arrow-callback": "error",
"prettier/prettier": "error",
"require-atomic-updates": "off", // This rule is so noisy and isn't useful: https://github.com/eslint/eslint/issues/11899
"require-jsdoc": "off", // This rule is deprecated and superseded by jsdoc/require-jsdoc.
"valid-jsdoc": "off", // This is deprecated but included in recommended configs.
"no-prototype-builtins": "warn",
"no-useless-escape": "warn",
"prefer-promise-reject-errors": "warn",
},
},
{
files: ["**/*.ts"],
rules: {
"jsdoc/require-param-type": "off",
"jsdoc/require-returns-type": "off",
// Google style guide allows us to omit trivial parameters and returns
"jsdoc/require-param": "off",
"jsdoc/require-returns": "off",
"@typescript-eslint/no-invalid-this": "error",
"@typescript-eslint/no-unused-vars": ["error", { argsIgnorePattern: "^_", caughtErrorsIgnorePattern: "^_" }], // Unused vars should not exist.
"@typescript-eslint/no-misused-promises": "warn", // rule does not work with async handlers for express.
"no-invalid-this": "off", // Turned off in favor of @typescript-eslint/no-invalid-this.
"no-unused-vars": "off", // Off in favor of @typescript-eslint/no-unused-vars.
eqeqeq: ["error", "always", { null: "ignore" }],
camelcase: ["error", { properties: "never" }], // snake_case allowed in properties iif to satisfy an external contract / style
// Ideally, all these warning should be error - let's fix them in the future.
"@typescript-eslint/no-unsafe-argument": "warn",
"@typescript-eslint/no-unsafe-assignment": "warn",
"@typescript-eslint/no-unsafe-call": "warn",
"@typescript-eslint/no-unsafe-member-access": "warn",
"@typescript-eslint/no-unsafe-return": "warn",
"@typescript-eslint/restrict-template-expressions": "warn",
"@typescript-eslint/no-explicit-any": "warn",
"@typescript-eslint/no-redundant-type-constituents": "warn",
"@typescript-eslint/no-base-to-string": "warn",
"@typescript-eslint/no-duplicate-type-constituents": "warn",
"@typescript-eslint/no-require-imports": "warn",
"@typescript-eslint/no-empty-object-type": "warn",
"@typescript-eslint/prefer-promise-reject-errors": "warn",
},
},
{
files: ["**/*.spec.ts", "**/*.spec.js", "spec/helper.ts", "scripts/bin-test/**/*.ts", "integration_test/**/*.ts"],
languageOptions: {
globals: {
mocha: true,
},
},
rules: {
"@typescript-eslint/no-unused-expressions": "off",
}
},
];