Skip to content

feat: #570 write eslint plugin to detect common mistakes#688

Merged
ascott18 merged 3 commits intomainfrom
ascott/570
Apr 8, 2026
Merged

feat: #570 write eslint plugin to detect common mistakes#688
ascott18 merged 3 commits intomainfrom
ascott/570

Conversation

@ascott18
Copy link
Copy Markdown
Collaborator

@ascott18 ascott18 commented Apr 8, 2026

Fixes #570

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

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-coalesce with 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.

Comment on lines +17 to +20
messages: {
useImmediate:
"Don't call `$load()` separately when using `{{autoMethod}}()`. Use `{{autoMethod}}({ immediate: true })` instead.",
},
Copy link

Copilot AI Apr 8, 2026

Choose a reason for hiding this comment

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

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.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@copilot apply changes based on this feedback

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.

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>
Copilot AI changed the title feat: #570 write eslint plugin to detect common mistakes fix: correct error message for $startAutoLoad in no-load-before-auto-load eslint rule Apr 8, 2026
@ascott18 ascott18 changed the title fix: correct error message for $startAutoLoad in no-load-before-auto-load eslint rule feat: #570 write eslint plugin to detect common mistakes Apr 8, 2026
@ascott18 ascott18 merged commit d0d0b51 into main Apr 8, 2026
15 checks passed
@ascott18 ascott18 deleted the ascott/570 branch April 8, 2026 18:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Write eslint plugin to detect common mistakes

3 participants