Skip to content
Open
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
2 changes: 1 addition & 1 deletion .github/workflows/master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
- '.github/workflows/push.yml'
- '.github/workflows/master.yml'
- 'packages/**'
- '.eslintrc.js'
- '.oxlintrc.json'
- '.prettierrc'
- 'lerna.json'
- 'package.json'
Expand Down
15 changes: 11 additions & 4 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:
- 'rust/cubestore/**'
- 'rust/cubesql/**'
- 'rust/cube/**'
- '.eslintrc.js'
- '.oxlintrc.json'
- '.prettierrc'
- 'package.json'
- 'lerna.json'
Expand All @@ -30,7 +30,7 @@ on:
- 'rust/cubestore/**'
- 'rust/cubesql/**'
- 'rust/cube/**'
- '.eslintrc.js'
- '.oxlintrc.json'
- '.prettierrc'
- 'package.json'
- 'lerna.json'
Expand Down Expand Up @@ -198,8 +198,15 @@ jobs:
run: if [ "$(git status | grep nothing)x" = "x" ]; then echo "Non empty changeset after lerna bootstrap"; git status; exit 1; else echo "Nothing to commit. Proceeding"; fi;
- name: NPM lint
run: yarn lint:npm
- name: Lerna lint
run: yarn lerna run --concurrency 1 lint
- name: Oxlint
run: yarn lint:js
Comment thread
claude[bot] marked this conversation as resolved.
# cubejs-client-ngx has no tests and is not in the root tsconfig references, so
# oxlint is otherwise the only thing that ever looks at it. ng build needs
# @cubejs-client/core's declarations, hence the build:client-core first.
- name: Build client-ngx
run: |
yarn lerna run build:client-core
yarn workspace @cubejs-client/ngx build
- name: Cargo fmt cube workspace
run: |
cargo fmt --manifest-path rust/cube/Cargo.toml --all -- --check
Expand Down
38 changes: 38 additions & 0 deletions .oxlintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// The rule set lives in the @cubejs-backend/linter package so it stays a publishable,
// reviewable unit; this file adds the repo-wide ignores.
//
// `yarn lint` runs bare `oxlint`: passing -c/--config would disable nested config
// discovery, and packages/cubejs-client-{dx,react} rely on it.
{
"$schema": "./node_modules/oxlint/configuration_schema.json",
"extends": ["./packages/cubejs-linter/.oxlintrc.json"],
"env": {
"node": true,
"es6": true
},
"ignorePatterns": [
"dist/",
"lib/",
"build/",
"coverage/",
"gen/",
"**/*.d.ts",
"docs/",
"docs-mintlify/",
"examples/",
"rust/cubesql/",
// never covered by the ESLint setup this replaced
"packages/cubejs-testing/cypress/",
"packages/cubejs-testing/birdbox-fixtures/",
// a mongosh script, not Node: `db` is a shell global
"packages/cubejs-mongobi-driver/test/mongo-init.js",
// vendored Thrift output
"packages/cubejs-hive-driver/idl/",
// generated flatbuffers accessors
"packages/cubejs-cubestore-driver/codegen/",
// generated ANTLR parsers and SQL fixtures
"packages/cubejs-schema-compiler/src/parser/GenericSql*.ts",
"packages/cubejs-schema-compiler/src/parser/Python3*.ts",
"packages/cubejs-schema-compiler/test/unit/fixtures/"
]
}
5 changes: 4 additions & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,12 @@ yarn tsc:watch
# Clean build artifacts
yarn clean

# Run linting across all packages
# Run linting (oxlint over the whole repo) plus the package.json linter
yarn lint

# oxlint only
yarn lint:js

# Fix linting issues
yarn lint:fix

Expand Down
11 changes: 7 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -206,10 +206,13 @@ Following these guidelines is not a requirement, but you can save some time for

### Code

1. Run `yarn lint` in package before committing your changes.
If package doesn't have lint script, please add it and run.
There's one root `.eslintrc.js` file for all packages except client ones.
Client packages has it's own `.eslintrc.js` files.
1. Run `yarn lint` from the repository root before committing your changes.
Linting is a whole-repo operation now (oxlint covers every package in about a second),
so packages don't carry their own lint scripts.
The shared rule set lives in `packages/cubejs-linter/.oxlintrc.json` and is wired up by the
root `.oxlintrc.json`. A package that needs to diverge gets its own `.oxlintrc.json`
extending the root one - see `packages/cubejs-client-react` for an example.
Use `yarn lint:fix` to apply the fixable violations.
2. Run `yarn test` before committing if package has tests.
3. Please use [conventional commits name](https://www.conventionalcommits.org/) for your PR.
It'll be used to build change logs.
Expand Down
11 changes: 5 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,12 @@
"watch": "rollup -c -w",
"watch-local": "CUBEJS_API_URL=http://localhost:6020/cubejs-api/v1 rollup -c -w",
"lint:npm": "yarn npmPkgJsonLint packages/*/package.json rust/package.json",
"lint": "yarn lint:npm && yarn lerna run lint",
"lint:fix": "lerna run lint:fix",
"lint": "yarn lint:npm && yarn lint:js",
"lint:fix": "oxlint --fix",
"tsc": "tsc --build",
"tsc:watch": "tsc --build --watch",
"clean": "rimraf packages/*/{tsconfig.tsbuildinfo,lib,dist} packages/cubejs-testing/cypress/{tsconfig.tsbuildinfo,dist}"
"clean": "rimraf packages/*/{tsconfig.tsbuildinfo,lib,dist} packages/cubejs-testing/cypress/{tsconfig.tsbuildinfo,dist}",
"lint:js": "oxlint"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a regression (ESLint exited 0 on warnings too), but the consolidation makes a ratchet cheap and more valuable than before: with one root invocation and a known baseline of 123 warnings, oxlint --max-warnings 123 would keep the count from drifting upward, where previously each package's warnings were at least visible in its own job. Worth considering as the follow-up that pairs with re-enabling categories.correctness.

},
"author": "Cube Dev, Inc.",
"dependencies": {
Expand All @@ -46,14 +47,12 @@
"@rollup/plugin-commonjs": "^17.1.0",
"@rollup/plugin-json": "^6.1.0",
"@rollup/plugin-node-resolve": "^11.2.0",
"@typescript-eslint/eslint-plugin": "^8.46.0",
"@typescript-eslint/parser": "^8.46.0",
"eslint": "^8.57.1",
"@types/fs-extra": "^11.0.4",
"@types/jest": "^29",
"husky": "^5.0.4",
"is-ci": "^2.0.0",
"npm-package-json-lint": "^5.1.0",
"oxlint": "^1.82.0",
"postcss": "^8.2.8",
"prettier": "^2.0.5",
"rimraf": "^3.0.2",
Expand Down
1 change: 0 additions & 1 deletion packages/cubejs-api-gateway/.eslintignore

This file was deleted.

9 changes: 2 additions & 7 deletions packages/cubejs-api-gateway/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@
"unit": "CUBE_JS_NATIVE_API_GATEWAY_INTERNAL=true jest --coverage --forceExit dist/test",
"build": "rm -rf dist && npm run tsc",
"tsc": "tsc",
"watch": "tsc -w",
"lint": "eslint \"**/*.{ts,tsx}\"",
"lint:fix": "eslint --fix \"**/*.{ts,tsx}\""
"watch": "tsc -w"
},
"files": [
"README.md",
Expand Down Expand Up @@ -69,8 +67,5 @@
"supertest": "^4.0.2",
"typescript": "~6.0.3"
},
"license": "Apache-2.0",
"eslintConfig": {
"extends": "../cubejs-linter"
}
"license": "Apache-2.0"
}
12 changes: 6 additions & 6 deletions packages/cubejs-api-gateway/src/gateway.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,11 @@ import {
} from './helpers/transform-meta-extended';

type HandleErrorOptions = {
e: any,
res: ResponseResultFn,
context?: any,
query?: any,
requestStarted?: Date
e: any,
res: ResponseResultFn,
context?: any,
query?: any,
requestStarted?: Date
};

function userAsyncHandler(handler: (req: Request & { context: ExtendedRequestContext }, res: ExpressResponse) => Promise<void>) {
Expand Down Expand Up @@ -1525,7 +1525,7 @@ class ApiGateway {
disablePostProcessing,
context,
res,
}: {query: string, disablePostProcessing: boolean} & BaseRequest) {
}: { query: string, disablePostProcessing: boolean } & BaseRequest) {
try {
await this.assertApiScope('sql', context.securityContext);

Expand Down
10 changes: 5 additions & 5 deletions packages/cubejs-api-gateway/src/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,11 @@ export {
* Context rejection middleware.
*/
export type ContextRejectionMiddlewareFn =
(
req: Request,
res: ExpressResponse,
next: ExpressNextFunction,
) => void;
(
req: Request,
res: ExpressResponse,
next: ExpressNextFunction,
) => void;

type ContextAcceptorResult = { accepted: boolean; rejectMessage?: any };

Expand Down
4 changes: 2 additions & 2 deletions packages/cubejs-api-gateway/src/types/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ interface JWTOptions {
}

type CheckAuthResponse = {
'security_context'?: unknown,
security_context?: unknown,
};

/**
Expand Down Expand Up @@ -87,7 +87,7 @@ type CanSwitchSQLUserFn =
*/
type ContextToApiScopesFn =
(securityContext?: any, scopes?: ApiScopesTuple) =>
Promise<ApiScopesTuple>;
Promise<ApiScopesTuple>;

export {
CheckAuthInternalOptions,
Expand Down
6 changes: 3 additions & 3 deletions packages/cubejs-api-gateway/src/types/query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ type LogicalOrFilter = {
export type GroupingSetType = 'Rollup' | 'Cube';

type GroupingSet = {
groupType: GroupingSetType,
id: number,
subId?: null | number
groupType: GroupingSetType,
id: number,
subId?: null | number
};

export type EvalPatchMeasureFilterExpression = {
Expand Down
4 changes: 2 additions & 2 deletions packages/cubejs-api-gateway/src/types/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ type SqlApiRequest = BaseRequest & {
* Pre-aggregations selector object.
*/
type PreAggsSelector = {
contexts: {securityContext: any}[],
contexts: { securityContext: any }[],
timezones: string[],
dataSources?: string[],
cubes?: string[],
Expand All @@ -178,7 +178,7 @@ type PreAggsSelector = {
*/
type PreAggJob = {
request: string;
context: {securityContext: any};
context: { securityContext: any };
preagg: string;
table: string;
target: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ const MOCK_USERS_CUBE = {
plan: {
case: {
when: {
'0': {
0: {
// eslint-disable-next-line quotes
sql: () => `tenantEnterpriseFlag = true`,
label: 'Enterprise',
},
'1': {
1: {
// eslint-disable-next-line quotes
sql: () => `stripe_customer_id IS NOT NULL`,
label: 'Standard',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -396,15 +396,15 @@ describe('normalizeQuery: date-range filter resolution', () => {
timezone: 'UTC',
filters: [{ or: [
{ member: 'Orders.createdAt', operator: 'inDateRange', values: ['today'] },
]}],
] }],
}, false);

const la = normalizeQuery({
...baseQuery,
timezone: 'America/Los_Angeles',
filters: [{ or: [
{ member: 'Orders.createdAt', operator: 'inDateRange', values: ['today'] },
]}],
] }],
}, false);

expect(utc.filters[0].or[0].values[0]).toMatch(/^2026-06-25T/);
Expand Down
7 changes: 1 addition & 6 deletions packages/cubejs-athena-driver/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@
"test": "yarn integration",
"unit": "NODE_OPTIONS=--experimental-vm-modules jest --verbose dist/test/unit",
"integration": "npm run integration:athena",
"integration:athena": "NODE_OPTIONS=--experimental-vm-modules jest --verbose dist/test",
"lint": "eslint src/* --ext .ts",
"lint:fix": "eslint --fix src/* --ext .ts"
"integration:athena": "NODE_OPTIONS=--experimental-vm-modules jest --verbose dist/test"
},
"files": [
"dist/src",
Expand All @@ -45,9 +43,6 @@
"publishConfig": {
"access": "public"
},
"eslintConfig": {
"extends": "../cubejs-linter"
},
"jest": {
"testEnvironment": "node"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/cubejs-athena-driver/test/AthenaDriver.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ describe('AthenaDriver', () => {
// Aggressive pollTimeout (5s) so the test doesn't depend on the
// ambient CUBEJS_DB_QUERY_TIMEOUT. Constructor multiplies by 1000.
const cancelDriver = new AthenaDriver({ pollTimeout: 5 });
const athena = (cancelDriver as any).athena;
const { athena } = (cancelDriver as any);

const startOriginal = athena.startQueryExecution.bind(athena);
let queryExecutionId = '';
Expand Down
7 changes: 1 addition & 6 deletions packages/cubejs-backend-cloud/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@
"tsc": "tsc",
"watch": "tsc -w",
"test": "npm run unit",
"unit": "jest dist/test",
"lint": "eslint --debug src/* --ext .ts",
"lint:fix": "eslint --fix src/* --ext .ts"
"unit": "jest dist/test"
},
"files": [
"README.md",
Expand Down Expand Up @@ -49,8 +47,5 @@
},
"publishConfig": {
"access": "public"
},
"eslintConfig": {
"extends": "../cubejs-linter"
}
}
6 changes: 3 additions & 3 deletions packages/cubejs-backend-cloud/src/cloud.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ export class CubeCloudClient {

public uploadFile(
{ transaction, fileName, data, auth }:
{ transaction: any, fileName: string, data: ReadStream, auth?: AuthObject }
{ transaction: any, fileName: string, data: ReadStream, auth?: AuthObject }
) {
const formData = new FormData();
formData.append('transaction', JSON.stringify(transaction));
Expand All @@ -134,7 +134,7 @@ export class CubeCloudClient {
}

public finishUpload({ transaction, files, auth }:
{ transaction: any, files: any, auth?: AuthObject }) {
{ transaction: any, files: any, auth?: AuthObject }) {
return this.request({
url: (deploymentId: string) => `build/deploy/${deploymentId}/finish-upload${this.extendRequestByLivePreview()}`,
method: 'POST',
Expand All @@ -159,7 +159,7 @@ export class CubeCloudClient {
});
}

public getStatusDevMode({ auth, lastHash }: { auth?: AuthObject, lastHash?: string } = {}): Promise<{[key: string]: any}> {
public getStatusDevMode({ auth, lastHash }: { auth?: AuthObject, lastHash?: string } = {}): Promise<{ [key: string]: any }> {
const params = new URLSearchParams();
if (lastHash) {
params.append('lastHash', lastHash);
Expand Down
2 changes: 1 addition & 1 deletion packages/cubejs-backend-cloud/src/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export class DeployDirectory {

type DeployHooks = {
onStart?: (deploymentName: string, files: string[]) => void,
onUpdate?: (i: number, { file }: { file: string}) => void,
onUpdate?: (i: number, { file }: { file: string }) => void,
onUpload?: (files: string[], file: string) => void,
onFinally?: () => void
};
Expand Down
Loading
Loading