eslint-plugin-lit 1.8.0 → 1.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -0
- package/custom_types/espree.d.ts +0 -0
- package/custom_types/requireindex.d.ts +0 -0
- package/docs/rules/attribute-value-entities.md +0 -0
- package/docs/rules/ban-attributes.md +0 -0
- package/docs/rules/binding-positions.md +0 -0
- package/docs/rules/no-duplicate-template-bindings.md +0 -0
- package/docs/rules/no-invalid-escape-sequences.md +0 -0
- package/docs/rules/no-invalid-html.md +0 -0
- package/docs/rules/no-legacy-imports.md +0 -0
- package/docs/rules/no-legacy-template-syntax.md +0 -0
- package/docs/rules/no-native-attributes.md +0 -0
- package/docs/rules/no-private-properties.md +0 -0
- package/docs/rules/no-property-change-update.md +0 -0
- package/docs/rules/no-template-arrow.md +0 -0
- package/docs/rules/no-template-bind.md +0 -0
- package/docs/rules/no-template-map.md +0 -0
- package/docs/rules/no-this-assign-in-render.md +0 -0
- package/docs/rules/no-useless-template-literals.md +0 -0
- package/docs/rules/no-value-attribute.md +0 -0
- package/docs/rules/prefer-nothing.md +0 -0
- package/docs/rules/prefer-static-styles.md +0 -0
- package/docs/rules/quoted-expressions.md +0 -0
- package/docs/rules/value-after-constraints.md +0 -0
- package/lib/configs/all.d.ts +0 -0
- package/lib/configs/all.js +0 -0
- package/lib/configs/recommended.d.ts +0 -0
- package/lib/configs/recommended.js +0 -0
- package/lib/index.d.ts +0 -0
- package/lib/index.js +0 -0
- package/lib/rules/attribute-value-entities.d.ts +0 -0
- package/lib/rules/attribute-value-entities.js +0 -0
- package/lib/rules/ban-attributes.d.ts +0 -0
- package/lib/rules/ban-attributes.js +0 -0
- package/lib/rules/binding-positions.d.ts +0 -0
- package/lib/rules/binding-positions.js +0 -0
- package/lib/rules/no-duplicate-template-bindings.d.ts +0 -0
- package/lib/rules/no-duplicate-template-bindings.js +0 -0
- package/lib/rules/no-invalid-escape-sequences.d.ts +0 -0
- package/lib/rules/no-invalid-escape-sequences.js +0 -0
- package/lib/rules/no-invalid-html.d.ts +0 -0
- package/lib/rules/no-invalid-html.js +0 -0
- package/lib/rules/no-legacy-imports.d.ts +0 -0
- package/lib/rules/no-legacy-imports.js +0 -0
- package/lib/rules/no-legacy-template-syntax.d.ts +0 -0
- package/lib/rules/no-legacy-template-syntax.js +0 -0
- package/lib/rules/no-native-attributes.d.ts +0 -0
- package/lib/rules/no-native-attributes.js +3 -2
- package/lib/rules/no-private-properties.d.ts +0 -0
- package/lib/rules/no-private-properties.js +0 -0
- package/lib/rules/no-property-change-update.d.ts +0 -0
- package/lib/rules/no-property-change-update.js +0 -0
- package/lib/rules/no-template-arrow.d.ts +0 -0
- package/lib/rules/no-template-arrow.js +0 -0
- package/lib/rules/no-template-bind.d.ts +0 -0
- package/lib/rules/no-template-bind.js +0 -0
- package/lib/rules/no-template-map.d.ts +0 -0
- package/lib/rules/no-template-map.js +0 -0
- package/lib/rules/no-this-assign-in-render.d.ts +0 -0
- package/lib/rules/no-this-assign-in-render.js +0 -0
- package/lib/rules/no-useless-template-literals.d.ts +0 -0
- package/lib/rules/no-useless-template-literals.js +0 -0
- package/lib/rules/no-value-attribute.d.ts +0 -0
- package/lib/rules/no-value-attribute.js +0 -0
- package/lib/rules/prefer-nothing.d.ts +0 -0
- package/lib/rules/prefer-nothing.js +0 -0
- package/lib/rules/prefer-static-styles.d.ts +0 -0
- package/lib/rules/prefer-static-styles.js +0 -0
- package/lib/rules/quoted-expressions.d.ts +0 -0
- package/lib/rules/quoted-expressions.js +0 -0
- package/lib/rules/value-after-constraints.d.ts +0 -0
- package/lib/rules/value-after-constraints.js +0 -0
- package/lib/template-analyzer.d.ts +0 -0
- package/lib/template-analyzer.js +0 -0
- package/lib/util.d.ts +4 -2
- package/lib/util.js +17 -9
- package/package.json +1 -1
package/README.md
CHANGED
|
File without changes
|
package/custom_types/espree.d.ts
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/lib/configs/all.d.ts
CHANGED
|
File without changes
|
package/lib/configs/all.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/lib/index.d.ts
CHANGED
|
File without changes
|
package/lib/index.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -29,6 +29,7 @@ const NATIVE_ATTRS = [
|
|
|
29
29
|
'lang',
|
|
30
30
|
'nonce',
|
|
31
31
|
'part',
|
|
32
|
+
'popover',
|
|
32
33
|
'role',
|
|
33
34
|
'slot',
|
|
34
35
|
'spellcheck',
|
|
@@ -62,10 +63,10 @@ const rule = {
|
|
|
62
63
|
return {
|
|
63
64
|
'ClassExpression,ClassDeclaration': (node) => {
|
|
64
65
|
const propertyMap = (0, util_1.getPropertyMap)(node);
|
|
65
|
-
for (const [prop] of propertyMap.entries()) {
|
|
66
|
+
for (const [prop, { key }] of propertyMap.entries()) {
|
|
66
67
|
if (NATIVE_ATTRS.includes(prop)) {
|
|
67
68
|
context.report({
|
|
68
|
-
node:
|
|
69
|
+
node: key,
|
|
69
70
|
messageId: 'noNativeAttributes',
|
|
70
71
|
data: { prop }
|
|
71
72
|
});
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/lib/template-analyzer.js
CHANGED
|
File without changes
|
package/lib/util.d.ts
CHANGED
|
@@ -14,16 +14,18 @@ export interface BabelProperty extends ESTree.MethodDefinition {
|
|
|
14
14
|
*/
|
|
15
15
|
export declare function getIdentifierName(node: ESTree.Node): string | undefined;
|
|
16
16
|
export interface PropertyMapEntry {
|
|
17
|
+
key: ESTree.Node;
|
|
17
18
|
expr: ESTree.ObjectExpression | null;
|
|
18
19
|
state: boolean;
|
|
19
20
|
attribute: boolean;
|
|
20
21
|
}
|
|
21
22
|
/**
|
|
22
23
|
* Extracts property metadata from a given property object
|
|
23
|
-
* @param {ESTree.
|
|
24
|
+
* @param {ESTree.Node} key Node to extract from
|
|
25
|
+
* @param {ESTree.ObjectExpression} value Node to extract from
|
|
24
26
|
* @return {object}
|
|
25
27
|
*/
|
|
26
|
-
export declare function extractPropertyEntry(
|
|
28
|
+
export declare function extractPropertyEntry(key: ESTree.Node, value: ESTree.ObjectExpression): PropertyMapEntry;
|
|
27
29
|
/**
|
|
28
30
|
* Get the properties object of an element class
|
|
29
31
|
*
|
package/lib/util.js
CHANGED
|
@@ -19,13 +19,14 @@ function getIdentifierName(node) {
|
|
|
19
19
|
exports.getIdentifierName = getIdentifierName;
|
|
20
20
|
/**
|
|
21
21
|
* Extracts property metadata from a given property object
|
|
22
|
-
* @param {ESTree.
|
|
22
|
+
* @param {ESTree.Node} key Node to extract from
|
|
23
|
+
* @param {ESTree.ObjectExpression} value Node to extract from
|
|
23
24
|
* @return {object}
|
|
24
25
|
*/
|
|
25
|
-
function extractPropertyEntry(
|
|
26
|
+
function extractPropertyEntry(key, value) {
|
|
26
27
|
let state = false;
|
|
27
28
|
let attribute = true;
|
|
28
|
-
for (const prop of
|
|
29
|
+
for (const prop of value.properties) {
|
|
29
30
|
if (prop.type === 'Property' &&
|
|
30
31
|
prop.key.type === 'Identifier' &&
|
|
31
32
|
prop.value.type === 'Literal') {
|
|
@@ -38,7 +39,8 @@ function extractPropertyEntry(node) {
|
|
|
38
39
|
}
|
|
39
40
|
}
|
|
40
41
|
return {
|
|
41
|
-
expr:
|
|
42
|
+
expr: value,
|
|
43
|
+
key,
|
|
42
44
|
state,
|
|
43
45
|
attribute
|
|
44
46
|
};
|
|
@@ -65,7 +67,7 @@ function getPropertyMap(node) {
|
|
|
65
67
|
if (prop.type === 'Property') {
|
|
66
68
|
const name = getIdentifierName(prop.key);
|
|
67
69
|
if (name && prop.value.type === 'ObjectExpression') {
|
|
68
|
-
result.set(name, extractPropertyEntry(prop.value));
|
|
70
|
+
result.set(name, extractPropertyEntry(prop.key, prop.value));
|
|
69
71
|
}
|
|
70
72
|
}
|
|
71
73
|
}
|
|
@@ -87,7 +89,7 @@ function getPropertyMap(node) {
|
|
|
87
89
|
if (prop.type === 'Property') {
|
|
88
90
|
const name = getIdentifierName(prop.key);
|
|
89
91
|
if (name && prop.value.type === 'ObjectExpression') {
|
|
90
|
-
result.set(name, extractPropertyEntry(prop.value));
|
|
92
|
+
result.set(name, extractPropertyEntry(prop.key, prop.value));
|
|
91
93
|
}
|
|
92
94
|
}
|
|
93
95
|
}
|
|
@@ -96,7 +98,8 @@ function getPropertyMap(node) {
|
|
|
96
98
|
if (member.type === 'MethodDefinition' ||
|
|
97
99
|
member.type === 'PropertyDefinition') {
|
|
98
100
|
const babelProp = member;
|
|
99
|
-
const
|
|
101
|
+
const key = member.key;
|
|
102
|
+
const memberName = getIdentifierName(key);
|
|
100
103
|
if (memberName && babelProp.decorators) {
|
|
101
104
|
for (const decorator of babelProp.decorators) {
|
|
102
105
|
if (decorator.expression.type === 'CallExpression' &&
|
|
@@ -105,7 +108,7 @@ function getPropertyMap(node) {
|
|
|
105
108
|
const dArg = decorator.expression.arguments[0];
|
|
106
109
|
if ((dArg === null || dArg === void 0 ? void 0 : dArg.type) === 'ObjectExpression') {
|
|
107
110
|
const state = internalDecorators.includes(decorator.expression.callee.name);
|
|
108
|
-
const entry = extractPropertyEntry(dArg);
|
|
111
|
+
const entry = extractPropertyEntry(key, dArg);
|
|
109
112
|
if (state) {
|
|
110
113
|
entry.state = true;
|
|
111
114
|
}
|
|
@@ -113,7 +116,12 @@ function getPropertyMap(node) {
|
|
|
113
116
|
}
|
|
114
117
|
else {
|
|
115
118
|
const state = internalDecorators.includes(decorator.expression.callee.name);
|
|
116
|
-
result.set(memberName, {
|
|
119
|
+
result.set(memberName, {
|
|
120
|
+
key,
|
|
121
|
+
expr: null,
|
|
122
|
+
state,
|
|
123
|
+
attribute: true
|
|
124
|
+
});
|
|
117
125
|
}
|
|
118
126
|
}
|
|
119
127
|
}
|