forked from microsoft/FluidFramework
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eslintrc.cjs
100 lines (92 loc) · 2.63 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
95
96
97
98
99
100
/*!
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
* Licensed under the MIT License.
*/
module.exports = {
parserOptions: {
ecmaVersion: "2022",
},
overrides: [
// Rules for code
{
files: ["src/**/*.{ts,tsx}", "test/**/*.{ts,tsx}"],
extends: [require.resolve("@fluidframework/eslint-config-fluid"), "prettier"],
parserOptions: {
project: ["./tsconfig.json"],
},
settings: {
react: {
version: "detect",
},
},
rules: {
// Required by Docusaurus for certain component exports.
"import/no-default-export": "off",
"import/no-unassigned-import": [
"error",
{
// Allow unassigned imports of css files.
allow: ["**/*.css"],
},
],
"import/no-internal-modules": [
"error",
{
allow: ["@docusaurus/**", "@site/**", "@theme/**"],
},
],
"import/no-unresolved": [
"error",
{
ignore: ["^@docusaurus/", "^@theme/", "^@theme-original/"],
},
],
// All dependencies in this package are dev
"import/no-extraneous-dependencies": [
"error",
{
devDependencies: true,
},
],
// Unfortunately, some of the import aliases supported by Docusaurus are not recognized by TSC / the eslint parser.
// So we have to disable some rules that enforce strong typing.
// Could be worth investigating if there's a way to make TSC aware of how the aliases are resolved, but until then,
// these rules are disabled.
"@typescript-eslint/no-unsafe-argument": "off",
"@typescript-eslint/no-unsafe-assignment": "off",
"@typescript-eslint/no-unsafe-call": "off",
"@typescript-eslint/no-unsafe-member-access": "off",
},
overrides: [
{
// Test file rule overrides
files: ["test/**/*"],
parserOptions: {
project: ["./test/tsconfig.json"],
},
},
{
// Config file tool overrides
files: ["docusaurus.config.ts", "playwright.config.ts", "infra/**/*"],
rules: {
"import/no-internal-modules": "off",
},
},
],
},
// Rules for .md/.mdx documents
{
files: ["**/*.md", "**/*.mdx"],
// TODO: extend prettier plugin, once prettier supports MDX v3.
// See <https://github.com/prettier/prettier/issues/12209>
extends: ["plugin:mdx/recommended"],
plugins: ["@docusaurus/eslint-plugin"],
rules: {
// See <https://docusaurus.io/docs/api/misc/@docusaurus/eslint-plugin/no-html-links>
"@docusaurus/no-html-links": "error",
// See <https://docusaurus.io/docs/api/misc/@docusaurus/eslint-plugin/prefer-docusaurus-heading>
"@docusaurus/prefer-docusaurus-heading": "error",
},
},
],
};