-
-
Notifications
You must be signed in to change notification settings - Fork 44
/
Copy pathno-deprecated-i18n-places-prop.ts
48 lines (46 loc) · 1.2 KB
/
no-deprecated-i18n-places-prop.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/**
* @author Yosuke Ota
*/
import {
defineTemplateBodyVisitor,
getAttribute,
getDirective
} from '../utils/index'
import type { RuleContext, RuleListener } from '../types'
import type { AST as VAST } from 'vue-eslint-parser'
import { createRule } from '../utils/rule'
function create(context: RuleContext): RuleListener {
return defineTemplateBodyVisitor(context, {
VElement(node: VAST.VElement) {
if (node.name !== 'i18n' && node.name !== 'i18n-t') {
return
}
const placesProp =
getAttribute(node, 'places') || getDirective(node, 'bind', 'places')
if (placesProp) {
context.report({
node: placesProp.key,
messageId: 'deprecated'
})
}
}
})
}
export default createRule({
meta: {
type: 'problem',
docs: {
description:
'disallow using deprecated `places` prop (Removed in Vue I18n 9.0.0+)',
category: 'Recommended',
url: 'https://eslint-plugin-vue-i18n.intlify.dev/rules/no-deprecated-i18n-places-prop.html',
recommended: false
},
fixable: null,
schema: [],
messages: {
deprecated: 'Deprecated `places` prop was found. Use v-slot instead.'
}
},
create
})