-
Notifications
You must be signed in to change notification settings - Fork 535
/
.eslintrc.cjs
117 lines (102 loc) · 3.5 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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
/*!
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
* Licensed under the MIT License.
*/
module.exports = {
plugins: ["@typescript-eslint"],
extends: [
"oclif",
"oclif-typescript",
// eslint-disable-next-line node/no-extraneous-require
require.resolve("@fluidframework/eslint-config-fluid/recommended"),
"prettier",
],
parserOptions: {
project: ["./tsconfig.json", "./src/test/tsconfig.json"],
},
rules: {
// This rule is often triggered when using custom Flags, so disabling.
"object-shorthand": "off",
// This package is exclusively used in a Node.js context
"import/no-nodejs-modules": "off",
// oclif uses default exports for commands
"import/no-default-export": "off",
// Set to warn because we're not ready to enforce this rule for much of build-cli yet. It is enabled for new code.
"import/no-deprecated": "warn",
"import/no-internal-modules": [
"error",
{
allow: [
// fs-extra's ./esm export is needed for ESM support.
"fs-extra/esm",
// This package uses interfaces and types that are not exposed directly by npm-check-updates.
"npm-check-updates/build/src/types/**",
// We call oclif commands' run method directly in some cases, so these are all excluded.
"**/commands/**",
// These are all excluded because they're "submodules" used for organization.
// AB#8118 tracks removing the barrel files and importing directly from the submodules.
"**/library/index.js",
"**/library/githubRest.js",
"**/handlers/index.js",
"**/machines/index.js",
"**/repoPolicyCheck/index.js",
"**/azureDevops/**",
"**/codeCoverage/**",
"azure-devops-node-api/**",
],
},
],
// Superseded by Biome
"import/order": "off",
"jsdoc/multiline-blocks": [
"error",
{
noSingleLineBlocks: true,
},
],
// The default for this rule is 4, but 5 is better
"max-params": ["warn", 5],
// Too strict for our needs
"unicorn/filename-case": "off",
// In commands, destructuring is useful in some places but makes others less legible, so consistency isn't preferred.
"unicorn/consistent-destructuring": "off",
// Deprecated in 2018: https://eslint.org/blog/2018/11/jsdoc-end-of-life/
"valid-jsdoc": "off",
// Disable all perfectionist rules that are inherited from oclif's lint config.
"perfectionist/sort-array-includes": "off",
"perfectionist/sort-astro-attributes": "off",
"perfectionist/sort-classes": "off",
"perfectionist/sort-enums": "off",
"perfectionist/sort-exports": "off",
"perfectionist/sort-imports": "off",
"perfectionist/sort-interfaces": "off",
"perfectionist/sort-intersection-types": "off",
"perfectionist/sort-jsx-props": "off",
"perfectionist/sort-maps": "off",
"perfectionist/sort-named-exports": "off",
"perfectionist/sort-named-imports": "off",
"perfectionist/sort-object-types": "off",
"perfectionist/sort-objects": "off",
"perfectionist/sort-svelte-attributes": "off",
"perfectionist/sort-union-types": "off",
"perfectionist/sort-vue-attributes": "off",
},
overrides: [
{
// Rules only for test files
files: ["*.spec.ts", "src/test/**"],
rules: {
// Test files can import from anywhere
"import/no-internal-modules": "off",
},
},
{
// Rules only for files that are built on the build-infrastructure APIs.
files: ["src/**/vnext/**"],
rules: {
// Set to error since code using build-infrastructure APIs should not need to use any deprecated APIs.
"import/no-deprecated": "error",
},
},
],
};