@geoql/eslint-plugin-vue-doctor 1.1.0 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["VUE_RULES"],"sources":["../src/to-eslint-rule.ts","../src/plugin.ts"],"sourcesContent":["import type { Rule } from 'eslint';\nimport type { CoreRule, RuleContext, AstNode } from '@geoql/doctor-rule-core';\n\ntype ESLintSeverity = 'error' | 'warn';\n\nexport interface ESLintRule extends Rule.RuleModule<ESLintSeverity> {\n readonly id: string;\n}\n\nexport function toESLintRule(core: CoreRule): ESLintRule {\n const meta: Rule.RuleMetaData<ESLintSeverity> = {\n type: 'problem',\n schema: [],\n messages: { default: '' },\n };\n if (core.meta?.fixable) {\n meta.fixable = 'code';\n }\n\n return {\n id: core.id,\n meta,\n create(context) {\n const settings = context.settings as Record<string, unknown> | undefined;\n const coreContext: RuleContext = {\n report(descriptor) {\n const node = descriptor.node as unknown as Parameters<\n typeof context.report\n >[0]['node'];\n if (!descriptor.fix) {\n context.report({ node, message: descriptor.message });\n return;\n }\n context.report({\n node,\n message: descriptor.message,\n fix(fixer) {\n const replacement = descriptor.fix!({\n replaceText: (n: AstNode, text: string) => {\n const rangeStart =\n (n as unknown as { range?: [number, number] }).range?.[0] ??\n 0;\n const rangeEnd =\n (n as unknown as { range?: [number, number] }).range?.[1] ??\n 0;\n return { range: [rangeStart, rangeEnd], text, node: n };\n },\n });\n return fixer.replaceTextRange(\n replacement.range,\n replacement.text,\n );\n },\n });\n },\n getFilename: () => context.filename,\n settings,\n capabilities: deriveCapabilities(settings),\n };\n const coreVisitors = core.create(coreContext);\n const eslintVisitors: Record<string, (node: unknown) => void> = {};\n for (const key of Object.keys(coreVisitors)) {\n const fn = coreVisitors[key];\n if (typeof fn !== 'function') continue;\n eslintVisitors[key] = fn as (node: unknown) => void;\n }\n return eslintVisitors as unknown as ReturnType<typeof core.create>;\n },\n };\n}\n\nexport function deriveCapabilities(\n settings: Record<string, unknown> | undefined,\n namespace: string = 'vue-doctor',\n): Set<string> {\n if (!settings) return new Set();\n const inner = settings[namespace] as Record<string, unknown> | undefined;\n if (!inner) return new Set();\n const value = inner['capabilities'];\n if (!Array.isArray(value)) return new Set();\n return new Set(value.filter((v): v is string => typeof v === 'string'));\n}\n","import {\n type CoreRule,\n type Severity,\n VUE_RULES,\n} from '@geoql/doctor-rule-core';\nimport { toESLintRule } from './to-eslint-rule.js';\n\ntype ESLintSeverity = 'error' | 'warn';\n\nexport interface VueDoctorRuleModule {\n readonly id: string;\n readonly severity: Severity;\n readonly recommended: boolean;\n readonly category: string;\n}\n\nexport interface VueDoctorConfig {\n readonly files: ReadonlyArray<string>;\n readonly plugins: { readonly 'vue-doctor': VueDoctorPlugin };\n readonly rules: Readonly<Record<string, ESLintSeverity>>;\n readonly settings?: {\n readonly 'vue-doctor': { readonly capabilities: string[] };\n };\n}\n\nexport interface VueDoctorPlugin {\n readonly meta: { readonly name: 'vue-doctor'; readonly version: string };\n readonly rules: Readonly<Record<string, ReturnType<typeof toESLintRule>>>;\n readonly ruleMeta: Readonly<Record<string, VueDoctorRuleModule>>;\n readonly configs: {\n readonly recommended: ReadonlyArray<VueDoctorConfig>;\n readonly all: ReadonlyArray<VueDoctorConfig>;\n };\n}\n\nconst SEVERITY_TO_ESLINT: Readonly<Record<Severity, ESLintSeverity>> = {\n error: 'error',\n warn: 'warn',\n info: 'warn',\n};\n\nfunction toRecord(\n rules: readonly CoreRule[],\n): Record<string, ReturnType<typeof toESLintRule>> {\n const out: Record<string, ReturnType<typeof toESLintRule>> = {};\n for (const core of rules) {\n out[core.id] = toESLintRule(core);\n }\n return out;\n}\n\nfunction toMetaRecord(\n rules: readonly CoreRule[],\n): Record<string, VueDoctorRuleModule> {\n const out: Record<string, VueDoctorRuleModule> = {};\n for (const core of rules) {\n out[core.id] = {\n id: core.id,\n severity: core.severity,\n recommended: core.recommended,\n category: core.category,\n };\n }\n return out;\n}\n\nconst VUE_DOCTOR_VERSION = '1.0.0';\n\nconst rules = toRecord(VUE_RULES);\nconst ruleMeta = toMetaRecord(VUE_RULES);\n\nfunction buildConfigs(self: VueDoctorPlugin): VueDoctorPlugin['configs'] {\n const recommendedConfig: VueDoctorConfig = {\n files: ['**/*.{js,jsx,ts,tsx,vue}'],\n plugins: { 'vue-doctor': self },\n rules: Object.fromEntries(\n VUE_RULES.filter((r) => r.recommended).map((r) => [\n `vue-doctor/${r.id}`,\n SEVERITY_TO_ESLINT[r.severity],\n ]),\n ),\n settings: { 'vue-doctor': { capabilities: [] } },\n };\n const allConfig: VueDoctorConfig = {\n files: ['**/*.{js,jsx,ts,tsx,vue}'],\n plugins: { 'vue-doctor': self },\n rules: Object.fromEntries(\n VUE_RULES.map((r) => [\n `vue-doctor/${r.id}`,\n SEVERITY_TO_ESLINT[r.severity],\n ]),\n ),\n };\n return {\n recommended: [recommendedConfig],\n all: [allConfig],\n };\n}\n\nconst plugin: VueDoctorPlugin = {\n meta: { name: 'vue-doctor', version: VUE_DOCTOR_VERSION },\n rules,\n ruleMeta,\n configs: { recommended: [], all: [] },\n};\n\nconst finalPlugin: VueDoctorPlugin = {\n meta: { name: 'vue-doctor', version: VUE_DOCTOR_VERSION },\n rules,\n ruleMeta,\n configs: buildConfigs(plugin),\n};\n\nexport default finalPlugin;\nexport { finalPlugin as plugin };\n"],"mappings":";;AASA,SAAgB,aAAa,MAA4B;CACvD,MAAM,OAA0C;EAC9C,MAAM;EACN,QAAQ,CAAC;EACT,UAAU,EAAE,SAAS,GAAG;CAC1B;CACA,IAAI,KAAK,MAAM,SACb,KAAK,UAAU;CAGjB,OAAO;EACL,IAAI,KAAK;EACT;EACA,OAAO,SAAS;GACd,MAAM,WAAW,QAAQ;GACzB,MAAM,cAA2B;IAC/B,OAAO,YAAY;KACjB,MAAM,OAAO,WAAW;KAGxB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AAK,MAAM,QAAQ,OACjB,IAAI,KAAK,MAAM;EACb,IAAI,KAAK;EACT,UAAU,KAAK;EACf,aAAa,KAAK;EAClB,UAAU,KAAK;CACjB;CAEF,OAAO;AACT;AAEA,MAAM,qBAAqB;AAE3B,MAAM,QAAQ,SAASA,WAAS;AAChC,MAAM,WAAW,aAAaA,WAAS;AAEvC,SAAS,aAAa,MAAmD;CACvE,MAAM,oBAAqC;EACzC,OAAO,CAAC,0BAA0B;EAClC,SAAS,EAAE,cAAc,KAAK;EAC9B,OAAO,OAAO,YACZA,YAAU,QAAQ,MAAM,EAAE,WAAW,
|
|
1
|
+
{"version":3,"file":"index.js","names":["VUE_RULES"],"sources":["../src/to-eslint-rule.ts","../src/plugin.ts"],"sourcesContent":["import type { Rule } from 'eslint';\nimport type { CoreRule, RuleContext, AstNode } from '@geoql/doctor-rule-core';\n\ntype ESLintSeverity = 'error' | 'warn';\n\nexport interface ESLintRule extends Rule.RuleModule<ESLintSeverity> {\n readonly id: string;\n}\n\nexport function toESLintRule(core: CoreRule): ESLintRule {\n const meta: Rule.RuleMetaData<ESLintSeverity> = {\n type: 'problem',\n schema: [],\n messages: { default: '' },\n };\n if (core.meta?.fixable) {\n meta.fixable = 'code';\n }\n\n return {\n id: core.id,\n meta,\n create(context) {\n const settings = context.settings as Record<string, unknown> | undefined;\n const coreContext: RuleContext = {\n report(descriptor) {\n const node = descriptor.node as unknown as Parameters<\n typeof context.report\n >[0]['node'];\n if (!descriptor.fix) {\n context.report({ node, message: descriptor.message });\n return;\n }\n context.report({\n node,\n message: descriptor.message,\n fix(fixer) {\n const replacement = descriptor.fix!({\n replaceText: (n: AstNode, text: string) => {\n const rangeStart =\n (n as unknown as { range?: [number, number] }).range?.[0] ??\n 0;\n const rangeEnd =\n (n as unknown as { range?: [number, number] }).range?.[1] ??\n 0;\n return { range: [rangeStart, rangeEnd], text, node: n };\n },\n });\n return fixer.replaceTextRange(\n replacement.range,\n replacement.text,\n );\n },\n });\n },\n getFilename: () => context.filename,\n settings,\n capabilities: deriveCapabilities(settings),\n };\n const coreVisitors = core.create(coreContext);\n const eslintVisitors: Record<string, (node: unknown) => void> = {};\n for (const key of Object.keys(coreVisitors)) {\n const fn = coreVisitors[key];\n if (typeof fn !== 'function') continue;\n eslintVisitors[key] = fn as (node: unknown) => void;\n }\n return eslintVisitors as unknown as ReturnType<typeof core.create>;\n },\n };\n}\n\nexport function deriveCapabilities(\n settings: Record<string, unknown> | undefined,\n namespace: string = 'vue-doctor',\n): Set<string> {\n if (!settings) return new Set();\n const inner = settings[namespace] as Record<string, unknown> | undefined;\n if (!inner) return new Set();\n const value = inner['capabilities'];\n if (!Array.isArray(value)) return new Set();\n return new Set(value.filter((v): v is string => typeof v === 'string'));\n}\n","import {\n type CoreRule,\n type Severity,\n VUE_RULES,\n} from '@geoql/doctor-rule-core';\nimport { toESLintRule } from './to-eslint-rule.js';\n\ntype ESLintSeverity = 'error' | 'warn';\n\nexport interface VueDoctorRuleModule {\n readonly id: string;\n readonly severity: Severity;\n readonly recommended: boolean;\n readonly category: string;\n}\n\nexport interface VueDoctorConfig {\n readonly files: ReadonlyArray<string>;\n readonly plugins: { readonly 'vue-doctor': VueDoctorPlugin };\n readonly rules: Readonly<Record<string, ESLintSeverity>>;\n readonly settings?: {\n readonly 'vue-doctor': { readonly capabilities: string[] };\n };\n}\n\nexport interface VueDoctorPlugin {\n readonly meta: { readonly name: 'vue-doctor'; readonly version: string };\n readonly rules: Readonly<Record<string, ReturnType<typeof toESLintRule>>>;\n readonly ruleMeta: Readonly<Record<string, VueDoctorRuleModule>>;\n readonly configs: {\n readonly recommended: ReadonlyArray<VueDoctorConfig>;\n readonly all: ReadonlyArray<VueDoctorConfig>;\n };\n}\n\nconst SEVERITY_TO_ESLINT: Readonly<Record<Severity, ESLintSeverity>> = {\n error: 'error',\n warn: 'warn',\n info: 'warn',\n};\n\nfunction toRecord(\n rules: readonly CoreRule[],\n): Record<string, ReturnType<typeof toESLintRule>> {\n const out: Record<string, ReturnType<typeof toESLintRule>> = {};\n for (const core of rules) {\n out[core.id] = toESLintRule(core);\n }\n return out;\n}\n\nfunction toMetaRecord(\n rules: readonly CoreRule[],\n): Record<string, VueDoctorRuleModule> {\n const out: Record<string, VueDoctorRuleModule> = {};\n for (const core of rules) {\n out[core.id] = {\n id: core.id,\n severity: core.severity,\n recommended: core.recommended,\n category: core.category,\n };\n }\n return out;\n}\n\nconst VUE_DOCTOR_VERSION = '1.0.0';\n\nconst rules = toRecord(VUE_RULES);\nconst ruleMeta = toMetaRecord(VUE_RULES);\n\nfunction buildConfigs(self: VueDoctorPlugin): VueDoctorPlugin['configs'] {\n const recommendedConfig: VueDoctorConfig = {\n files: ['**/*.{js,jsx,ts,tsx,vue}'],\n plugins: { 'vue-doctor': self },\n rules: Object.fromEntries(\n VUE_RULES.filter((r) => r.recommended).map((r) => [\n `vue-doctor/${r.id}`,\n SEVERITY_TO_ESLINT[r.severity],\n ]),\n ),\n settings: { 'vue-doctor': { capabilities: [] } },\n };\n const allConfig: VueDoctorConfig = {\n files: ['**/*.{js,jsx,ts,tsx,vue}'],\n plugins: { 'vue-doctor': self },\n rules: Object.fromEntries(\n VUE_RULES.map((r) => [\n `vue-doctor/${r.id}`,\n SEVERITY_TO_ESLINT[r.severity],\n ]),\n ),\n };\n return {\n recommended: [recommendedConfig],\n all: [allConfig],\n };\n}\n\nconst plugin: VueDoctorPlugin = {\n meta: { name: 'vue-doctor', version: VUE_DOCTOR_VERSION },\n rules,\n ruleMeta,\n configs: { recommended: [], all: [] },\n};\n\nconst finalPlugin: VueDoctorPlugin = {\n meta: { name: 'vue-doctor', version: VUE_DOCTOR_VERSION },\n rules,\n ruleMeta,\n configs: buildConfigs(plugin),\n};\n\nexport default finalPlugin;\nexport { finalPlugin as plugin };\n"],"mappings":";;AASA,SAAgB,aAAa,MAA4B;CACvD,MAAM,OAA0C;EAC9C,MAAM;EACN,QAAQ,CAAC;EACT,UAAU,EAAE,SAAS,GAAG;CAC1B;CACA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
"name": "@geoql/eslint-plugin-vue-doctor",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "ESLint flat-config plugin for Vue 3 anti-patterns and AI-slop detection. Shares the same rule cores as @geoql/oxlint-plugin-vue-doctor. TypeScript, ESM.",
|
|
6
6
|
"keywords": [
|
|
@@ -42,15 +42,15 @@
|
|
|
42
42
|
"access": "public"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@geoql/doctor-rule-core": "1.
|
|
45
|
+
"@geoql/doctor-rule-core": "1.2.0"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@types/node": "^25.9.
|
|
48
|
+
"@types/node": "^25.9.4",
|
|
49
49
|
"@typescript-eslint/parser": "^8.61.1",
|
|
50
50
|
"eslint": "^10.5.0",
|
|
51
51
|
"typescript": "^6.0.3",
|
|
52
52
|
"vitest": "^4.1.9",
|
|
53
|
-
"@geoql/doctor-core": "1.
|
|
53
|
+
"@geoql/doctor-core": "1.3.0"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
56
|
"eslint": ">=9.0.0"
|