-
-
Notifications
You must be signed in to change notification settings - Fork 30
/
Copy patheslint.config.js
149 lines (144 loc) · 4.12 KB
/
eslint.config.js
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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
// @ts-check
import rsEslint from "@rebeccastevens/eslint-config";
// @ts-expect-error - Untyped.
import pluginEslint from "eslint-plugin-eslint-plugin";
import glob from "fast-glob";
import { tsImport } from "tsx/esm/api";
const local = await tsImport("./src/index.ts", import.meta.url).then((r) => r.default);
const configs = await rsEslint(
{
projectRoot: import.meta.dirname,
mode: "library",
typescript: {
unsafe: "off",
parserOptions: {
tsconfigRootDir: import.meta.dirname,
projectService: {
defaultProject: "./tsconfig.json",
allowDefaultProject: glob
.sync("./**/*.md", {
cwd: import.meta.dirname,
ignore: ["**/node_modules/**", "**/coverage/**"],
})
.map((file) => `${file}/*`),
maximumDefaultProjectFileMatchCount_THIS_WILL_SLOW_DOWN_LINTING: 1000,
},
},
},
formatters: true,
functional: {
functionalEnforcement: "lite",
overrides: {
"functional/no-throw-statements": "off",
},
},
jsonc: true,
markdown: {
enableTypeRequiredRules: true,
overrides: {
"functional/immutable-data": "off",
"functional/no-loop-statements": "off",
"functional/readonly-type": "off",
},
},
stylistic: true,
yaml: true,
},
{
plugins: {
eslint: pluginEslint,
},
rules: {
"import/extensions": "off",
// Some types say they have nonnullable properties, but they don't always.
"ts/no-unnecessary-condition": "off",
},
},
{
files: ["src/**/*"],
rules: {
"eslint/fixer-return": "error",
"eslint/meta-property-ordering": "error",
"eslint/no-deprecated-context-methods": "error",
"eslint/no-deprecated-report-api": "error",
"eslint/no-missing-message-ids": "error",
"eslint/no-missing-placeholders": "error",
"eslint/no-property-in-node": "error",
"eslint/no-unused-message-ids": "error",
"eslint/no-unused-placeholders": "error",
"eslint/no-useless-token-range": "error",
"eslint/prefer-message-ids": "error",
"eslint/prefer-object-rule": "error",
"eslint/prefer-placeholders": "error",
"eslint/prefer-replace-text": "error",
"eslint/report-message-format": "error",
"eslint/require-meta-docs-description": "error",
"eslint/require-meta-docs-url": "error",
"eslint/require-meta-fixable": "error",
"eslint/require-meta-has-suggestions": "error",
"eslint/require-meta-schema": "error",
"eslint/require-meta-type": "error",
"eslint/consistent-output": "error",
"eslint/no-identical-tests": "error",
"eslint/no-only-tests": "error",
"eslint/prefer-output-null": "error",
"eslint/test-case-property-ordering": "error",
"eslint/test-case-shorthand-strings": "error",
},
},
{
files: ["src/configs/**/*", "src/index.ts"],
rules: {
"ts/naming-convention": "off",
},
},
{
files: ["src/utils/type-guards.ts", "src/utils/node-types.ts"],
rules: {
"jsdoc/require-jsdoc": "off",
},
},
{
files: ["src/utils/conditional-imports/**/*"],
rules: {
"@typescript-eslint/no-var-requires": "off",
"functional/functional-parameters": "off",
"functional/no-try-statements": "off",
"import/no-extraneous-dependencies": [
"error",
{
peerDependencies: true,
},
],
"unicorn/prefer-module": "off",
},
},
{
files: ["tests/**/*"],
rules: {
"functional/no-return-void": "off",
"jsdoc/require-jsdoc": "off",
},
},
{
files: ["**/*.md", "**/*.md/*"],
rules: {
"format/prettier": [
"error",
{
embeddedLanguageFormatting: "off",
},
],
"max-classes-per-file": "off",
"ts/no-extraneous-class": "off",
},
},
);
// Use our local version of the plugin.
// eslint-disable-next-line functional/no-loop-statements
for (const config of configs) {
if (config?.plugins?.["functional"] !== undefined) {
config.plugins["functional"] = local;
}
}
export default configs;