-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
eslint.config.mjs
119 lines (105 loc) Β· 2.96 KB
/
eslint.config.mjs
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
118
119
import reactEslintConfig from '@yarnpkg/eslint-config/react';
import eslintConfig from '@yarnpkg/eslint-config';
// eslint-disable-next-line arca/no-default-export
export default [
{
ignores: [
`**/coverage/**`,
`**/__snapshots__/**`,
`.yarn`,
`.pnp.cjs`,
`.pnp.loader.mjs`,
// Pre-compiled binaries
`packages/*/lib`,
`packages/*/bin`,
`packages/*/build`,
`packages/*/bundles`,
// Test fixtures
`packages/**/*fixtures*`,
// Generated files for website
`packages/docusaurus/.docusaurus`,
// Generated compressed worker
`packages/yarnpkg-core/sources/worker-zip/index.js`,
// Build output for libui
`packages/yarnpkg-libui/sources/**/*.js`,
`packages/yarnpkg-libui/sources/**/*.d.ts`,
// Pre-compiled from C sources
`packages/yarnpkg-libzip/sources/libzipAsync.js`,
`packages/yarnpkg-libzip/sources/libzipSync.js`,
// The C sources themselves
`packages/yarnpkg-libzip/artifacts`,
// Generated compressed hooks
`packages/yarnpkg-pnp/sources/hook.js`,
`packages/yarnpkg-pnp/sources/esm-loader/built-loader.js`,
// Minimize the diff with upstream
`packages/yarnpkg-pnp/sources/node`,
`packages/yarnpkg-pnp/sources/loader/node-options*`,
// Generated PEG.js grammars
`packages/yarnpkg-parsers/sources/grammars/*.js`,
// Patched fsevents
`packages/plugin-compat/extra/fsevents/fsevents-*.js`,
],
},
...eslintConfig,
...reactEslintConfig,
{
name: `berry/naming-convention`,
files: [`**/*.ts`, `**/*.cts`, `**/*.mts`, `**/*.tsx`],
ignores: [`packages/*/sources/{index,Plugin}.ts`],
rules: {
'@typescript-eslint/naming-convention': [`error`, {
selector: `typeLike`,
format: [`PascalCase`],
custom: {
regex: `^Hooks$`,
match: false,
},
}],
},
},
{
name: `berry/env/acceptance-tests`,
files: [`packages/acceptance-tests/pkg-tests-specs/**/*.test.{js,ts}`],
languageOptions: {
globals: {
makeTemporaryEnv: `readonly`,
makeTemporaryMonorepoEnv: `readonly`,
},
},
},
{
name: `berry/rules`,
rules: {
'no-restricted-properties': [2,
{
object: `semver`,
property: `validRange`,
message: `Use 'semverUtils.validRange' instead`,
},
{
object: `semver`,
property: `Range`,
message: `Use 'semverUtils.validRange' instead`,
},
],
'no-restricted-globals': [2,
{
name: `fetch`,
message: `Use 'httpUtils' instead`,
},
],
'no-restricted-imports': [
`error`,
{
patterns: [
{
group: [`url`, `node:url`],
importNames: [`URL`],
message: `URL is a global, no need to import it`,
},
],
},
],
},
},
];