Skip to content
Merged
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 CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ All notable changes to `@bquery/eslint-plugin` are documented here. The format f

### Added

- Initial release: five bQuery-specific rules and a recommended flat config ([bQuery/bQuery#228](https://github.com/bQuery/bQuery/issues/228), developed in [bQuery/bQuery#278](https://github.com/bQuery/bQuery/pull/278)): `no-top-level-dollar`, `prefer-scoped-reactivity`, `no-dynamic-trusted-html`, `no-value-in-untracked` (reports only identifiers initialised from a bQuery signal factory, so DOM `input.value` and other non-signal `.value` reads are not flagged) and `prefer-subpath-imports` (autofixes root imports to module subpaths from an export map generated from the published `@bquery/bquery` declaration files).
- Initial release: five bQuery-specific rules and a recommended flat config ([bQuery/bQuery#228](https://github.com/bQuery/bQuery/issues/228), developed in [bQuery/bQuery#278](https://github.com/bQuery/bQuery/pull/278)): `no-top-level-dollar`, `prefer-scoped-reactivity`, `no-dynamic-trusted-html`, `no-value-in-untracked` (reports only identifiers initialised from a bQuery signal factory, so DOM `input.value` and other non-signal `.value` reads are not flagged) and `prefer-subpath-imports` (autofixes root imports to module subpaths from an export map generated from the published `@bquery/bquery` declaration files; built against bQuery 1.18.0, so 1.18 root exports such as `createSchemaForm` and `useSchemaForm` (`forms`), `validate` (`server`) and `EmptyStoreRecord` (`store`) are fixed too).
4 changes: 2 additions & 2 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"eslint": ">=9"
},
"devDependencies": {
"@bquery/bquery": "^1.17.2",
"@bquery/bquery": "^1.18.0",
"@typescript-eslint/eslint-plugin": "^8.72.0",
"@typescript-eslint/parser": "^8.72.0",
"bun-types": "^1.4.3",
Expand Down
11 changes: 11 additions & 0 deletions src/export-map.json
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@
"ElementBoundingRect": "media",
"ElementBounds": "motion",
"ElementSize": "media",
"EmptyStoreRecord": "store",
"EventSourceStatus": "reactive",
"FetchInput": "reactive",
"FieldArrayConfig": "forms",
Expand Down Expand Up @@ -351,6 +352,9 @@
"SanitizedHtml": "security",
"SanitizerBackend": "security",
"SchemaEntry": "forms",
"SchemaFormConfig": "forms",
"SchemaFormValues": "forms",
"SchemaIssue": "forms",
"ScrollAnimateCleanup": "motion",
"ScrollAnimateOptions": "motion",
"ScrollProgressCleanup": "motion",
Expand Down Expand Up @@ -414,6 +418,7 @@
"StaggerFunction": "motion",
"StaggerOptions": "motion",
"StandaloneResumableBoundary": "ssr",
"StandardSchemaV1": "forms",
"StartTransitionOptions": "concurrency",
"StateFactory": "store",
"StepPosition": "motion",
Expand Down Expand Up @@ -506,6 +511,9 @@
"UseWebSocketChannelReturn": "reactive",
"UseWebSocketOptions": "reactive",
"UseWebSocketReturn": "reactive",
"ValidateMiddleware": "server",
"ValidateOptions": "server",
"ValidateSource": "server",
"ValidationResult": "forms",
"Validator": "forms",
"VerifyHydrationOptions": "ssr",
Expand Down Expand Up @@ -619,6 +627,7 @@
"createSSRHandler": "ssr",
"createSSRMetrics": "ssr",
"createSSRRouterContext": "ssr",
"createSchemaForm": "forms",
"createServer": "server",
"createSharedBuffer": "concurrency",
"createStore": "store",
Expand Down Expand Up @@ -1117,6 +1126,7 @@
"useResourceList": "reactive",
"useRoute": "router",
"useRouteData": "router",
"useSchemaForm": "forms",
"useScroll": "media",
"useShare": "media",
"useShareSupported": "media",
Expand All @@ -1134,6 +1144,7 @@
"utils": "core",
"uuid": "core",
"validDate": "forms",
"validate": "server",
"verifyHydration": "ssr",
"waitFor": "testing",
"watch": "reactive",
Expand Down
2 changes: 1 addition & 1 deletion src/rules/no-value-in-untracked.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const SOURCES = bquerySources('reactive');
* bQuery factories whose result has a tracked `.value` and an untracked
* `.peek()` (they return `Signal`, `Computed`, `LinkedSignal` or
* `ReadonlySignal`), grouped by the module that exports them. Checked against
* the published `@bquery/bquery` 1.17 declaration files.
* the published `@bquery/bquery` 1.18 declaration files.
*
* @type {Array<[Set<string>, Set<string>]>}
*/
Expand Down
5 changes: 5 additions & 0 deletions test/export-map.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ describe('export-map.json', () => {
sanitize: 'security',
trusted: 'security',
prefersReducedMotion: 'motion',
// Added in bQuery 1.18.
createSchemaForm: 'forms',
StandardSchemaV1: 'forms',
validate: 'server',
EmptyStoreRecord: 'store',
});
});
});
20 changes: 20 additions & 0 deletions test/prefer-subpath-imports.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,26 @@ ruleTester.run('prefer-subpath-imports', rule, {
output: `import { sanitize, trusted } from '@bquery/bquery/security';`,
errors: [{ messageId: 'preferSubpath' }],
},
{
// Standard Schema forms, added to the root entry in bQuery 1.18.
code: `import { createSchemaForm, useSchemaForm, type SchemaFormValues } from '@bquery/bquery';`,
output: `import { createSchemaForm, useSchemaForm, type SchemaFormValues } from '@bquery/bquery/forms';`,
errors: [{ messageId: 'preferSubpath', data: { source: '@bquery/bquery/forms' } }],
},
{
// One Standard Schema for client and server (bQuery 1.18).
code: `import { createSchemaForm, validate, type StandardSchemaV1 } from '@bquery/bquery';`,
output: [
`import { createSchemaForm, type StandardSchemaV1 } from '@bquery/bquery/forms';`,
`import { validate } from '@bquery/bquery/server';`,
].join('\n'),
errors: [
{
messageId: 'preferSubpaths',
data: { sources: "'@bquery/bquery/forms', '@bquery/bquery/server'" },
},
],
},
{
// Comments survive a single-subpath fix.
code: `import {
Expand Down
Loading