@plumeria/eslint-plugin 0.1.0 → 0.1.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.
@@ -10,7 +10,8 @@ module.exports = {
10
10
  meta: {
11
11
  type: 'problem',
12
12
  docs: {
13
- description: 'An error occurs if a specific call is made within a function',
13
+ description:
14
+ 'An error occurs if a specific call is made within a function',
14
15
  recommended: true,
15
16
  },
16
17
  messages: {
@@ -18,11 +18,13 @@ module.exports = {
18
18
  meta: {
19
19
  type: 'problem',
20
20
  docs: {
21
- description: 'Detect unused object keys if they are not referenced anywhere',
21
+ description:
22
+ 'Detect unused object keys if they are not referenced anywhere',
22
23
  recommended: true,
23
24
  },
24
25
  messages: {
25
- unusedKey: "The key '{{ key }}' is defined but never referenced anywhere.",
26
+ unusedKey:
27
+ "The key '{{ key }}' is defined but never referenced anywhere.",
26
28
  },
27
29
  },
28
30
 
@@ -47,12 +49,20 @@ module.exports = {
47
49
  node.callee.property.name !== 'keyframes'
48
50
  ) {
49
51
  const arg = node.arguments[0];
50
- if (arg && arg.type === 'ObjectExpression' && node.parent.type === 'VariableDeclarator') {
52
+ if (
53
+ arg &&
54
+ arg.type === 'ObjectExpression' &&
55
+ node.parent.type === 'VariableDeclarator'
56
+ ) {
51
57
  const variableName = node.parent.id.name;
52
58
  const keyMap = new Map();
53
59
 
54
60
  arg.properties.forEach((prop) => {
55
- if (prop.key && prop.key.type === 'Identifier' && prop.value.type === 'ObjectExpression') {
61
+ if (
62
+ prop.key &&
63
+ prop.key.type === 'Identifier' &&
64
+ prop.value.type === 'ObjectExpression'
65
+ ) {
56
66
  keyMap.set(prop.key.name, prop.key);
57
67
  }
58
68
  });
@@ -63,7 +73,10 @@ module.exports = {
63
73
  },
64
74
  // `styles.header_main` の参照を記録
65
75
  MemberExpression(node) {
66
- if (node.object.type === 'Identifier' && node.property.type === 'Identifier') {
76
+ if (
77
+ node.object.type === 'Identifier' &&
78
+ node.property.type === 'Identifier'
79
+ ) {
67
80
  const fullKey = `${node.object.name}.${node.property.name}`;
68
81
  referencedKeys.add(fullKey);
69
82
 
@@ -27,7 +27,10 @@ function getPropertyIndex(property, isTopLevel = false) {
27
27
 
28
28
  if (
29
29
  isTopLevel &&
30
- (property.key.type !== 'Identifier' || name.startsWith('&') || name.startsWith(':') || name.startsWith('@'))
30
+ (property.key.type !== 'Identifier' ||
31
+ name.startsWith('&') ||
32
+ name.startsWith(':') ||
33
+ name.startsWith('@'))
31
34
  ) {
32
35
  return null;
33
36
  }
@@ -60,13 +63,15 @@ module.exports = {
60
63
  meta: {
61
64
  type: 'suggestion',
62
65
  docs: {
63
- description: 'Sort CSS properties keeping original order for specific keys',
66
+ description:
67
+ 'Sort CSS properties keeping original order for specific keys',
64
68
  recommended: true,
65
69
  },
66
70
  fixable: 'code',
67
71
  schema: [],
68
72
  messages: {
69
- sortProperties: 'Property "{{property}}" should be at position {{position}}',
73
+ sortProperties:
74
+ 'Property "{{property}}" should be at position {{position}}',
70
75
  },
71
76
  },
72
77
 
@@ -115,7 +120,7 @@ module.exports = {
115
120
 
116
121
  return fixer.replaceTextRange(
117
122
  [node.range[0] + 1, node.range[1] - 1],
118
- `${lineEnding}${newText}${lineEnding}`
123
+ `${lineEnding}${newText}${lineEnding}`,
119
124
  );
120
125
  },
121
126
  });