Skip to content

Commit c804f70

Browse files
enable biome lint, try 2 (#576)
* config and --fix * unsafe fixes * rest of em
1 parent 0ac85af commit c804f70

69 files changed

Lines changed: 307 additions & 285 deletions

Some content is hidden

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

biome.json

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
{
22
"root": true,
33
"files": {
4-
"includes": [
5-
"src/**/*"
6-
]
4+
"includes": ["src/**/*"]
75
},
86
"formatter": {
97
"indentStyle": "space",
@@ -17,9 +15,32 @@
1715
"semicolons": "always",
1816
"trailingCommas": "all"
1917
},
20-
"globals": [
21-
"jestPuppeteer",
22-
"page"
23-
]
24-
}
18+
"globals": ["gtag", "jestPuppeteer", "page", "jest", "describe", "it", "beforeAll", "afterAll", "beforeEach", "afterEach", "expect", "test", "AppleID"]
19+
},
20+
"linter": {
21+
"rules": {
22+
"recommended": false,
23+
"correctness": "warn",
24+
"style": "off",
25+
"suspicious": "off",
26+
"security": "off",
27+
"performance": "off",
28+
"complexity": "off",
29+
"nursery": "off",
30+
"a11y": "off"
31+
}
32+
},
33+
"overrides": [
34+
{
35+
"includes": ["**/*.jsx", "**/*.tsx"],
36+
"linter": {
37+
"rules": {
38+
"correctness": {
39+
"noSolidDestructuredProps": "off",
40+
"noNestedComponentDefinitions": "off"
41+
}
42+
}
43+
}
44+
}
45+
]
2546
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"build:development": "env-cmd .env.development vite build --mode development",
77
"build:production": "vite build",
88
"serve": "vite preview",
9-
"lint": "printf 'biome lint currently disabled; fix required first\n'",
9+
"lint": "biome lint src",
1010
"format": "biome format --write src",
1111
"test": "jest",
1212
"test-coverage": "jest --coverage",

src/App.jsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { Component, lazy, Suspense } from 'react';
1+
import { Component, lazy, Suspense } from 'react';
22
import { Provider } from 'react-redux';
33
import { Route, Switch, Redirect } from 'react-router';
44
import { ConnectedRouter } from 'connected-react-router';
@@ -11,13 +11,13 @@ import { CircularProgress, Grid } from '@material-ui/core';
1111
import MyCommaAuth, { config as AuthConfig, storage as AuthStorage } from '@commaai/my-comma-auth';
1212
import { athena as Athena, auth as Auth, billing as Billing, request as Request } from '@commaai/api';
1313

14-
import { getZoom, getSegmentRange } from './url';
15-
import store, { history } from './store';
14+
import { getZoom, getSegmentRange } from './url.js';
15+
import store, { history } from './store.js';
1616

17-
import ErrorFallback from './components/ErrorFallback';
17+
import ErrorFallback from './components/ErrorFallback.jsx';
1818

19-
const Explorer = lazy(() => import('./components/explorer'));
20-
const AnonymousLanding = lazy(() => import('./components/anonymous'));
19+
const Explorer = lazy(() => import('./components/explorer.jsx'));
20+
const AnonymousLanding = lazy(() => import('./components/anonymous.jsx'));
2121

2222
class App extends Component {
2323
constructor(props) {

src/__puppeteer__/demo.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* eslint-env jest */
2-
import { configureViewport, goto } from './utils';
2+
import { configureViewport, goto } from './utils.js';
33

44
jest.setTimeout(30000);
55

src/__puppeteer__/drive.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* eslint-env jest */
2-
import { configureViewport, goto } from './utils';
2+
import { configureViewport, goto } from './utils.js';
33

44
const DEMO_DEVICE_URL = '/1d3dc3e03047b0c7';
55
const DEMO_ROUTE_URL = '/1d3dc3e03047b0c7/000000dd--455f14369d';

src/__puppeteer__/jest.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const jestConfig = require('../../jest.config');
1+
const jestConfig = require('../../jest.config.js');
22

33
delete jestConfig.testEnvironment;
44

src/__puppeteer__/routing.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* eslint-env jest */
2-
import { configureViewport, goto } from './utils';
2+
import { configureViewport, goto } from './utils.js';
33

44
jest.setTimeout(30000);
55

src/__tests__/App.test.jsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
/* eslint-env jest */
2-
import React from 'react';
1+
32
import { act, render } from '@testing-library/react';
4-
import App from '../App';
3+
import App from '../App.jsx';
54

65
describe('App', () => {
76
it('should not crash', () => {

src/actions/cached.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import * as Sentry from '@sentry/react';
22

3-
import * as Types from './types';
4-
import { reverseLookup } from '../utils/geocode';
5-
import { toBool } from '../utils';
3+
import * as Types from './types.js';
4+
import { reverseLookup } from '../utils/geocode.js';
5+
import { toBool } from '../utils/index.js';
66

77
const USE_LOCAL_COORDS_DATA = toBool(import.meta.env.VITE_APP_LOCAL_COORDS_DATA);
88
if (USE_LOCAL_COORDS_DATA) {
@@ -415,7 +415,7 @@ export function fetchCoord(route, coord, locationKey) {
415415
}
416416

417417
export function fetchLocations(route) {
418-
return (dispatch, getState) => {
418+
return (dispatch, _getState) => {
419419
dispatch(fetchCoord(route, [route.start_lng, route.start_lat], 'startLocation'));
420420
dispatch(fetchCoord(route, [route.end_lng, route.end_lat], 'endLocation'));
421421
};

src/actions/files.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import * as Sentry from '@sentry/react';
22
import { athena as Athena, devices as Devices, raw as Raw } from '@commaai/api';
33

4-
import { updateDeviceOnline, fetchDeviceNetworkStatus } from '.';
5-
import * as Types from './types';
6-
import { deviceOnCellular, getDeviceFromState, deviceVersionAtLeast, asyncSleep } from '../utils';
4+
import { updateDeviceOnline, fetchDeviceNetworkStatus } from './index.js';
5+
import * as Types from './types.js';
6+
import { deviceOnCellular, getDeviceFromState, deviceVersionAtLeast, asyncSleep } from '../utils/index.js';
77

88
export const FILE_NAMES = {
99
qcameras: ['qcamera.ts'],
@@ -54,7 +54,7 @@ async function athenaCall(dongleId, payload, sentryFingerprint, retryCount = 0)
5454
}
5555

5656
export function setRouteViewed(dongleId, route) {
57-
return async (dispatch, getState) => {
57+
return async (_dispatch, getState) => {
5858
const { device } = getState();
5959
if (!deviceVersionAtLeast(device, '0.9.6')) {
6060
return;

0 commit comments

Comments
 (0)