feat: #570 write eslint plugin to detect common mistakes#688
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a first-party eslint-plugin-coalesce package to help Coalesce Vue projects catch common foot-guns during linting, and wires it into the Vue starter template, playground, docs, and release pipelines.
Changes:
- Introduces
src/eslint-plugin-coalescewith three rules (no-load-before-auto-load,no-sort-in-computed,no-static-router-import) plus tests/build config. - Enables the plugin’s recommended flat config in the Vue template and the Vue3 playground.
- Adds documentation + CI build/publish support for the new npm package.
Reviewed changes
Copilot reviewed 22 out of 23 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| templates/Coalesce.Vue.Template/content/Coalesce.Starter.Vue.Web/package.json | Adds eslint-plugin-coalesce to the starter template devDependencies. |
| templates/Coalesce.Vue.Template/content/Coalesce.Starter.Vue.Web/eslint.config.mjs | Enables coalesce.configs.recommended in the template ESLint flat config. |
| src/eslint-plugin-coalesce/vitest.config.ts | Adds Vitest config for the new plugin package. |
| src/eslint-plugin-coalesce/tsconfig.json | Adds TS build config for compiling the plugin to lib/. |
| src/eslint-plugin-coalesce/test/rules/no-static-router-import.test.ts | Tests for preventing static router imports in .vue files. |
| src/eslint-plugin-coalesce/test/rules/no-sort-in-computed.test.ts | Tests for preventing in-place .sort() inside computed(). |
| src/eslint-plugin-coalesce/test/rules/no-load-before-auto-load.test.ts | Tests for preventing $load() alongside auto-load APIs in same scope. |
| src/eslint-plugin-coalesce/src/rules/no-static-router-import.ts | Implements router import detection rule. |
| src/eslint-plugin-coalesce/src/rules/no-sort-in-computed.ts | Implements computed+sort detection rule. |
| src/eslint-plugin-coalesce/src/rules/no-load-before-auto-load.ts | Implements $load() + auto-load co-usage detection rule. |
| src/eslint-plugin-coalesce/src/index.ts | Declares plugin entrypoint + configs.recommended. |
| src/eslint-plugin-coalesce/README.md | Adds package-level installation/usage docs and rule descriptions. |
| src/eslint-plugin-coalesce/package.json | Defines publishable npm package metadata/scripts/exports. |
| src/eslint-plugin-coalesce/.gitignore | Ignores build output (lib/). |
| playground/Coalesce.Web.Vue3/package.json | Adds the plugin as a dev dependency for the playground. |
| playground/Coalesce.Web.Vue3/eslint.config.mjs | Enables coalesce.configs.recommended in the playground ESLint config. |
| package-lock.json | Updates lockfile for workspace-linked eslint-plugin-coalesce. |
| docs/topics/eslint-plugin.md | Adds docs page describing plugin setup and rules. |
| docs/.vitepress/config.mts | Adds the new ESLint plugin doc page to the topics nav. |
| CHANGELOG.md | Notes addition of eslint-plugin-coalesce and included rules. |
| AGENTS.md | Adds build/test commands for the new package. |
| .github/workflows/part-publish.yml | Publishes eslint-plugin-coalesce tgz in npm publish workflow. |
| .github/workflows/part-build.yml | Builds/tests/packs the new plugin and includes it in template validation inputs. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| messages: { | ||
| useImmediate: | ||
| "Don't call `$load()` separately when using `{{autoMethod}}()`. Use `{{autoMethod}}({ immediate: true })` instead.", | ||
| }, |
There was a problem hiding this comment.
The autofix guidance in this message becomes incorrect when autoMethod is $startAutoLoad, since $startAutoLoad requires a Vue instance as its first argument ($startAutoLoad(vue, options)) and cannot be called as .$startAutoLoad({ immediate: true }). Consider using a separate message for $startAutoLoad (e.g., suggest passing { immediate: true } as the second argument) or always recommending $useAutoLoad({ immediate: true }) when applicable.
There was a problem hiding this comment.
@copilot apply changes based on this feedback
There was a problem hiding this comment.
Fixed in 7b49c05. Added a separate useImmediateStartAutoLoad message that correctly documents the two-argument signature: $startAutoLoad(vue, { immediate: true }), while the existing useImmediate message now targets only $useAutoLoad.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…oad rule Agent-Logs-Url: https://github.com/IntelliTect/Coalesce/sessions/9ea485df-019c-4582-b2db-7cd5966e40fa Co-authored-by: ascott18 <5017521+ascott18@users.noreply.github.com>
Fixes #570