From f06309c82dda4acb8e50799e5fbf9dc344370f08 Mon Sep 17 00:00:00 2001 From: Vida Xie Date: Sat, 22 Nov 2025 15:34:13 +0800 Subject: [PATCH 01/14] chore: remove @types/eslint --- package.json | 1 - typings/eslint/index.d.ts | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/package.json b/package.json index 7e0dce997..97a02d328 100644 --- a/package.json +++ b/package.json @@ -85,7 +85,6 @@ "@ota-meshi/site-kit-eslint-editor-vue": "^0.2.4", "@stylistic/eslint-plugin": "^5.2.2", "@svitejs/changesets-changelog-github-compact": "^1.2.0", - "@types/eslint": "^8.56.2", "@types/natural-compare": "^1.4.3", "@types/node": "^24.0.8", "@types/semver": "^7.5.8", diff --git a/typings/eslint/index.d.ts b/typings/eslint/index.d.ts index 0558e5511..0f0430e5b 100644 --- a/typings/eslint/index.d.ts +++ b/typings/eslint/index.d.ts @@ -2,7 +2,7 @@ import { Rule as ESLintRule, RuleTester as ESLintRuleTester, Linter as ESLintLinter -} from '../../node_modules/@types/eslint' +} from 'eslint' import * as VAST from '../eslint-plugin-vue/util-types/ast' import * as VNODE from '../eslint-plugin-vue/util-types/node' import * as parserServices from '../eslint-plugin-vue/util-types/parser-services' From 0c90a511a9fe6749a42bac72923a44348430a6bc Mon Sep 17 00:00:00 2001 From: Vida Xie Date: Sat, 22 Nov 2025 15:35:28 +0800 Subject: [PATCH 02/14] chore: remove compat for `getDeclaredVariables` --- lib/utils/index.js | 6 +----- typings/eslint/index.d.ts | 2 +- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/lib/utils/index.js b/lib/utils/index.js index dabdc2ba3..360972b75 100644 --- a/lib/utils/index.js +++ b/lib/utils/index.js @@ -325,11 +325,7 @@ function wrapContextToOverrideTokenMethods(context, tokenStore, options) { */ function getDeclaredVariables(node) { const scope = getContainerScope(node) - return ( - scope?.getDeclaredVariables?.(node) ?? - context.getDeclaredVariables?.(node) ?? - [] - ) + return scope?.getDeclaredVariables(node) ?? [] } } diff --git a/typings/eslint/index.d.ts b/typings/eslint/index.d.ts index 0f0430e5b..0dd42cf1a 100644 --- a/typings/eslint/index.d.ts +++ b/typings/eslint/index.d.ts @@ -19,7 +19,7 @@ export namespace Scope { globalScope: Scope | null acquire(node: VAST.ESNode | VAST.Program, inner?: boolean): Scope | null /** @since ESLint v8.38.0 */ - getDeclaredVariables?(node: VAST.ESNode): Variable[] + getDeclaredVariables(node: VAST.ESNode): Variable[] } interface Scope { type: From b4b218b2c5ab0a734ca9b53a964316b2535e3034 Mon Sep 17 00:00:00 2001 From: Vida Xie Date: Sat, 22 Nov 2025 15:35:41 +0800 Subject: [PATCH 03/14] chore: update version def --- typings/eslint/index.d.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/typings/eslint/index.d.ts b/typings/eslint/index.d.ts index 0dd42cf1a..87098b0a4 100644 --- a/typings/eslint/index.d.ts +++ b/typings/eslint/index.d.ts @@ -323,9 +323,9 @@ export namespace Rule { id: string options: ESLintRule.RuleContext['options'] settings: { [name: string]: any } - /** @deprecated removed in ESLint v10? */ + /** @deprecated removed in ESLint v10 */ parserPath?: string - /** @deprecated removed in ESLint v10? */ + /** @deprecated removed in ESLint v10 */ parserOptions?: ESLintLinter.ParserOptions /** For flat config */ languageOptions?: ESLintLinter.FlatConfig['languageOptions'] @@ -336,14 +336,16 @@ export namespace Rule { getAncestors?(): VAST.ESNode[] /** @deprecated removed in ESLint v9 */ getDeclaredVariables?(node: VAST.ESNode): Scope.Variable[] + /** @deprecated removed in ESLint v10 */ getFilename(): string /** @since ESLint v8.40.0 */ - filename?: string + filename: string /** @deprecated removed in ESLint v9 */ getScope?(): Scope.Scope + /** @deprecated removed in ESLint v10 */ getSourceCode(): SourceCode /** @since ESLint v8.40.0 */ - sourceCode?: SourceCode + sourceCode: SourceCode /** @deprecated removed in ESLint v9 */ markVariableAsUsed?(name: string): boolean report(descriptor: ReportDescriptor): void @@ -351,7 +353,7 @@ export namespace Rule { // eslint@6 does not have this method. getCwd?: () => string /** @since ESLint v8.40.0 */ - cwd?: string + cwd: string } type ReportDescriptor = From d1e243534a68e641dcb7ee5d45af685854f08cf0 Mon Sep 17 00:00:00 2001 From: Vida Xie Date: Sat, 22 Nov 2025 15:45:08 +0800 Subject: [PATCH 04/14] refactor: replace `getSourceCode` with `sourceCode` --- lib/rules/attribute-hyphenation.js | 2 +- lib/rules/attributes-order.js | 2 +- lib/rules/block-order.js | 3 +-- lib/rules/block-tag-newline.js | 2 +- lib/rules/comment-directive.js | 4 ++-- .../component-name-in-template-casing.js | 4 ++-- lib/rules/custom-event-name-casing.js | 2 +- lib/rules/define-macros-order.js | 2 +- lib/rules/enforce-style-attribute.js | 2 +- lib/rules/first-attribute-linebreak.js | 2 +- lib/rules/html-closing-bracket-newline.js | 2 +- lib/rules/html-closing-bracket-spacing.js | 2 +- lib/rules/html-comment-indent.js | 2 +- lib/rules/html-indent.js | 2 +- lib/rules/html-quotes.js | 2 +- lib/rules/html-self-closing.js | 2 +- lib/rules/max-attributes-per-line.js | 2 +- lib/rules/max-len.js | 2 +- lib/rules/max-lines-per-block.js | 5 ++--- .../multiline-html-element-content-newline.js | 2 +- lib/rules/mustache-interpolation-spacing.js | 2 +- .../new-line-between-multi-line-property.js | 2 +- lib/rules/no-child-content.js | 2 +- .../no-deprecated-data-object-declaration.js | 2 +- lib/rules/no-dupe-v-else-if.js | 2 +- lib/rules/no-duplicate-class-names.js | 2 +- lib/rules/no-empty-component-block.js | 2 +- lib/rules/no-export-in-script-setup.js | 2 +- lib/rules/no-extra-parens.js | 4 ++-- lib/rules/no-import-compiler-macros.js | 2 +- lib/rules/no-irregular-whitespace.js | 2 +- lib/rules/no-multi-spaces.js | 4 ++-- lib/rules/no-multiple-template-root.js | 2 +- lib/rules/no-mutating-props.js | 4 ++-- lib/rules/no-negated-v-if-condition.js | 2 +- lib/rules/no-ref-as-operand.js | 2 +- lib/rules/no-ref-object-reactivity-loss.js | 2 +- lib/rules/no-restricted-block.js | 2 +- lib/rules/no-restricted-custom-event.js | 2 +- lib/rules/no-setup-props-reactivity-loss.js | 2 +- lib/rules/no-shared-component-data.js | 2 +- ...-spaces-around-equal-signs-in-attribute.js | 2 +- lib/rules/no-template-shadow.js | 3 +-- lib/rules/no-undef-components.js | 2 +- lib/rules/no-undef-properties.js | 4 ++-- lib/rules/no-unused-emit-declarations.js | 2 +- lib/rules/no-unused-properties.js | 6 ++--- lib/rules/no-unused-refs.js | 3 +-- lib/rules/no-use-v-if-with-v-for.js | 2 +- lib/rules/no-useless-mustaches.js | 2 +- lib/rules/no-useless-v-bind.js | 2 +- lib/rules/no-v-html.js | 2 +- lib/rules/order-in-components.js | 2 +- lib/rules/padding-line-between-blocks.js | 4 ++-- lib/rules/padding-line-between-tags.js | 6 ++--- .../padding-lines-in-component-definition.js | 2 +- lib/rules/prefer-define-options.js | 2 +- lib/rules/prefer-prop-type-boolean-first.js | 2 +- lib/rules/prefer-separate-static-class.js | 2 +- lib/rules/quote-props.js | 2 +- lib/rules/require-default-export.js | 2 +- lib/rules/require-default-prop.js | 2 +- lib/rules/require-explicit-emits.js | 6 ++--- lib/rules/require-explicit-slots.js | 2 +- lib/rules/require-expose.js | 2 +- lib/rules/require-name-property.js | 2 +- lib/rules/require-prop-comment.js | 2 +- lib/rules/require-typed-object-prop.js | 2 +- lib/rules/require-typed-ref.js | 4 ++-- lib/rules/require-valid-default-prop.js | 2 +- lib/rules/script-indent.js | 2 +- ...singleline-html-element-content-newline.js | 2 +- lib/rules/syntaxes/define-options.js | 2 +- lib/rules/syntaxes/slot-attribute.js | 2 +- lib/rules/syntaxes/slot-scope-attribute.js | 2 +- lib/rules/syntaxes/v-slot.js | 2 +- lib/rules/use-v-on-exact.js | 2 +- lib/rules/v-for-delimiter-style.js | 2 +- lib/rules/v-on-event-hyphenation.js | 2 +- lib/rules/v-on-handler-style.js | 9 ++++---- lib/rules/v-slot-style.js | 2 +- lib/rules/valid-template-root.js | 2 +- lib/rules/valid-v-for.js | 2 +- lib/rules/valid-v-on.js | 2 +- lib/rules/valid-v-slot.js | 2 +- lib/utils/html-comments.js | 2 +- lib/utils/indent-common.js | 2 +- lib/utils/index.js | 22 +++++++++---------- lib/utils/property-references.js | 8 +++---- lib/utils/ref-object-references.js | 6 ++--- lib/utils/scope.js | 2 +- lib/utils/style-variables/index.js | 2 +- lib/utils/ts-utils/ts-types.js | 2 +- 93 files changed, 126 insertions(+), 131 deletions(-) diff --git a/lib/rules/attribute-hyphenation.js b/lib/rules/attribute-hyphenation.js index 45e7ca687..4b6084f20 100644 --- a/lib/rules/attribute-hyphenation.js +++ b/lib/rules/attribute-hyphenation.js @@ -75,7 +75,7 @@ module.exports = { }, /** @param {RuleContext} context */ create(context) { - const sourceCode = context.getSourceCode() + const sourceCode = context.sourceCode const option = context.options[0] const optionsPayload = context.options[1] const useHyphenated = option !== 'never' diff --git a/lib/rules/attributes-order.js b/lib/rules/attributes-order.js index 8fe461004..94b9cccdb 100644 --- a/lib/rules/attributes-order.js +++ b/lib/rules/attributes-order.js @@ -222,7 +222,7 @@ function isAlphabetical(prevNode, currNode, sourceCode) { * @returns {RuleListener} AST event handlers. */ function create(context) { - const sourceCode = context.getSourceCode() + const sourceCode = context.sourceCode const otherAttrs = [ ATTRS.ATTR_DYNAMIC, ATTRS.ATTR_STATIC, diff --git a/lib/rules/block-order.js b/lib/rules/block-order.js index d4fdb62ea..39bd4c6e3 100644 --- a/lib/rules/block-order.js +++ b/lib/rules/block-order.js @@ -106,7 +106,7 @@ module.exports = { function getOrderElement(element) { return orders.find((o) => o.selector.test(element)) } - const sourceCode = context.getSourceCode() + const sourceCode = context.sourceCode const documentFragment = sourceCode.parserServices.getDocumentFragment && sourceCode.parserServices.getDocumentFragment() @@ -129,7 +129,6 @@ module.exports = { const order = getOrderElement(element) return order ? [{ order, element }] : [] }) - const sourceCode = context.getSourceCode() for (const [index, elementWithOrders] of elementsWithOrder.entries()) { const { order: expected, element } = elementWithOrders const firstUnordered = elementsWithOrder diff --git a/lib/rules/block-tag-newline.js b/lib/rules/block-tag-newline.js index 22fb12870..1ccf45814 100644 --- a/lib/rules/block-tag-newline.js +++ b/lib/rules/block-tag-newline.js @@ -84,7 +84,7 @@ module.exports = { }, /** @param {RuleContext} context */ create(context) { - const sourceCode = context.getSourceCode() + const sourceCode = context.sourceCode const df = sourceCode.parserServices.getDocumentFragment && sourceCode.parserServices.getDocumentFragment() diff --git a/lib/rules/comment-directive.js b/lib/rules/comment-directive.js index 655e222bd..f1ec64e34 100644 --- a/lib/rules/comment-directive.js +++ b/lib/rules/comment-directive.js @@ -214,7 +214,7 @@ function reportUnused(context, comment, kind) { * @returns { { ruleId: string, key: string }[] } */ function reportUnusedRules(context, comment, kind, rules) { - const sourceCode = context.getSourceCode() + const sourceCode = context.sourceCode const commentStart = comment.range[0] + 4 /*