Skip to content

Commit 09b9957

Browse files
committed
Add ESLint configuration for TypeScript with custom rules and ignores
- Introduced a new ESLint configuration file (eslint.config.mjs) - Integrated recommended settings from ESLint and TypeScript ESLint - Configured specific rules to be turned off for flexibility in TypeScript code - Added ignores for common directories and file types to streamline linting process
1 parent 05a9dea commit 09b9957

File tree

8 files changed

+746
-280
lines changed

8 files changed

+746
-280
lines changed

docs/guide/ide-setup.md

Lines changed: 70 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,84 @@
11
# IDE Setup
22

3-
To get the best experience developing with ObjectQL, we recommend Visual Studio Code with the following configuration.
3+
To get the best experience developing with ObjectQL, we recommend **Visual Studio Code** equipped with the official toolset. This setup provides you with an "AI-like" development experience with intelligent auto-completion, real-time validation, and instant code generation.
44

5-
## Visual Studio Code
5+
## Visual Studio Code Extension
66

7-
We recommend using [VS Code](https://code.visualstudio.com/) as your primary editor.
7+
The **Standard ObjectStack AI Extension** transforms VS Code into a dedicated IDE for ObjectQL.
88

9-
### Recommended Extensions
9+
### Core Features
1010

11-
**1. ObjectQL Extension**
12-
The official ObjectQL extension provides intelligent IntelliSense, schema validation, and code snippets for all ObjectQL metadata files.
11+
1. **Metadata Generators**
12+
* Instantly scaffold new files using the Command Palette.
13+
* Supported templates: Object Definitions, Validation Rules, Permission Policies, App Configurations.
14+
* *Usage:* `Cmd+Shift+P` -> Type `ObjectQL: New...`
1315

14-
Features:
15-
- Auto-completion for `.object.yml`, `.validation.yml`, `.permission.yml`, `.app.yml` files
16-
- Real-time JSON Schema validation
17-
- 30+ code snippets for common patterns
18-
- Quick commands to create new ObjectQL files
19-
- File icons and syntax highlighting
20-
- TypeScript snippets for hooks and actions
16+
2. **Intelligent IntelliSense** 🧠
17+
* **Schema-Aware:** The extension understands the full ObjectQL protocol (`@objectql/types`).
18+
* **Auto-Completion:** Get suggestions for valid field types (`text`, `select`, `lookup`...), column options, and relationship targets.
19+
* **Validation:** Real-time red-line error reporting for missing required fields or invalid types according to the strict schema.
2120

22-
**Installation:**
23-
- From source: See `packages/tools/vscode-objectql/INSTALL.md`
24-
- Will be available on VS Code Marketplace soon
21+
3. **Smart Snippets** 📝
22+
* Type `oql-` to trigger a rich library of snippets.
23+
* **Objects:** `oql-field-lookup`, `oql-field-select`, `oql-index`
24+
* **Logic:** `oql-hook-beforeCreate`, `oql-action-record`
25+
* **Validation:** `oql-validation-business`
2526

26-
**2. YAML (Red Hat)**
27-
Essential for editing `*.object.yml` files. Provides syntax highlighting and validation.
28-
[Install Extension](https://marketplace.visualstudio.com/items?itemName=redhat.vscode-yaml)
27+
### Installation
2928

30-
**Note:** The ObjectQL extension depends on the Red Hat YAML extension and will prompt you to install it automatically.
29+
#### Option 1: VS Code Marketplace (Recommended)
30+
Search for **"ObjectQL"** in the Extensions view (`Cmd+Shift+X`) and install.
3131

32-
**3. JSON (Official)**
33-
For editing configuration files.
32+
#### Option 2: Install from VSIX (For Enterprise/Offline)
33+
If you are building from source or using a private build:
34+
1. Run `pnpm run package` in `packages/tools/vscode-objectql`.
35+
2. In VS Code, run command: **"Extensions: Install from VSIX..."**
36+
3. Select the generated `.vsix` file.
37+
38+
### Recommended Usage
39+
40+
To maximize productivity, we recommend the following workflow:
41+
42+
1. **Create an Object:**
43+
Run **"ObjectQL: New Object Definition"**. Enter a name (e.g., `invoice`).
44+
*Result:* `src/objects/invoice.object.yml` is created with standard fields definitions.
45+
46+
2. **Add Fields:**
47+
Open the file and use Snippets.
48+
* Type `oql-field-lookup` -> tab -> auto-fills a relationship field structure.
49+
* Type `oql-index` -> tab -> adds a database index.
50+
51+
3. **Validate:**
52+
The extension runs silently in the background. If you see red squiggles, hover over them to see exactly which protocol rule was violated (e.g., "Field 'required' must be a boolean").
53+
54+
---
55+
56+
## Other Essential Extensions
57+
58+
The ObjectQL extension automatically configures these for you, but they are worth noting:
59+
60+
* **[YAML (Red Hat)](https://marketplace.visualstudio.com/items?itemName=redhat.vscode-yaml):**
61+
* *Why:* The engine behind our schema validation.
62+
* *Config:* Our extension automatically injects ObjectQL schemas into this plugin's settings.
63+
64+
* **[ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) & [Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode):**
65+
* *Why:* For formatting your TypeScript Logic Hooks (`*.hook.ts`).
66+
67+
---
68+
69+
## Workspace Settings
70+
71+
For teams working on ObjectQL projects, we recommend committing a `.vscode/extensions.json` file to suggest these tools to all developers:
72+
73+
```json
74+
{
75+
"recommendations": [
76+
"objectstack-ai.vscode-objectql",
77+
"redhat.vscode-yaml",
78+
"dbaeumer.vscode-eslint"
79+
]
80+
}
81+
```
3482

3583
## Git Configuration
3684

@@ -44,11 +92,6 @@ bash scripts/setup-merge-driver.sh
4492

4593
This configures Git to automatically regenerate the lock file when conflicts occur by running `pnpm install`.
4694

47-
**What it does:**
48-
- Configures a custom merge driver named "pnpm-merge"
49-
- When `pnpm-lock.yaml` has merge conflicts, Git will automatically run `pnpm install` to regenerate it
50-
- This eliminates the need to manually resolve lock file conflicts
51-
5295
**Manual Configuration:**
5396

5497
If you prefer to configure manually, run:

eslint.config.mjs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import eslint from '@eslint/js';
2+
import tseslint from 'typescript-eslint';
3+
4+
export default tseslint.config(
5+
eslint.configs.recommended,
6+
...tseslint.configs.recommended,
7+
{
8+
ignores: ["**/dist/**", "**/node_modules/**", "**/*.js", "**/out/**", "**/generated/**", "**/*.d.ts", "**/templates/**"],
9+
},
10+
{
11+
rules: {
12+
"@typescript-eslint/no-explicit-any": "off",
13+
"@typescript-eslint/no-unused-vars": "off",
14+
"@typescript-eslint/no-require-imports": "off",
15+
"@typescript-eslint/no-empty-object-type": "off",
16+
"no-case-declarations": "off",
17+
"no-useless-escape": "off",
18+
"prefer-const": "off",
19+
"no-empty": "off",
20+
"no-undef": "off",
21+
"no-useless-catch": "off",
22+
"@typescript-eslint/no-this-alias": "off",
23+
"@typescript-eslint/no-unsafe-function-type": "off"
24+
}
25+
}
26+
);

package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,38 +6,38 @@
66
"build": "tsc -b && pnpm -r run build",
77
"clean": "rm -rf dist packages/*/dist packages/*/node_modules node_modules",
88
"test": "pnpm run check-versions && pnpm -r run test",
9-
"lint": "eslint packages --ext .ts,.tsx",
9+
"lint": "eslint packages",
1010
"format": "prettier --write \"packages/**/*.{ts,tsx,json,md}\"",
11-
1211
"cli:dev": "ts-node packages/tools/cli/src/index.ts",
13-
1412
"objectql": "node packages/tools/cli/dist/index.js",
1513
"objectql:tracker": "pnpm objectql dev -d examples/showcase/project-tracker/src",
1614
"objectql:erp": "pnpm objectql dev -d examples/showcase/enterprise-erp/src",
17-
1815
"check-versions": "node scripts/check-versions.js",
1916
"docs:dev": "vitepress dev docs",
2017
"docs:build": "vitepress build docs",
2118
"docs:preview": "vitepress preview docs",
22-
2319
"changeset": "changeset",
2420
"version": "changeset version",
2521
"release": "pnpm run build && changeset publish"
2622
},
2723
"devDependencies": {
2824
"@changesets/cli": "^2.29.8",
29-
"@objectql/example-project-tracker": "workspace:*",
3025
"@objectql/example-enterprise-erp": "workspace:*",
26+
"@objectql/example-project-tracker": "workspace:*",
3127
"@types/jest": "^30.0.0",
3228
"@types/js-yaml": "^4.0.9",
3329
"@types/node": "^20.10.0",
3430
"@types/supertest": "^6.0.3",
31+
"@typescript-eslint/eslint-plugin": "^8.53.0",
32+
"@typescript-eslint/parser": "^8.53.0",
3533
"concurrently": "^9.2.1",
34+
"eslint": "^9.39.2",
3635
"jest": "^30.2.0",
3736
"js-yaml": "^4.1.1",
3837
"supertest": "^7.2.2",
3938
"ts-jest": "^29.4.6",
4039
"typescript": "^5.3.0",
40+
"typescript-eslint": "^8.53.0",
4141
"vite": "^7.3.1",
4242
"vitepress": "^1.6.4"
4343
},

packages/tools/vscode-objectql/out/extension.d.ts.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)