Skip to content

Commit 2870269

Browse files
authored
Add meta.docs.url to rules (#285)
1 parent 895dd6c commit 2870269

24 files changed

+248
-37
lines changed

docs/rules/key-format-style.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ Also, the following localization key definitions are reported as errors, because
4141
4242
</eslint-code-block>
4343
44-
## Options
44+
## :gear: Options
4545
4646
```json
4747
{

docs/rules/keys-order.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ This rule is useful to provide browsability of localization keys.
4444

4545
</eslint-code-block>
4646

47-
## Options
47+
## :gear: Options
4848

4949
```json
5050
{

docs/rules/no-missing-keys-in-other-locales.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ locale messages:
6868

6969
</resource-group>
7070

71-
## Options
71+
## :gear: Options
7272

7373
```json
7474
{

lib/rules/key-format-style.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import debugBuilder from 'debug'
99
import type { RuleContext, RuleListener } from '../types'
1010
import { getCasingChecker } from '../utils/casing'
1111
import type { LocaleMessage } from '../utils/locale-messages'
12+
import { createRule } from '../utils/rule'
1213
const debug = debugBuilder('eslint-plugin-vue-i18n:key-format-style')
1314

1415
const allowedCaseOptions = [
@@ -212,18 +213,19 @@ function create(context: RuleContext): RuleListener {
212213
}
213214
}
214215

215-
export = {
216+
export = createRule({
216217
meta: {
217218
type: 'layout',
218219
docs: {
219220
description: 'enforce specific casing for localization keys',
220221
category: 'Best Practices',
222+
url: 'https://eslint-plugin-vue-i18n.intlify.dev/rules/key-format-style.html',
221223
recommended: false
222224
},
223225
fixable: null,
224226
schema: [
225227
{
226-
enum: allowedCaseOptions
228+
enum: [...allowedCaseOptions]
227229
},
228230
{
229231
type: 'object',
@@ -237,4 +239,4 @@ export = {
237239
]
238240
},
239241
create
240-
}
242+
})

lib/rules/no-deprecated-i18n-component.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import { defineTemplateBodyVisitor } from '../utils/index'
55
import type { RuleContext, RuleListener } from '../types'
66
import type { AST as VAST } from 'vue-eslint-parser'
7+
import { createRule } from '../utils/rule'
78

89
function create(context: RuleContext): RuleListener {
910
return defineTemplateBodyVisitor(context, {
@@ -81,13 +82,14 @@ function create(context: RuleContext): RuleListener {
8182
})
8283
}
8384

84-
export = {
85+
export = createRule({
8586
meta: {
8687
type: 'problem',
8788
docs: {
8889
description:
8990
'disallow using deprecated `<i18n>` components (in Vue I18n 9.0.0+)',
9091
category: 'Recommended',
92+
url: 'https://eslint-plugin-vue-i18n.intlify.dev/rules/no-deprecated-i18n-component.html',
9193
recommended: false
9294
},
9395
fixable: 'code',
@@ -98,4 +100,4 @@ export = {
98100
}
99101
},
100102
create
101-
}
103+
})

lib/rules/no-deprecated-i18n-place-attr.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
} from '../utils/index'
99
import type { RuleContext, RuleListener } from '../types'
1010
import type { AST as VAST } from 'vue-eslint-parser'
11+
import { createRule } from '../utils/rule'
1112

1213
function create(context: RuleContext): RuleListener {
1314
return defineTemplateBodyVisitor(context, {
@@ -32,13 +33,14 @@ function create(context: RuleContext): RuleListener {
3233
})
3334
}
3435

35-
export = {
36+
export = createRule({
3637
meta: {
3738
type: 'problem',
3839
docs: {
3940
description:
4041
'disallow using deprecated `place` attribute (Removed in Vue I18n 9.0.0+)',
4142
category: 'Recommended',
43+
url: 'https://eslint-plugin-vue-i18n.intlify.dev/rules/no-deprecated-i18n-place-attr.html',
4244
recommended: false
4345
},
4446
fixable: null,
@@ -48,4 +50,4 @@ export = {
4850
}
4951
},
5052
create
51-
}
53+
})

lib/rules/no-deprecated-i18n-places-prop.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
} from '../utils/index'
99
import type { RuleContext, RuleListener } from '../types'
1010
import type { AST as VAST } from 'vue-eslint-parser'
11+
import { createRule } from '../utils/rule'
1112

1213
function create(context: RuleContext): RuleListener {
1314
return defineTemplateBodyVisitor(context, {
@@ -27,13 +28,14 @@ function create(context: RuleContext): RuleListener {
2728
})
2829
}
2930

30-
export = {
31+
export = createRule({
3132
meta: {
3233
type: 'problem',
3334
docs: {
3435
description:
3536
'disallow using deprecated `places` prop (Removed in Vue I18n 9.0.0+)',
3637
category: 'Recommended',
38+
url: 'https://eslint-plugin-vue-i18n.intlify.dev/rules/no-deprecated-i18n-places-prop.html',
3739
recommended: false
3840
},
3941
fixable: null,
@@ -43,4 +45,4 @@ export = {
4345
}
4446
},
4547
create
46-
}
48+
})

lib/rules/no-duplicate-keys-in-locale.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import type {
1515
} from '../types'
1616
import { joinPath } from '../utils/key-path'
1717
import { getCwd } from '../utils/get-cwd'
18+
import { createRule } from '../utils/rule'
1819
const debug = debugBuilder('eslint-plugin-vue-i18n:no-duplicate-keys-in-locale')
1920

2021
interface DictData {
@@ -371,13 +372,14 @@ function create(context: RuleContext): RuleListener {
371372
}
372373
}
373374

374-
export = {
375+
export = createRule({
375376
meta: {
376377
type: 'problem',
377378
docs: {
378379
description:
379380
'disallow duplicate localization keys within the same locale',
380381
category: 'Best Practices',
382+
url: 'https://eslint-plugin-vue-i18n.intlify.dev/rules/no-duplicate-keys-in-locale.html',
381383
recommended: false
382384
},
383385
fixable: null,
@@ -394,4 +396,4 @@ export = {
394396
]
395397
},
396398
create
397-
}
399+
})

lib/rules/no-dynamic-keys.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import { defineTemplateBodyVisitor } from '../utils/index'
55
import type { RuleContext, RuleListener } from '../types'
66
import type { AST as VAST } from 'vue-eslint-parser'
7+
import { createRule } from '../utils/rule'
78

89
function isStatic(
910
node:
@@ -138,16 +139,17 @@ function create(context: RuleContext): RuleListener {
138139
)
139140
}
140141

141-
export = {
142+
export = createRule({
142143
meta: {
143144
type: 'suggestion',
144145
docs: {
145146
description: 'disallow localization dynamic keys at localization methods',
146147
category: 'Best Practices',
148+
url: 'https://eslint-plugin-vue-i18n.intlify.dev/rules/no-dynamic-keys.html',
147149
recommended: false
148150
},
149151
fixable: null,
150152
schema: []
151153
},
152154
create
153-
}
155+
})

lib/rules/no-html-messages.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import debugBuilder from 'debug'
88
import type { AST as JSONAST } from 'jsonc-eslint-parser'
99
import type { AST as YAMLAST } from 'yaml-eslint-parser'
1010
import type { RuleContext, RuleListener } from '../types'
11+
import { createRule } from '../utils/rule'
1112

1213
const debug = debugBuilder('eslint-plugin-vue-i18n:no-html-messages')
1314

@@ -115,16 +116,17 @@ function create(context: RuleContext): RuleListener {
115116
}
116117
}
117118

118-
export = {
119+
export = createRule({
119120
meta: {
120121
type: 'problem',
121122
docs: {
122123
description: 'disallow use HTML localization messages',
123124
category: 'Recommended',
125+
url: 'https://eslint-plugin-vue-i18n.intlify.dev/rules/no-html-messages.html',
124126
recommended: true
125127
},
126128
fixable: null,
127129
schema: []
128130
},
129131
create
130-
}
132+
})

lib/rules/no-i18n-t-path-prop.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
} from '../utils/index'
99
import type { RuleContext, RuleListener } from '../types'
1010
import type { AST as VAST } from 'vue-eslint-parser'
11+
import { createRule } from '../utils/rule'
1112

1213
function create(context: RuleContext): RuleListener {
1314
return defineTemplateBodyVisitor(context, {
@@ -34,12 +35,13 @@ function create(context: RuleContext): RuleListener {
3435
})
3536
}
3637

37-
export = {
38+
export = createRule({
3839
meta: {
3940
type: 'problem',
4041
docs: {
4142
description: 'disallow using `path` prop with `<i18n-t>`',
4243
category: 'Recommended',
44+
url: 'https://eslint-plugin-vue-i18n.intlify.dev/rules/no-i18n-t-path-prop.html',
4345
recommended: false
4446
},
4547
fixable: 'code',
@@ -50,4 +52,4 @@ export = {
5052
}
5153
},
5254
create
53-
}
55+
})

lib/rules/no-missing-keys-in-other-locales.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import type {
1313
} from '../types'
1414
import type { LocaleMessage, LocaleMessages } from '../utils/locale-messages'
1515
import { joinPath } from '../utils/key-path'
16+
import { createRule } from '../utils/rule'
1617
const debug = debugBuilder(
1718
'eslint-plugin-vue-i18n:no-missing-keys-in-other-locales'
1819
)
@@ -326,12 +327,13 @@ function create(context: RuleContext): RuleListener {
326327
}
327328
}
328329

329-
export = {
330+
export = createRule({
330331
meta: {
331332
type: 'layout',
332333
docs: {
333334
description: 'disallow missing locale message keys in other locales',
334335
category: 'Best Practices',
336+
url: 'https://eslint-plugin-vue-i18n.intlify.dev/rules/no-missing-keys-in-other-locales.html',
335337
recommended: false
336338
},
337339
fixable: null,
@@ -349,4 +351,4 @@ export = {
349351
]
350352
},
351353
create
352-
}
354+
})

lib/rules/no-missing-keys.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import { defineTemplateBodyVisitor, getLocaleMessages } from '../utils/index'
55
import type { AST as VAST } from 'vue-eslint-parser'
66
import type { RuleContext, RuleListener } from '../types'
7+
import { createRule } from '../utils/rule'
78

89
function create(context: RuleContext): RuleListener {
910
return defineTemplateBodyVisitor(
@@ -126,13 +127,14 @@ function checkCallExpression(
126127
}
127128
}
128129

129-
export = {
130+
export = createRule({
130131
meta: {
131132
type: 'problem',
132133
docs: {
133134
description:
134135
'disallow missing locale message key at localization methods',
135136
category: 'Recommended',
137+
url: 'https://eslint-plugin-vue-i18n.intlify.dev/rules/no-missing-keys.html',
136138
recommended: true
137139
},
138140
fixable: null,
@@ -142,4 +144,4 @@ export = {
142144
}
143145
},
144146
create
145-
}
147+
})

lib/rules/no-raw-text.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import type {
2424
Range
2525
} from '../types'
2626
import { isKebabCase, pascalCase } from '../utils/casing'
27+
import { createRule } from '../utils/rule'
2728

2829
type LiteralValue = VAST.ESLintLiteral['value']
2930
type StaticTemplateLiteral = VAST.ESLintTemplateLiteral & {
@@ -859,12 +860,13 @@ function create(context: RuleContext): RuleListener {
859860
})
860861
}
861862

862-
export = {
863+
export = createRule({
863864
meta: {
864865
type: 'suggestion',
865866
docs: {
866867
description: 'disallow to string literal in template or JSX',
867868
category: 'Recommended',
869+
url: 'https://eslint-plugin-vue-i18n.intlify.dev/rules/no-raw-text.html',
868870
recommended: true
869871
},
870872
fixable: null,
@@ -898,4 +900,4 @@ export = {
898900
]
899901
},
900902
create
901-
}
903+
})

lib/rules/no-unused-keys.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import type {
2222
} from '../types'
2323
import { joinPath, parsePath } from '../utils/key-path'
2424
import { getCwd } from '../utils/get-cwd'
25+
import { createRule } from '../utils/rule'
2526
const debug = debugBuilder('eslint-plugin-vue-i18n:no-unused-keys')
2627

2728
type UsedKeys = {
@@ -554,12 +555,13 @@ function create(context: RuleContext): RuleListener {
554555
}
555556
}
556557

557-
export = {
558+
export = createRule({
558559
meta: {
559560
type: 'suggestion',
560561
docs: {
561562
description: 'disallow unused localization keys',
562563
category: 'Best Practices',
564+
url: 'https://eslint-plugin-vue-i18n.intlify.dev/rules/no-unused-keys.html',
563565
recommended: false
564566
},
565567
fixable: 'code',
@@ -585,4 +587,4 @@ export = {
585587
]
586588
},
587589
create
588-
}
590+
})

0 commit comments

Comments
 (0)