-
Notifications
You must be signed in to change notification settings - Fork 543
/
Copy path.eslintrc.cjs
94 lines (85 loc) · 3.19 KB
/
.eslintrc.cjs
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
/*!
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
* Licensed under the MIT License.
*/
module.exports = {
extends: [require.resolve("@fluidframework/eslint-config-fluid"), "prettier"],
parserOptions: {
project: ["./tsconfig.json", "./src/test/tsconfig.json"],
},
rules: {
"@typescript-eslint/strict-boolean-expressions": "off",
// TODO: fix violations and remove overrides
"@fluid-internal/fluid/no-unchecked-record-access": "warn",
"require-atomic-updates": "warn",
"unicorn/no-array-reduce": "warn",
// False positives on non-array `push` methods.
// TODO:AB#28686: remove this override once this rule has been disabled in the root config.
"unicorn/no-array-push-push": "off",
// #region TODO:AB#3027: remove overrides and upgrade config to `recommended`
"@typescript-eslint/explicit-function-return-type": [
"error",
{
allowExpressions: true,
allowTypedFunctionExpressions: true,
allowHigherOrderFunctions: true,
allowDirectConstAssertionInArrowFunctions: true,
allowConciseArrowFunctionExpressionsStartingWithVoid: false,
},
],
"@typescript-eslint/explicit-module-boundary-types": "error",
"@typescript-eslint/no-explicit-any": [
"error",
{
/**
* For certain cases, like rest parameters, any is required to allow arbitrary argument types.
* @see https://typescript-eslint.io/rules/no-explicit-any/#ignorerestargs
*/
ignoreRestArgs: true,
},
],
"@typescript-eslint/no-unsafe-argument": "error",
"@typescript-eslint/no-unsafe-assignment": "error",
"@typescript-eslint/no-unsafe-call": "error",
"@typescript-eslint/no-unsafe-member-access": "error",
"@typescript-eslint/no-unsafe-return": "error",
"jsdoc/multiline-blocks": ["error", { noSingleLineBlocks: true }],
"jsdoc/require-description": ["error", { checkConstructors: false }],
"unicorn/catch-error-name": "error",
"unicorn/consistent-destructuring": "error",
"unicorn/consistent-function-scoping": "error",
"unicorn/error-message": "error",
"unicorn/explicit-length-check": "error",
"unicorn/new-for-builtins": "error",
"unicorn/no-array-callback-reference": "error",
"unicorn/no-array-for-each": "error",
"unicorn/no-lonely-if": "error",
"unicorn/no-negated-condition": "error",
"unicorn/no-new-array": "error",
"unicorn/no-null": "error",
"unicorn/no-zero-fractions": "error",
"unicorn/prefer-includes": "error",
"unicorn/prefer-node-protocol": "error",
"unicorn/prefer-number-properties": "error",
"unicorn/prefer-optional-catch-binding": "error",
"unicorn/prefer-spread": "error",
"unicorn/prefer-string-slice": "error",
"unicorn/switch-case-braces": "error",
"unicorn/throw-new-error": "error",
// #endregion
},
overrides: [
{
// Rules only for test files
files: ["*.spec.ts", "src/test/**"],
rules: {
// TODO: remove these overrides and fix violations
"@typescript-eslint/explicit-function-return-type": "warn",
"unicorn/consistent-function-scoping": "warn",
"unicorn/error-message": "warn",
// Test files are run in node only so additional node libraries can be used.
"import/no-nodejs-modules": ["error", { allow: ["node:assert", "node:crypto"] }],
},
},
],
};