Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@
"editor.tabSize": 2,
"editor.insertSpaces": true,
"files.trimTrailingWhitespace": true,
"eslint.useFlatConfig": false,
"python-env.workspaceSearchPaths": [ "app/backend/.venv" ],
"python.testing.cwd": "app/backend/src/tests",
"python.testing.unittestEnabled": false,
Expand Down
1 change: 0 additions & 1 deletion app/web/.eslintignore

This file was deleted.

74 changes: 0 additions & 74 deletions app/web/.eslintrc.json

This file was deleted.

102 changes: 102 additions & 0 deletions app/web/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
import { FlatCompat } from "@eslint/eslintrc";
import js from "@eslint/js";
import tsParser from "@typescript-eslint/parser";
import prettier from "eslint-config-prettier/flat";
import jsonc from "eslint-plugin-jsonc";
import simpleImportSort from "eslint-plugin-simple-import-sort";
import unusedImports from "eslint-plugin-unused-imports";

const compat = new FlatCompat({
baseDirectory: import.meta.dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all,
});

const config = [
{
ignores: [
"node_modules/**",
".next/**",
"out/**",
Comment thread
kevinortiz43 marked this conversation as resolved.
"build/**",
"coverage/**",
"package-lock.json",
"next-env.d.ts",
"proto/**",
],
},
// eslint 9 flipped this default to "warn";
{
linterOptions: { reportUnusedDisableDirectives: "warn" },
},

// both legacy extends must go through the same FlatCompat instance so the
// @typescript-eslint plugin resolves to one module object ("Cannot redefine
// plugin" otherwise)

// Come back to this after we upgrade next.js https://github.com/Couchers-org/couchers/issues/9280
...compat.extends(
"plugin:@typescript-eslint/recommended",
"next/core-web-vitals",
),
Comment thread
kevinortiz43 marked this conversation as resolved.
prettier,
{
plugins: {
"simple-import-sort": simpleImportSort,
"unused-imports": unusedImports,
},
rules: {
// ~~~ settings for simple import sort plugin ~~~
"simple-import-sort/imports": "warn",
"simple-import-sort/exports": "warn",
"sort-imports": "off",
"import/order": "off",
"import/first": "warn",
"import/newline-after-import": "warn",
"import/no-duplicates": "warn",

// ~~~ setings for unused imports plugin ~~~
"unused-imports/no-unused-imports": "warn",

// ~~~ custom couchers settings ~~~
//allow theme to be unused in makeStyles
"@typescript-eslint/no-unused-vars": "off",
"no-unused-vars": "off",
"unused-imports/no-unused-vars": [
"warn",
{
argsIgnorePattern: "theme",
varsIgnorePattern: "classes|useStyles",
},
],
//good in theory, but ts isn't perfect and library types can be wrong
"@typescript-eslint/ban-ts-comment": "off",
//better avoided but useful for gRPC
"@typescript-eslint/no-non-null-assertion": "off",
//used in testing
"@typescript-eslint/no-empty-function": "off",
//not using this right now
"@next/next/no-img-element": "off",

"react/no-unescaped-entities": "off",
// Prefer inferred types so that the code is as close to JS as possible
"@typescript-eslint/explicit-module-boundary-types": "off",
},
},
{
files: ["**/*.ts", "**/*.tsx", "**/*.js", "**/*.jsx"],
languageOptions: { parser: tsParser },
},
// the jsonc preset is pinned to **/*.json: unpinned it would also grab
// .json5/.jsonc, and without files globs `eslint .` wouldn't lint json at all
...jsonc.configs["flat/recommended-with-json"].map((config) => ({
...config,
files: ["**/*.json"],
})),
{
files: ["**/*.json"],
rules: { "jsonc/no-comments": "off" },
},
];

export default config;
1 change: 0 additions & 1 deletion app/web/features/dashboard/DashboardMyPublicTrips.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ export default function DashboardMyPublicTrips() {

useEffect(() => {
updateScrollState();
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [activeTrips.length, isLoading]);

const scroll = (dir: 1 | -1) => {
Expand Down
4 changes: 2 additions & 2 deletions app/web/features/profile/hooks/useUpdateUserProfile.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ describe("updateUserProfile action", () => {
pronouns,
thingsILike,
} = defaultUser;
/* eslint-disable sort-keys */

const newUserProfileData: UpdateUserProfileData = {
// Unchanged data
aboutMe,
Expand Down Expand Up @@ -82,7 +82,7 @@ describe("updateUserProfile action", () => {
],
},
};
/* eslint-enable sort-keys */

updateProfileMock.mockResolvedValue(new Empty());

const { result } = renderHook(() => useUpdateUserProfile(), {
Expand Down
1 change: 0 additions & 1 deletion app/web/features/publicTrips/PublicTripsOverview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ export default function PublicTripsOverview({

useEffect(() => {
updateScrollState();
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [trips.length, isLoading]);

const scroll = (dir: 1 | -1) => {
Expand Down
1 change: 0 additions & 1 deletion app/web/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/no-empty-interface */
declare module "@mui/private-theming" {
import type { Theme } from "@mui/material/styles";

Expand Down
10 changes: 6 additions & 4 deletions app/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@
"injectsourcemaps": "sentry-cli sourcemaps inject .next/",
"dev": "next dev",
"start": "yarn dev",
"format": "prettier --write '**/*.{ts,tsx,js,jsx,json,css}' && eslint . --ext .ts,.tsx,.js,.jsx,.json --fix",
"format": "prettier --write '**/*.{ts,tsx,js,jsx,json,css}' && eslint . --fix",
"format:check": "prettier --check '**/*.{ts,tsx,js,jsx,json,css}'",
"create-translation-files": "node scripts/create-translation-files.js",
"delete-translation-files": "node scripts/delete-translation-files.js",
"jest": "jest --modulePaths=.",
"lint": "eslint . --ext .ts,.tsx,.js,.jsx,.json",
"lint:fix": "eslint . --ext .ts,.tsx,.js,.jsx,.json --fix",
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"serve": "next start",
"test-ci": "tsc && cross-env NEXT_PUBLIC_API_BASE_URL=http://localhost:8888 CI=true TZ=UTC jest --runInBand --coverageReporters=\"cobertura\" --coverageReporters=\"lcov\" --reporters=\"default\" --reporters=\"jest-junit\" --coverage",
"test": "cross-env NEXT_PUBLIC_API_BASE_URL=http://localhost:8888 TZ=UTC jest",
Expand Down Expand Up @@ -75,6 +75,8 @@
},
"devDependencies": {
"@babel/core": "^7.29.7",
"@eslint/eslintrc": "3.3.6",
"@eslint/js": "9.39.5",
"@next/bundle-analyzer": "^16.2.10",
"@testing-library/dom": "^10.4.0",
"@testing-library/jest-dom": "^6.9.1",
Expand All @@ -95,7 +97,7 @@
"babel-jest": "^30.4.1",
"cross-env": "^10.1.0",
"css-mediaquery": "^0.1.2",
"eslint": "^8.56.0",
"eslint": "^9.39.4",
"eslint-config-next": "^15.5.7",
"eslint-config-prettier": "^10.1.8",
"eslint-plugin-jsonc": "^2.21.1",
Expand Down
4 changes: 2 additions & 2 deletions app/web/service/client.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ describe("AuthInterceptor", () => {
it("calls a set UnauthenticatedErrorHandler on unauthenticated error", async () => {
const errorHandler = jest.fn();
const invokerMock = jest.fn(() => {
throw { code: StatusCode.UNAUTHENTICATED, message: "Unauthenticated" }; //eslint-disable-line no-throw-literal
throw { code: StatusCode.UNAUTHENTICATED, message: "Unauthenticated" };
});
const interceptor = new AuthInterceptor();
setUnauthenticatedErrorHandler(errorHandler);
Expand All @@ -24,7 +24,7 @@ describe("AuthInterceptor", () => {
it("throws on an error that isn't an unauthenticated error", async () => {
const errorHandler = jest.fn();
const invokerMock = jest.fn(() => {
throw { code: StatusCode.NOT_FOUND, message: "Not found" }; //eslint-disable-line no-throw-literal
throw { code: StatusCode.NOT_FOUND, message: "Not found" };
});
const interceptor = new AuthInterceptor();
setUnauthenticatedErrorHandler(errorHandler);
Expand Down
4 changes: 2 additions & 2 deletions app/web/test/setupTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,10 @@ global.ResizeObserver = class ResizeObserver {
};

declare global {
/* eslint-disable no-var */ // Disable the rule for this block
// Disable the rule for this block
var defaultUser: typeof user;
var testKit: ReturnType<typeof sentryTestkit>["testkit"];
/* eslint-enable no-var */ // Re-enable the rule
// Re-enable the rule
}

function createWebStorageMock() {
Expand Down
Loading
Loading