-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy patheslint.config.js
More file actions
100 lines (98 loc) · 2.73 KB
/
Copy patheslint.config.js
File metadata and controls
100 lines (98 loc) · 2.73 KB
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
import eslint from "@eslint/js";
import globals from "globals";
import tseslint from "typescript-eslint";
const restrictedInternalImports = {
patterns: [
{
group: ["@spotpatch/*/src", "@spotpatch/*/src/*"],
message: "Import another package through its public entry point.",
},
],
};
export default tseslint.config(
{
ignores: [
"**/dist/**",
"**/coverage/**",
"**/node_modules/**",
"**/.astro/**",
"playgrounds/compat-astro*/.fixture/**",
"experiments/next-adapter/.artifacts/**",
"experiments/next-adapter/.work/**",
"experiments/contextual-ask-q1/.artifacts/**",
"experiments/contextual-ask-q1/.work/**",
"docs/**",
"playwright-report/**",
"test-results/**",
],
},
eslint.configs.recommended,
...tseslint.configs.strictTypeChecked,
...tseslint.configs.stylisticTypeChecked,
{
files: [
"*.ts",
"packages/**/*.{ts,tsx,cts,mts}",
"playgrounds/**/*.{ts,tsx,cts,mts}",
"experiments/contextual-ask-q1/**/*.{ts,tsx,cts,mts}",
"experiments/next-adapter/**/*.{ts,tsx,cts,mts}",
"tests/**/*.{ts,cts,mts}",
],
languageOptions: {
globals: {
...globals.browser,
...globals.node,
},
parserOptions: {
projectService: true,
tsconfigRootDir: import.meta.dirname,
},
},
rules: {
"@typescript-eslint/consistent-type-exports": "error",
"@typescript-eslint/consistent-type-imports": [
"error",
{ fixStyle: "inline-type-imports" },
],
"@typescript-eslint/no-explicit-any": "error",
"@typescript-eslint/no-floating-promises": "error",
"@typescript-eslint/no-misused-promises": "error",
"@typescript-eslint/no-non-null-assertion": "error",
"@typescript-eslint/no-unnecessary-type-assertion": "error",
"@typescript-eslint/only-throw-error": "error",
"no-restricted-imports": ["error", restrictedInternalImports],
},
},
{
files: ["packages/shared/**/*.{ts,tsx}"],
rules: {
"no-restricted-imports": [
"error",
{
patterns: [
...restrictedInternalImports.patterns,
{
group: ["@spotpatch/*"],
message: "The shared package cannot depend on another SpotPatch package.",
},
],
},
],
},
},
{
...tseslint.configs.disableTypeChecked,
files: ["**/*.{cjs,js,mjs}"],
languageOptions: {
...tseslint.configs.disableTypeChecked.languageOptions,
globals: {
...globals.browser,
...globals.node,
},
},
rules: {
...tseslint.configs.disableTypeChecked.rules,
"@typescript-eslint/no-require-imports": "off",
},
},
);