Skip to content

Commit fd0e040

Browse files
authored
Ib migrate lint (#75)
* Fix linter * Fix lint issues * Fix CI * Revert changes to /reference/modules and /reference/sdks directories
1 parent e43e05f commit fd0e040

16 files changed

Lines changed: 1821 additions & 384 deletions

File tree

.github/workflows/validate.yml

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,8 @@ jobs:
2626
- name: Install dependencies
2727
run: pnpm install
2828

29-
- name: Lint Markdown
30-
uses: DavidAnson/markdownlint-cli2-action@510b996878fc0d1a46c8a04ec86b06dbfba09de7 # v15
31-
with:
32-
globs: |
33-
src/**/*.md
34-
!src/reference/sdks/**/*.md
35-
!src/reference/modules/**/*.md
36-
3729
- name: Lint JS
38-
run: pnpm lint:js
30+
run: pnpm lint-prod
3931

4032
build:
4133
runs-on: ubuntu-latest

.vitepress/components/Video.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script setup lang="ts">
2-
let props = defineProps<{ url: string }>();
2+
const props = defineProps<{ url: string }>();
33
</script>
44

55
<template>

eslint.config.mjs

Lines changed: 12 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,19 @@
1-
import typescriptEslint from "typescript-eslint";
2-
import vueEslintParser from "vue-eslint-parser";
3-
import pluginVue from "eslint-plugin-vue";
4-
import eslintjs from "@eslint/js";
5-
import eslintPluginPrettierRecommended from "eslint-plugin-prettier/recommended";
1+
import { defaultConfig } from '@caido/eslint-config';
2+
import markdownPlugin from '@eslint/markdown';
63

74
/** @type {import('eslint').Linter.Config } */
85
export default [
96
{
10-
ignores: [".vitepress/cache"],
7+
ignores: [".vitepress/cache", ".vitepress/dist", "./src/reference/sdks", "./src/reference/modules"],
118
},
12-
eslintjs.configs.recommended,
13-
...typescriptEslint.configs.recommendedTypeChecked,
14-
eslintPluginPrettierRecommended,
15-
...pluginVue.configs["flat/recommended"],
16-
{
9+
...(markdownPlugin.configs.recommended.map(config => ({
10+
...config,
1711
languageOptions: {
18-
parser: vueEslintParser,
19-
parserOptions: {
20-
parser: typescriptEslint.parser,
21-
project: "./tsconfig.json",
22-
extraFileExtensions: [".vue"],
23-
},
24-
},
25-
rules: {
26-
// Disabled
27-
"no-empty-pattern": "off",
28-
"@typescript-eslint/ban-ts-ignore": "off",
29-
"@typescript-eslint/explicit-function-return-type": "off",
30-
"@typescript-eslint/no-non-null-assertion": "off",
31-
"@typescript-eslint/no-unsafe-argument": "off",
32-
"@typescript-eslint/no-unsafe-member-access": "off",
33-
"@typescript-eslint/no-unsafe-call": "off",
34-
"@typescript-eslint/no-floating-promises": "off",
35-
"@typescript-eslint/no-unsafe-assignment": "off",
36-
"@typescript-eslint/restrict-template-expressions": "off",
37-
"@typescript-eslint/no-unsafe-return": "off",
38-
"@typescript-eslint/no-implied-eval": "off",
39-
"@typescript-eslint/unbound-method": "off",
40-
"@typescript-eslint/no-unused-expressions": "off",
41-
42-
// Disabled for performance issues
43-
// Reference: https://typescript-eslint.io/linting/troubleshooting/performance-troubleshooting/#eslint-plugin-import
44-
"import/namespace": "off",
45-
46-
// Disable no-unused-vars and uses noUnusedLocals: true in tsconfig.json instead
47-
// Reference: https://github.com/johnsoncodehk/volar/issues/47
48-
"@typescript-eslint/no-unused-vars": "off",
49-
50-
// Enabled
51-
"sort-imports": [
52-
"warn",
53-
{
54-
ignoreCase: true,
55-
ignoreDeclarationSort: true,
56-
},
57-
],
58-
59-
"@typescript-eslint/consistent-type-imports": "error",
60-
"@typescript-eslint/switch-exhaustiveness-check": "error",
61-
62-
"vue/singleline-html-element-content-newline": "off",
63-
"vue/multi-word-component-names": "off",
64-
},
65-
},
12+
frontmatter: "yaml"
13+
}
14+
}))),
15+
...(defaultConfig().map(config => ({
16+
...config,
17+
files: ["**/*.ts", "**/*.vue"],
18+
}))),
6619
];

package.json

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,11 @@
77
"dev": "vitepress dev",
88
"build": "vitepress build",
99
"preview": "vitepress preview",
10-
"lint": "pnpm lint:js && pnpm lint:md",
11-
"lint:js": "ESLINT_ENV=production eslint ./.vitepress -c ./eslint.config.mjs --max-warnings 0",
12-
"lint:md": "markdownlint-cli2 'src/**/*.md' '!src/reference/sdks/**/*.md' '!src/reference/modules/**/*.md'",
13-
"generate:sdk": "./scripts/sdk.sh"
10+
"lint": "bash ./scripts/lint.sh",
11+
"lint-prod": "bash ./scripts/lint-prod.sh",
12+
"generate:sdk": "./scripts/sdk.sh",
13+
"typecheck": "tsc --noEmit",
14+
"validate": "pnpm lint && pnpm typecheck && pnpm build"
1415
},
1516
"author": "Caido Labs Inc. <dev@caido.io>",
1617
"license": "CC-BY-4.0",
@@ -19,20 +20,16 @@
1920
"pnpm": ">=10"
2021
},
2122
"devDependencies": {
23+
"@caido/eslint-config": "0.6.0",
24+
"@eslint/markdown": "7.2.0",
2225
"@scalar/openapi-types": "0.3.2",
2326
"@types/node": "22.15.30",
2427
"confbox": "0.2.2",
25-
"eslint": "9.10.0",
26-
"eslint-config-prettier": "9.1.0",
27-
"eslint-plugin-prettier": "5.2.1",
28-
"eslint-plugin-vue": "9.27.0",
29-
"markdownlint-cli2": "0.14.0",
28+
"eslint": "9.28.0",
3029
"typescript": "5.6.2",
31-
"typescript-eslint": "8.5.0",
3230
"vitepress": "1.2.2",
3331
"vitepress-openapi": "0.0.3-alpha.83",
3432
"vitepress-plugin-llms": "1.5.1",
35-
"vue": "3.5.16",
36-
"vue-eslint-parser": "9.4.3"
33+
"vue": "3.5.16"
3734
}
3835
}

0 commit comments

Comments
 (0)