-
Notifications
You must be signed in to change notification settings - Fork 81
Expand file tree
/
Copy pathoxlint.config.ts
More file actions
83 lines (81 loc) · 2.67 KB
/
Copy pathoxlint.config.ts
File metadata and controls
83 lines (81 loc) · 2.67 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
import { defineConfig } from "oxlint";
import { TypeSpecCommonOxlintConfigs } from "./core/oxlint.config.ts";
const {
allFilesRules,
typescriptFileOverride,
jsxFilesOverride,
testFilesOverride,
typeAwareOverride,
} = TypeSpecCommonOxlintConfigs;
export default defineConfig({
plugins: ["typescript", "unicorn"],
categories: {
correctness: "off",
},
env: {
builtin: true,
},
ignorePatterns: [
"**/dist/**/*",
"**/.temp/**/*",
"**/temp/**/*",
"**/generated-defs/*",
"**/website/build/**/*",
"**/.astro/**/*",
// The TypeSpec core submodule has its own oxlint config - don't lint it from here.
"core/**/*",
// Ignore python virtual env
"**/venv/**/*",
// Ignore VSCode test web project
"**/.vscode-test-web/**/*",
// TODO: enable
"**/.scripts/**/*",
"eng/scripts/**/*",
"packages/*/scripts/**/*",
"**/typespec-ts/test/*/generated/**/*",
"**/src/modular/static/**/*",
],
rules: allFilesRules,
overrides: [
typescriptFileOverride,
jsxFilesOverride,
testFilesOverride,
{
// typespec-ts has static helper files which are copied verbatim into generated output and
// intentionally keep camelCase names to match the upstream Azure SDK sources.
files: ["**/packages/typespec-ts/static/**/*.ts", "**/packages/typespec-ts/static/**/*.mts"],
rules: {
"unicorn/filename-case": "off",
},
},
{
// Generated by `npm run gen:scenario-suites`. The file names encode the scenario
// directory tree with `__` separators (e.g. `models__nested-enum__not-flatten`), so
// they intentionally don't follow kebab-case.
files: ["**/packages/typespec-ts/test/modular-unit/scenario-suites/**/*.test.ts"],
rules: {
"unicorn/filename-case": "off",
},
},
{
// Astro route files (e.g. `[...path]/[llms_type].txt.ts`) use framework-required naming.
files: ["**/website/src/pages/**/*.ts", "**/website/src/components/**/*.ts"],
rules: {
"unicorn/filename-case": "off",
},
},
{
// typespec-ts tests use chai-style assertions (`expect(x).to.match(...)`), which oxlint's
// vitest plugin misreads as an unknown expect modifier.
files: ["**/packages/typespec-ts/**/*.test.ts"],
plugins: ["vitest"],
rules: {
"vitest/valid-expect": "off",
},
},
// Type-aware rules (no-floating-promises, no-deprecated) shared from core. They only run when
// oxlint is invoked with `--type-aware`. typespec-ts is excluded at the CLI level in the root
// `lint` script (its tsconfig is not tsgo-compatible and type-checking it OOMs).
typeAwareOverride,
],
});