Skip to content

Commit 7991e8a

Browse files
authored
chore(lint): add new oxlint rules and auto-fix violations (CopilotKit#3742)
## Summary - Enable 9 new oxlint rules for better TypeScript/React code health - Enforce `import type` for type-only imports (`typescript/consistent-type-imports` + companions) - Enforce self-closing JSX, `.slice()` over `.substring()`, optional catch binding, and more - Bump `typescript/no-unnecessary-type-assertion` from warn to error - Auto-fix all 1,400+ existing violations across 55 files ## Test plan - [ ] CI passes (lint + format) - [ ] No runtime behavior changes (all fixes are syntactic)
2 parents 460f909 + 1bae2fc commit 7991e8a

52 files changed

Lines changed: 138 additions & 126 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/actions/changesets-action/src/run.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ const requireChangesetsCliPkgJson = (cwd: string) => {
215215
err.code === "MODULE_NOT_FOUND"
216216
) {
217217
throw new Error(
218-
`Have you forgotten to install \`@changesets/cli\` in "${cwd}"?`,
218+
`Have you forgotten to install \`@changesets/cli\` in "${cwd}"?`, { cause: err },
219219
);
220220
}
221221
throw err;

.oxlintrc.json

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,21 @@
1111
"import/no-unassigned-import": "off",
1212
"unicorn/no-array-sort": "off",
1313
"copilotkit/require-cpk-prefix": "off",
14-
"no-restricted-imports": "off"
14+
"no-restricted-imports": "off",
15+
16+
"typescript/consistent-type-imports": [
17+
"warn",
18+
{ "prefer": "type-imports", "fixStyle": "separate-type-imports" }
19+
],
20+
"typescript/no-import-type-side-effects": "warn",
21+
"import/consistent-type-specifier-style": ["warn", "prefer-top-level"],
22+
"typescript/no-unnecessary-type-assertion": "error",
23+
24+
"react/self-closing-comp": "warn",
25+
"unicorn/prefer-optional-catch-binding": "warn",
26+
"eslint/no-useless-computed-key": "warn",
27+
"unicorn/prefer-string-slice": "warn",
28+
"unicorn/prefer-array-flat-map": "warn"
1529
},
1630
"overrides": [
1731
{
@@ -42,6 +56,17 @@
4256
"rules": {
4357
"copilotkit/require-cpk-prefix": "off"
4458
}
59+
},
60+
{
61+
"files": [
62+
"packages/angular/**/*.ts",
63+
"packages/runtime/src/graphql/**/*.ts"
64+
],
65+
"rules": {
66+
"typescript/consistent-type-imports": "off",
67+
"typescript/no-import-type-side-effects": "off",
68+
"import/consistent-type-specifier-style": "off"
69+
}
4570
}
4671
],
4772
"ignorePatterns": [

examples/integrations/a2a-a2ui/app/theme.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -413,16 +413,16 @@ export const theme: Types.Theme = {
413413
video,
414414
},
415415
markdown: {
416-
p: [...Object.keys(pLight)],
417-
h1: [...Object.keys(h1Light)],
418-
h2: [...Object.keys(h2Light)],
419-
h3: [...Object.keys(h3Light)],
420-
h4: [...Object.keys(h4Light)],
421-
h5: [...Object.keys(h5Light)],
422-
ul: [...Object.keys(unorderedListLight)],
423-
ol: [...Object.keys(orderedListLight)],
424-
li: [...Object.keys(listItemLight)],
425-
a: [...Object.keys(aLight)],
416+
p: Object.keys(pLight),
417+
h1: Object.keys(h1Light),
418+
h2: Object.keys(h2Light),
419+
h3: Object.keys(h3Light),
420+
h4: Object.keys(h4Light),
421+
h5: Object.keys(h5Light),
422+
ul: Object.keys(unorderedListLight),
423+
ol: Object.keys(orderedListLight),
424+
li: Object.keys(listItemLight),
425+
a: Object.keys(aLight),
426426
strong: [],
427427
em: [],
428428
},

examples/integrations/agent-spec/src/app/theme.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -406,16 +406,16 @@ export const theme: Types.Theme = {
406406
video,
407407
},
408408
markdown: {
409-
p: [...Object.keys(pLight)],
410-
h1: [...Object.keys(h1Light)],
411-
h2: [...Object.keys(h2Light)],
412-
h3: [...Object.keys(h3Light)],
413-
h4: [...Object.keys(h4Light)],
414-
h5: [...Object.keys(h5Light)],
415-
ul: [...Object.keys(unorderedListLight)],
416-
ol: [...Object.keys(orderedListLight)],
417-
li: [...Object.keys(listItemLight)],
418-
a: [...Object.keys(aLight)],
409+
p: Object.keys(pLight),
410+
h1: Object.keys(h1Light),
411+
h2: Object.keys(h2Light),
412+
h3: Object.keys(h3Light),
413+
h4: Object.keys(h4Light),
414+
h5: Object.keys(h5Light),
415+
ul: Object.keys(unorderedListLight),
416+
ol: Object.keys(orderedListLight),
417+
li: Object.keys(listItemLight),
418+
a: Object.keys(aLight),
419419
strong: [],
420420
em: [],
421421
},

examples/integrations/agentcore/infra-cdk/lib/utils/config-manager.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ export class ConfigManager {
118118
} catch (error) {
119119
throw new Error(
120120
`Failed to parse configuration file ${configPath}: ${error}`,
121+
{ cause: error },
121122
);
122123
}
123124
}

examples/showcases/generative-ui-playground/src/app/theme.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -357,16 +357,16 @@ export const a2uiTheme: Types.Theme = {
357357
video: { "layout-el-cv": true },
358358
},
359359
markdown: {
360-
p: [...Object.keys(p)],
361-
h1: [...Object.keys(h1)],
362-
h2: [...Object.keys(h2)],
363-
h3: [...Object.keys(h3)],
364-
h4: [...Object.keys(h4)],
365-
h5: [...Object.keys(h5)],
366-
ul: [...Object.keys(unorderedList)],
367-
ol: [...Object.keys(orderedList)],
368-
li: [...Object.keys(listItem)],
369-
a: [...Object.keys(a)],
360+
p: Object.keys(p),
361+
h1: Object.keys(h1),
362+
h2: Object.keys(h2),
363+
h3: Object.keys(h3),
364+
h4: Object.keys(h4),
365+
h5: Object.keys(h5),
366+
ul: Object.keys(unorderedList),
367+
ol: Object.keys(orderedList),
368+
li: Object.keys(listItem),
369+
a: Object.keys(a),
370370
strong: [],
371371
em: [],
372372
},

examples/showcases/mcp-demo/src/components/Todo.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ export const TodoApp = () => {
7878
},
7979
],
8080
handler: ({ id, subtask }) => {
81-
debugger;
8281
addSubtask(id, subtask);
8382
},
8483
});

examples/showcases/mcp-demo/src/contexts/TodoContext.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,6 @@ export const TodoProvider: React.FC<{ children: ReactNode }> = ({
158158
};
159159

160160
const toggleSubtask = (parentId: number, subtaskId: number) => {
161-
debugger;
162161
setTodos(
163162
todos.map((todo) => {
164163
if (todo.id === parentId) {

examples/showcases/orca/frontend/components/developer-dashboard.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,6 @@ export function DeveloperDashboard() {
297297
<Select
298298
value={filterParams.status}
299299
onValueChange={(e) => {
300-
debugger;
301300
console.log(ref2.current);
302301

303302
setFilterParams({ ...filterParams, status: e });
@@ -337,7 +336,6 @@ export function DeveloperDashboard() {
337336
<Select
338337
value={filterParams.author}
339338
onValueChange={(e) => {
340-
debugger;
341339
setFilterParams({ ...filterParams, author: e });
342340
if (filterParams.status === "a") {
343341
setFilteredData(

examples/showcases/orca/frontend/components/pr-line-chart-data.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ export function PRLineChartData({ args }: any) {
8989

9090
const CustomPieTooltip = ({ active, payload }: any) => {
9191
if (active && payload && payload.length) {
92-
debugger;
9392
const { week, count } = payload[0].payload;
9493
return (
9594
<div className="bg-white p-2 rounded shadow text-black">

0 commit comments

Comments
 (0)