forked from dyoshikawa/rulesync
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheslint.config.js
More file actions
118 lines (110 loc) · 3.22 KB
/
eslint.config.js
File metadata and controls
118 lines (110 loc) · 3.22 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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
import eslint from "@eslint/js";
import importPlugin from "eslint-plugin-import";
import noTypeAssertion from "eslint-plugin-no-type-assertion";
import oxlint from "eslint-plugin-oxlint";
import strictDependencies from "eslint-plugin-strict-dependencies";
import zodImport from "eslint-plugin-zod-import";
import { defineConfig } from "eslint/config";
import tseslint from "typescript-eslint";
/**
* @type {import('eslint').Linter.Config}
*/
export default defineConfig([
{
ignores: [
"**/node_modules/**",
"**/dist/**",
"**/coverage/**",
"**/*.config.js",
"**/*.config.mjs",
"**/.lintstagedrc.js",
"**/eslint-plugin-*.js",
"**/tmp/**",
"**/docs/**",
],
},
{
files: ["src/**/*.ts", "scripts/**/*.ts"],
},
eslint.configs.recommended,
...tseslint.configs.recommended,
{
files: ["src/**/*.ts", "scripts/**/*.ts"],
languageOptions: {
parser: tseslint.parser,
parserOptions: {
project: "./tsconfig.json",
tsconfigRootDir: import.meta.dirname,
},
},
plugins: {
"strict-dependencies": strictDependencies,
import: importPlugin,
"no-type-assertion": noTypeAssertion,
"zod-import": zodImport,
},
rules: {
"@typescript-eslint/consistent-type-definitions": ["error", "type"],
"@typescript-eslint/no-floating-promises": "error",
"@typescript-eslint/ban-ts-comment": "off",
"import/no-restricted-paths": "error",
"no-type-assertion/no-type-assertion": "warn",
"strict-dependencies/strict-dependencies": [
"error",
[
{
module: "node:fs",
allowReferenceFrom: [
"src/utils/file.ts",
"src/utils/file.test.ts",
"src/lib/update.ts",
"src/lib/update.test.ts",
"scripts/**/*.ts",
],
allowSameModule: false,
},
{
module: "node:os",
allowReferenceFrom: [
"src/utils/file.ts",
"src/utils/file.test.ts",
"src/lib/update.ts",
],
allowSameModule: false,
},
{
module: "gray-matter",
allowReferenceFrom: ["src/utils/frontmatter.ts"],
allowSameModule: false,
},
],
],
"zod-import/zod-import": ["error", { variant: "zod-mini" }],
},
},
{
files: ["src/**/*.test.ts", "src/test-utils/**/*.ts", "scripts/**/*.test.ts"],
languageOptions: {
parser: tseslint.parser,
parserOptions: {
project: "./tsconfig.json",
tsconfigRootDir: import.meta.dirname,
},
},
rules: {
"no-empty": "off", // Allow empty test cases
"@typescript-eslint/no-explicit-any": "off", // Allow any in tests
"no-new": "off", // Allow new in tests
"no-type-assertion/no-type-assertion": "off", // Allow type assertions in tests
},
},
{
// Scripts are run locally by developers, not bundled for distribution
// Allow full zod (not zod/mini) for JSON Schema generation
files: ["scripts/**/*.ts"],
rules: {
"zod-import/zod-import": "off",
},
},
...oxlint.buildFromOxlintConfigFile("./.oxlintrc.json"),
]);