Skip to content

Commit 0c1f86d

Browse files
committed
fix
1 parent 76f8374 commit 0c1f86d

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

lib/types/vue-parser-services.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { Rule } from 'eslint'
2-
import type { RuleContext } from './eslint'
2+
import type { RuleContext, SourceCode } from './eslint'
33
import type { AST as VAST } from 'vue-eslint-parser'
44
import type { TokenStore } from './types'
55
import type { VElement } from 'vue-eslint-parser/ast'
@@ -53,6 +53,6 @@ export interface VueParserServices {
5353

5454
export type CustomBlockVisitorFactory = (
5555
context: RuleContext & {
56-
parserServices: RuleContext['parserServices'] & { customBlock: VElement }
56+
parserServices: SourceCode['parserServices'] & { customBlock: VElement }
5757
}
5858
) => RuleListener | null

lib/utils/index.ts

+7-7
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import type {
2525
import * as jsoncESLintParser from 'jsonc-eslint-parser'
2626
import * as yamlESLintParser from 'yaml-eslint-parser'
2727
import { getCwd } from './get-cwd'
28-
import { getSourceCode } from './compat'
28+
import { getFilename, getSourceCode } from './compat'
2929

3030
interface LocaleFiles {
3131
files: string[]
@@ -45,7 +45,7 @@ export function defineTemplateBodyVisitor(
4545
): RuleListener {
4646
const sourceCode = getSourceCode(context)
4747
if (sourceCode.parserServices.defineTemplateBodyVisitor == null) {
48-
const filename = context.getFilename()
48+
const filename = getFilename(context)
4949
if (extname(filename) === '.vue') {
5050
context.report({
5151
loc: UNEXPECTED_ERROR_LOCATION,
@@ -268,12 +268,12 @@ function getLocaleMessagesFromI18nBlocks(
268268
context: RuleContext,
269269
i18nBlocks: VAST.VElement[]
270270
) {
271-
const sourceCode = context.getSourceCode()
271+
const sourceCode = getSourceCode(context)
272272
let localeMessages = i18nBlockLocaleMessages.get(sourceCode.ast)
273273
if (localeMessages) {
274274
return localeMessages
275275
}
276-
const filename = context.getFilename()
276+
const filename = getFilename(context)
277277
localeMessages = i18nBlocks
278278
.map(block => {
279279
const attrs = getStaticAttributes(block)
@@ -387,7 +387,7 @@ export function getVueObjectType(
387387
const parent = node.parent
388388
if (parent.type === 'ExportDefaultDeclaration') {
389389
// export default {} in .vue || .jsx
390-
const ext = extname(context.getFilename()).toLowerCase()
390+
const ext = extname(getFilename(context)).toLowerCase()
391391
if (
392392
(ext === '.vue' || ext === '.jsx' || !ext) &&
393393
skipTSAsExpression(parent.declaration) === node
@@ -443,7 +443,7 @@ export function getVueObjectType(
443443
(pp.key.type === 'Identifier'
444444
? pp.key.name
445445
: pp.key.type === 'Literal'
446-
? pp.key.value + ''
446+
? `${pp.key.value}`
447447
: '') === 'components'
448448
) {
449449
return 'components-option'
@@ -667,7 +667,7 @@ function getComponentComments(context: RuleContext) {
667667
if (tokens) {
668668
return tokens
669669
}
670-
const sourceCode = context.getSourceCode()
670+
const sourceCode = getSourceCode(context)
671671
tokens = sourceCode
672672
.getAllComments()
673673
.filter(comment => /@vue\/component/g.test(comment.value))

0 commit comments

Comments
 (0)