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.
Files changed (77) hide show
  1. package/README.md +0 -0
  2. package/custom_types/espree.d.ts +0 -0
  3. package/custom_types/requireindex.d.ts +0 -0
  4. package/docs/rules/attribute-value-entities.md +0 -0
  5. package/docs/rules/ban-attributes.md +0 -0
  6. package/docs/rules/binding-positions.md +0 -0
  7. package/docs/rules/no-duplicate-template-bindings.md +0 -0
  8. package/docs/rules/no-invalid-escape-sequences.md +0 -0
  9. package/docs/rules/no-invalid-html.md +0 -0
  10. package/docs/rules/no-legacy-imports.md +0 -0
  11. package/docs/rules/no-legacy-template-syntax.md +0 -0
  12. package/docs/rules/no-native-attributes.md +0 -0
  13. package/docs/rules/no-private-properties.md +0 -0
  14. package/docs/rules/no-property-change-update.md +0 -0
  15. package/docs/rules/no-template-arrow.md +0 -0
  16. package/docs/rules/no-template-bind.md +0 -0
  17. package/docs/rules/no-template-map.md +0 -0
  18. package/docs/rules/no-this-assign-in-render.md +0 -0
  19. package/docs/rules/no-useless-template-literals.md +0 -0
  20. package/docs/rules/no-value-attribute.md +0 -0
  21. package/docs/rules/prefer-nothing.md +0 -0
  22. package/docs/rules/prefer-static-styles.md +0 -0
  23. package/docs/rules/quoted-expressions.md +0 -0
  24. package/docs/rules/value-after-constraints.md +0 -0
  25. package/lib/configs/all.d.ts +0 -0
  26. package/lib/configs/all.js +0 -0
  27. package/lib/configs/recommended.d.ts +0 -0
  28. package/lib/configs/recommended.js +0 -0
  29. package/lib/index.d.ts +0 -0
  30. package/lib/index.js +0 -0
  31. package/lib/rules/attribute-value-entities.d.ts +0 -0
  32. package/lib/rules/attribute-value-entities.js +0 -0
  33. package/lib/rules/ban-attributes.d.ts +0 -0
  34. package/lib/rules/ban-attributes.js +0 -0
  35. package/lib/rules/binding-positions.d.ts +0 -0
  36. package/lib/rules/binding-positions.js +0 -0
  37. package/lib/rules/no-duplicate-template-bindings.d.ts +0 -0
  38. package/lib/rules/no-duplicate-template-bindings.js +0 -0
  39. package/lib/rules/no-invalid-escape-sequences.d.ts +0 -0
  40. package/lib/rules/no-invalid-escape-sequences.js +0 -0
  41. package/lib/rules/no-invalid-html.d.ts +0 -0
  42. package/lib/rules/no-invalid-html.js +0 -0
  43. package/lib/rules/no-legacy-imports.d.ts +0 -0
  44. package/lib/rules/no-legacy-imports.js +0 -0
  45. package/lib/rules/no-legacy-template-syntax.d.ts +0 -0
  46. package/lib/rules/no-legacy-template-syntax.js +0 -0
  47. package/lib/rules/no-native-attributes.d.ts +0 -0
  48. package/lib/rules/no-native-attributes.js +3 -2
  49. package/lib/rules/no-private-properties.d.ts +0 -0
  50. package/lib/rules/no-private-properties.js +0 -0
  51. package/lib/rules/no-property-change-update.d.ts +0 -0
  52. package/lib/rules/no-property-change-update.js +0 -0
  53. package/lib/rules/no-template-arrow.d.ts +0 -0
  54. package/lib/rules/no-template-arrow.js +0 -0
  55. package/lib/rules/no-template-bind.d.ts +0 -0
  56. package/lib/rules/no-template-bind.js +0 -0
  57. package/lib/rules/no-template-map.d.ts +0 -0
  58. package/lib/rules/no-template-map.js +0 -0
  59. package/lib/rules/no-this-assign-in-render.d.ts +0 -0
  60. package/lib/rules/no-this-assign-in-render.js +0 -0
  61. package/lib/rules/no-useless-template-literals.d.ts +0 -0
  62. package/lib/rules/no-useless-template-literals.js +0 -0
  63. package/lib/rules/no-value-attribute.d.ts +0 -0
  64. package/lib/rules/no-value-attribute.js +0 -0
  65. package/lib/rules/prefer-nothing.d.ts +0 -0
  66. package/lib/rules/prefer-nothing.js +0 -0
  67. package/lib/rules/prefer-static-styles.d.ts +0 -0
  68. package/lib/rules/prefer-static-styles.js +0 -0
  69. package/lib/rules/quoted-expressions.d.ts +0 -0
  70. package/lib/rules/quoted-expressions.js +0 -0
  71. package/lib/rules/value-after-constraints.d.ts +0 -0
  72. package/lib/rules/value-after-constraints.js +0 -0
  73. package/lib/template-analyzer.d.ts +0 -0
  74. package/lib/template-analyzer.js +0 -0
  75. package/lib/util.d.ts +4 -2
  76. package/lib/util.js +17 -9
  77. package/package.json +1 -1
package/README.md 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
File without changes
File without changes
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: 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
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.ObjectExpression} node Node to extract from
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(node: ESTree.ObjectExpression): PropertyMapEntry;
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.ObjectExpression} node Node to extract from
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(node) {
26
+ function extractPropertyEntry(key, value) {
26
27
  let state = false;
27
28
  let attribute = true;
28
- for (const prop of node.properties) {
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: node,
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 memberName = getIdentifierName(member.key);
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, { expr: null, state, attribute: true });
119
+ result.set(memberName, {
120
+ key,
121
+ expr: null,
122
+ state,
123
+ attribute: true
124
+ });
117
125
  }
118
126
  }
119
127
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-lit",
3
- "version": "1.8.0",
3
+ "version": "1.8.1",
4
4
  "description": "lit-html support for ESLint",
5
5
  "main": "lib/index.js",
6
6
  "files": [