@zukhruf/eslint 0.6.9 → 0.6.10

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 CHANGED
@@ -22,7 +22,7 @@ You need ESLint 9.30 or later.
22
22
  npm install --save-dev @zukhruf/eslint
23
23
  ```
24
24
 
25
- Its peers are `eslint`, `@eslint/js`, `typescript-eslint`, `typescript`, `eslint-plugin-import-x`, `eslint-plugin-functional` and `jsonc-eslint-parser`. `@zukhruf/eslint/nx` also needs `@nx/eslint-plugin`, `@zukhruf/eslint/react` needs `@nx/eslint-plugin`, `react` and the 4 plugins in [React](#react), and `@zukhruf/eslint/react-native` needs `eslint-plugin-es-x`. npm installs the peers for you. With `legacy-peer-deps=true` in `.npmrc`, npm does not, so add them to your devDependencies.
25
+ Its peers are `eslint`, `@eslint/js`, `typescript-eslint`, `typescript`, `eslint-plugin-import-x`, `eslint-plugin-functional` and `jsonc-eslint-parser`. `@zukhruf/eslint/nx` also needs `@nx/eslint-plugin`, `@zukhruf/eslint/react` needs `react` and the 3 plugins in [React](#react), and `@zukhruf/eslint/react-native` needs `eslint-plugin-es-x`. npm installs the peers for you. With `legacy-peer-deps=true` in `.npmrc`, npm does not, so add them to your devDependencies.
26
26
 
27
27
  ```js
28
28
  // eslint.config.mjs
@@ -1,12 +1,15 @@
1
1
  import type { Rule } from 'eslint';
2
2
  /**
3
- * A Tailwind class written in a string or a template literal. Both selector
4
- * forms use a regex: esquery's `*=` never matches a Literal's `value`.
3
+ * A Tailwind class written in a string or a template literal. The utility
4
+ * must start a class: at the start of the string, after a space, or after a
5
+ * variant's `:`, with an optional `!`. So `md:h-screen` matches, and a module
6
+ * name such as `expo-splash-screen` does not. Both selector forms use a regex:
7
+ * esquery's `*=` never matches a Literal's `value`.
5
8
  */
6
- export declare function classNameCheck({ description, pattern, message, }: {
9
+ export declare function classNameCheck({ description, utility, message, }: {
7
10
  description: string;
8
- /** esquery regex body, e.g. `h-screen` or `z-\\[`. */
9
- pattern: string;
11
+ /** esquery regex body of the utility with no variant, e.g. `h-screen`. */
12
+ utility: string;
10
13
  message: string;
11
14
  }): Rule.RuleModule;
12
15
  //# sourceMappingURL=class-name-check.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"class-name-check.d.ts","sourceRoot":"","sources":["../../src/tailwind/class-name-check.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAInC;;;GAGG;AACH,wBAAgB,cAAc,CAAC,EAC7B,WAAW,EACX,OAAO,EACP,OAAO,GACR,EAAE;IACD,WAAW,EAAE,MAAM,CAAC;IACpB,sDAAsD;IACtD,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CACjB,GAAG,IAAI,CAAC,UAAU,CASlB"}
1
+ {"version":3,"file":"class-name-check.d.ts","sourceRoot":"","sources":["../../src/tailwind/class-name-check.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAInC;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,EAC7B,WAAW,EACX,OAAO,EACP,OAAO,GACR,EAAE;IACD,WAAW,EAAE,MAAM,CAAC;IACpB,0EAA0E;IAC1E,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CACjB,GAAG,IAAI,CAAC,UAAU,CAUlB"}
@@ -1,9 +1,13 @@
1
1
  import { selectorRule } from "../authoring/selector-rule.js";
2
2
  /**
3
- * A Tailwind class written in a string or a template literal. Both selector
4
- * forms use a regex: esquery's `*=` never matches a Literal's `value`.
3
+ * A Tailwind class written in a string or a template literal. The utility
4
+ * must start a class: at the start of the string, after a space, or after a
5
+ * variant's `:`, with an optional `!`. So `md:h-screen` matches, and a module
6
+ * name such as `expo-splash-screen` does not. Both selector forms use a regex:
7
+ * esquery's `*=` never matches a Literal's `value`.
5
8
  */
6
- export function classNameCheck({ description, pattern, message, }) {
9
+ export function classNameCheck({ description, utility, message, }) {
10
+ const pattern = `(^|[\\s:])!?${utility}`;
7
11
  return selectorRule({
8
12
  description,
9
13
  message,
@@ -1 +1 @@
1
- {"version":3,"file":"class-name-check.js","sourceRoot":"","sources":["../../src/tailwind/class-name-check.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAE7D;;;GAGG;AACH,MAAM,UAAU,cAAc,CAAC,EAC7B,WAAW,EACX,OAAO,EACP,OAAO,GAMR;IACC,OAAO,YAAY,CAAC;QAClB,WAAW;QACX,OAAO;QACP,SAAS,EAAE;YACT,kBAAkB,OAAO,IAAI;YAC7B,8CAA8C,OAAO,IAAI;SAC1D;KACF,CAAC,CAAC;AACL,CAAC"}
1
+ {"version":3,"file":"class-name-check.js","sourceRoot":"","sources":["../../src/tailwind/class-name-check.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAE7D;;;;;;GAMG;AACH,MAAM,UAAU,cAAc,CAAC,EAC7B,WAAW,EACX,OAAO,EACP,OAAO,GAMR;IACC,MAAM,OAAO,GAAG,eAAe,OAAO,EAAE,CAAC;IACzC,OAAO,YAAY,CAAC;QAClB,WAAW;QACX,OAAO;QACP,SAAS,EAAE;YACT,kBAAkB,OAAO,IAAI;YAC7B,8CAA8C,OAAO,IAAI;SAC1D;KACF,CAAC,CAAC;AACL,CAAC"}
@@ -1,7 +1,7 @@
1
1
  import { classNameCheck } from "./class-name-check.js";
2
2
  export default classNameCheck({
3
3
  description: 'Disallow arbitrary z-[N] classes; stacking order comes from the theme tokens',
4
- pattern: 'z-\\[',
4
+ utility: '-?z-\\[',
5
5
  message: 'Use the z-index theme tokens instead of an arbitrary z-[N]. Add a new value to the @theme block when the scale lacks one.',
6
6
  });
7
7
  //# sourceMappingURL=no-arbitrary-z-index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"no-arbitrary-z-index.js","sourceRoot":"","sources":["../../src/tailwind/no-arbitrary-z-index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEvD,eAAe,cAAc,CAAC;IAC5B,WAAW,EACT,8EAA8E;IAChF,OAAO,EAAE,OAAO;IAChB,OAAO,EACL,2HAA2H;CAC9H,CAAC,CAAC"}
1
+ {"version":3,"file":"no-arbitrary-z-index.js","sourceRoot":"","sources":["../../src/tailwind/no-arbitrary-z-index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEvD,eAAe,cAAc,CAAC;IAC5B,WAAW,EACT,8EAA8E;IAChF,OAAO,EAAE,SAAS;IAClB,OAAO,EACL,2HAA2H;CAC9H,CAAC,CAAC"}
@@ -1,7 +1,7 @@
1
1
  import { classNameCheck } from "./class-name-check.js";
2
2
  export default classNameCheck({
3
3
  description: 'Disallow h-screen classes, which miss the mobile browser chrome; use the dvh units',
4
- pattern: 'h-screen',
4
+ utility: '(min-|max-)?h-screen',
5
5
  message: 'Use h-dvh/min-h-dvh/max-h-dvh instead of h-screen variants for correct mobile viewport behavior.',
6
6
  });
7
7
  //# sourceMappingURL=no-h-screen.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"no-h-screen.js","sourceRoot":"","sources":["../../src/tailwind/no-h-screen.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEvD,eAAe,cAAc,CAAC;IAC5B,WAAW,EACT,oFAAoF;IACtF,OAAO,EAAE,UAAU;IACnB,OAAO,EACL,kGAAkG;CACrG,CAAC,CAAC"}
1
+ {"version":3,"file":"no-h-screen.js","sourceRoot":"","sources":["../../src/tailwind/no-h-screen.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEvD,eAAe,cAAc,CAAC;IAC5B,WAAW,EACT,oFAAoF;IACtF,OAAO,EAAE,sBAAsB;IAC/B,OAAO,EACL,kGAAkG;CACrG,CAAC,CAAC"}
@@ -1,7 +1,7 @@
1
1
  import { classNameCheck } from "./class-name-check.js";
2
2
  export default classNameCheck({
3
3
  description: 'Disallow will-change classes',
4
- pattern: 'will-change',
4
+ utility: 'will-change',
5
5
  message: 'Avoid will-change in Tailwind classes. Only use within active CSS animations if absolutely necessary.',
6
6
  });
7
7
  //# sourceMappingURL=no-will-change.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zukhruf/eslint",
3
- "version": "0.6.9",
3
+ "version": "0.6.10",
4
4
  "description": "ESLint rules and configs shared across workspaces. Every check is its own named rule, so a repo's own config cannot silently erase it.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -62,7 +62,7 @@
62
62
  "ts-api-utils": "^2.5.0"
63
63
  },
64
64
  "devDependencies": {
65
- "@zukhruf/testing": "^0.6.9"
65
+ "@zukhruf/testing": "^0.6.10"
66
66
  },
67
67
  "peerDependencies": {
68
68
  "@eslint-react/eslint-plugin": "^5.28.8",