forked from microsoft/FluidFramework
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.cjs
73 lines (67 loc) · 1.93 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
/*!
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
* Licensed under the MIT License.
*/
module.exports = {
plugins: ["react", "react-hooks"],
extends: [
require.resolve("@fluidframework/eslint-config-fluid/strict"),
"plugin:react/recommended",
"plugin:react-hooks/recommended",
"prettier",
],
parserOptions: {
project: ["./tsconfig.esm.json", "./src/test/tsconfig.esm.json"],
},
rules: {
// Disabled because they disagrees with React common patterns / best practices.
"@typescript-eslint/unbound-method": "off",
"unicorn/consistent-function-scoping": "off",
// Disabled because they conflict with Prettier.
"unicorn/no-nested-ternary": "off",
/**
* TODO: remove this override once dependency on base config has been updated
* (newer versions will have this rule disabled).
*/
"unicorn/no-useless-undefined": "off",
// Forbid new imports from legacy FluentUI react package.
// We have a couple of components that still use it, but new usages should not be added without due consideration.
"no-restricted-imports": ["error", "@fluentui/react"],
// Allow unassigned imports for testing-library/jest-dom
"import/no-unassigned-import": [
"error",
{
allow: ["@testing-library/jest-dom"],
},
],
},
overrides: [
{
// Overrides for jest test files
files: ["src/test/**"],
plugins: ["jest"],
extends: ["plugin:jest/recommended"],
rules: {
"import/no-nodejs-modules": "off",
"unicorn/prefer-module": "off",
"import/no-internal-modules": "off",
},
},
{
// Overrides for screenshot tests
files: ["src/test/screenshot/**"],
rules: {
// Default exports are used by "Storybook" modules to describe test scenarios
"import/no-default-export": "off",
// Fine for tests
"import/no-nodejs-modules": "off",
"import/no-extraneous-dependencies": "off",
},
},
],
settings: {
react: {
version: "detect",
},
},
};