diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c6884222d..f3a5c67cf 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,6 +28,9 @@ jobs: - name: 👷 Build Graphite web client run: cd client/web && npm run build + - name: 👕 Lint Graphite web formatting + run: cd client/web && npm run lint + - name: 🔬 Check Rust formatting run: cargo fmt --all -- --check diff --git a/client/web/.eslintrc.js b/client/web/.eslintrc.js index 3910dc0b1..141ac7dbb 100644 --- a/client/web/.eslintrc.js +++ b/client/web/.eslintrc.js @@ -11,6 +11,15 @@ module.exports = { parserOptions: { ecmaVersion: 2020, }, + settings: { + "import/resolver": { + // `node` must be the top property + node: {}, + webpack: { + config: require.resolve("@vue/cli-service/webpack.config.js"), + }, + }, + }, rules: { "no-console": process.env.NODE_ENV === "production" ? "warn" : "off", "no-debugger": process.env.NODE_ENV === "production" ? "warn" : "off", @@ -19,7 +28,8 @@ module.exports = { "linebreak-style": ["error", "unix"], indent: ["error", "tab"], quotes: ["error", "double"], - camelcase: ["warn", { ignoreImports: true, ignoreDestructuring: true }], + "@typescript-eslint/camelcase": "off", + camelcase: ["error", { ignoreImports: true, ignoreDestructuring: true }], "import/extensions": ["error", "ignorePackages", { js: "never", jsx: "never", ts: "never", tsx: "never", }], diff --git a/client/web/src/response-handler.ts b/client/web/src/response-handler.ts index 4db206491..74b68fd1c 100644 --- a/client/web/src/response-handler.ts +++ b/client/web/src/response-handler.ts @@ -24,8 +24,7 @@ export function handleResponse(responseType: ResponseType, responseData: string) if (callback) { callback(responseData); - } - else { + } else { console.error(`Received a Response of type "${responseType}" but no handler was registered for it from the client.`); } } diff --git a/client/web/src/types.d.ts b/client/web/src/types.d.ts index cd8d95055..45c066d38 100644 --- a/client/web/src/types.d.ts +++ b/client/web/src/types.d.ts @@ -1,11 +1,12 @@ declare module "*.vue" { - import type { DefineComponent } from "vue" - const component: DefineComponent<{}, {}, any>; + import type { DefineComponent, DefineComponent } from "vue"; + + const component: DefineComponent; export default component; } declare module "*.svg" { - import type { DefineComponent } from "vue"; + const component: DefineComponent; export default component; }