forked from ember-cli/eslint-plugin-ember
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtemplate-builtin-component-arguments.js
More file actions
48 lines (46 loc) · 1.46 KB
/
template-builtin-component-arguments.js
File metadata and controls
48 lines (46 loc) · 1.46 KB
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
const rule = require('../../../lib/rules/template-builtin-component-arguments');
const RuleTester = require('eslint').RuleTester;
const ruleTester = new RuleTester({
parser: require.resolve('ember-eslint-parser'),
parserOptions: { ecmaVersion: 2022, sourceType: 'module' },
});
ruleTester.run('template-builtin-component-arguments', rule, {
valid: [
'<template><input type="text" size="10" /></template>',
'<template><Input @type="text" size="10" /></template>',
'<template><Input @type="checkbox" @checked={{true}} /></template>',
'<template><Textarea @value="Tomster" /></template>',
],
invalid: [
{
code: '<template><Input type="text" size="10" /></template>',
output: null,
errors: [
{
message:
'Setting the `type` attribute on the builtin <Input> component is not allowed. Did you mean `@type`?',
},
],
},
{
code: '<template><Input @type="checkbox" checked /></template>',
output: null,
errors: [
{
message:
'Setting the `checked` attribute on the builtin <Input> component is not allowed. Did you mean `@checked`?',
},
],
},
{
code: '<template><Textarea value="Tomster" /></template>',
output: null,
errors: [
{
message:
'Setting the `value` attribute on the builtin <Textarea> component is not allowed. Did you mean `@value`?',
},
],
},
],
});