@plumeria/eslint-plugin 0.2.3 → 0.2.5

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,7 @@ module.exports = {
10
10
  meta: {
11
11
  type: 'problem',
12
12
  docs: {
13
- description: 'Disallow destructuring css.create and css.global',
13
+ description: 'Disallow destructuring css.props and css.global',
14
14
  recommended: true,
15
15
  },
16
16
  messages: {
@@ -30,7 +30,7 @@ module.exports = {
30
30
  node.init &&
31
31
  isCssIdentifier(node.init)
32
32
  ) {
33
- const forbiddenKeys = ['create', 'global'];
33
+ const forbiddenKeys = ['props', 'global'];
34
34
  const violated = node.id.properties.filter(
35
35
  (prop) =>
36
36
  prop.type === 'Property' &&
@@ -73,14 +73,17 @@ module.exports = {
73
73
  node.object.type === 'Identifier' &&
74
74
  node.property.type === 'Identifier'
75
75
  ) {
76
- const fullKey = `${node.object.name}.${node.property.name}`;
77
- referencedKeys.add(fullKey);
76
+ const normalKey = `${node.object.name}.${node.property.name}`;
77
+ const dollerKey = `${node.object.name}.$${node.property.name}`;
78
+ referencedKeys.add(normalKey);
79
+ referencedKeys.add(dollerKey);
78
80
 
79
81
  if (parserServices && checker) {
80
82
  const tsNode = parserServices.esTreeNodeToTSNodeMap.get(node);
81
83
  const symbol = checker.getSymbolAtLocation(tsNode);
82
84
  if (symbol) {
83
- referencedKeys.add(fullKey);
85
+ referencedKeys.add(normalKey);
86
+ referencedKeys.add(dollerKey);
84
87
  }
85
88
  }
86
89
  }
@@ -88,8 +91,12 @@ module.exports = {
88
91
  'Program:exit'() {
89
92
  definedKeys.forEach((keyMap, variableName) => {
90
93
  keyMap.forEach((keyNode, keyName) => {
91
- const fullKey = `${variableName}.${keyName}`;
92
- if (!referencedKeys.has(fullKey)) {
94
+ const normalKey = `${variableName}.${keyName}`;
95
+ const dollerKey = `${variableName}.$${keyName}`;
96
+ if (
97
+ !referencedKeys.has(normalKey) &&
98
+ !referencedKeys.has(dollerKey)
99
+ ) {
93
100
  context.report({
94
101
  node: keyNode,
95
102
  messageId: 'unusedKey',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plumeria/eslint-plugin",
3
- "version": "0.2.3",
3
+ "version": "0.2.5",
4
4
  "description": "Zero-runtime, expressive CSS-in-JS library for TypeScript.",
5
5
  "repository": "github:zss-in-js/plumeria",
6
6
  "license": "MIT",
package/readme.md CHANGED
@@ -23,7 +23,7 @@ export default [plumeria.flatConfigs.recommended];
23
23
 
24
24
  ### no-destructure
25
25
 
26
- Disallow destructuring `css.create` and `css.global`.
26
+ Disallow destructuring `css.props` and `css.global`.
27
27
 
28
28
  ### no-inner-call
29
29