@zukhruf/eslint 0.6.8 → 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
@@ -213,6 +213,8 @@ import baseConfig from '../../eslint.config.mjs';
213
213
  export default [...react, ...baseConfig];
214
214
  ```
215
215
 
216
+ The configs apply only to TypeScript files, the files to which `zukhruf/base` gives type information. Thus they do not lint the `package.json` or the other files of a project.
217
+
216
218
  It gives these configs, in this order:
217
219
 
218
220
  1. `recommended` of `eslint-plugin-jsx-a11y-x`: the accessibility rules. This plugin is the maintained fork of `eslint-plugin-jsx-a11y`, and its peer range includes ESLint 10.
package/dist/react.d.ts CHANGED
@@ -1,4 +1,17 @@
1
- declare const _default: (import("eslint").Linter.Config<import("@eslint/core", { with: { "resolution-mode": "require" } }).RulesConfig> | {
1
+ declare const _default: ({
2
+ files: string[];
3
+ name?: string;
4
+ basePath?: string;
5
+ ignores?: string[];
6
+ language?: string;
7
+ languageOptions?: import("@eslint/core", { with: { "resolution-mode": "require" } }).LanguageOptions;
8
+ linterOptions?: import("@eslint/core", { with: { "resolution-mode": "require" } }).LinterOptionsConfig;
9
+ processor?: string | import("@eslint/core", { with: { "resolution-mode": "require" } }).Processor;
10
+ plugins?: Record<string, import("@eslint/core", { with: { "resolution-mode": "require" } }).Plugin>;
11
+ rules?: Partial<import("@eslint/core", { with: { "resolution-mode": "require" } }).RulesConfig>;
12
+ settings?: import("@eslint/core", { with: { "resolution-mode": "require" } }).SettingsConfig;
13
+ } | {
14
+ files: string[];
2
15
  name: string;
3
16
  plugins: {
4
17
  "jsx-a11y-x": {
@@ -631,6 +644,7 @@ declare const _default: (import("eslint").Linter.Config<import("@eslint/core", {
631
644
  };
632
645
  };
633
646
  } | {
647
+ files: string[];
634
648
  plugins: {
635
649
  react: any;
636
650
  };
@@ -1 +1 @@
1
- {"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../src/react.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASA,wBAKE"}
1
+ {"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../src/react.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgBA,wBAKsD"}
package/dist/react.js CHANGED
@@ -1,15 +1,20 @@
1
1
  import eslintReact from '@eslint-react/eslint-plugin';
2
2
  import jsxA11y from 'eslint-plugin-jsx-a11y-x';
3
3
  import reactHooks from 'eslint-plugin-react-hooks';
4
+ import { TYPESCRIPT } from "./files.js";
4
5
  // react is an optional peer, because its version changes the lint result:
5
6
  // @eslint-react/shared 5.28.8 (dist/index.js:184, :190-195) reads the version
6
7
  // of the react that resolves from the folder where ESLint runs. With the peer,
7
8
  // npm writes the lockfile edge, so @zukhruf/nx/lint hashes the React version
8
9
  // in a lint input on @zukhruf/eslint.
10
+ // The community configs set no `files`. @eslint-react's type-checked rules need the
11
+ // parser services that zukhruf/base/typed gives to TYPESCRIPT only, and they
12
+ // throw on any other file, for example a package.json under
13
+ // jsonc-eslint-parser.
9
14
  export default [
10
15
  jsxA11y.configs.recommended,
11
16
  reactHooks.configs.flat.recommended,
12
17
  eslintReact.configs['recommended-type-checked'],
13
18
  eslintReact.configs['disable-conflict-eslint-plugin-react-hooks'],
14
- ];
19
+ ].map((config) => ({ ...config, files: TYPESCRIPT }));
15
20
  //# sourceMappingURL=react.js.map
package/dist/react.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"react.js","sourceRoot":"","sources":["../src/react.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,6BAA6B,CAAC;AACtD,OAAO,OAAO,MAAM,0BAA0B,CAAC;AAC/C,OAAO,UAAU,MAAM,2BAA2B,CAAC;AAEnD,0EAA0E;AAC1E,8EAA8E;AAC9E,+EAA+E;AAC/E,6EAA6E;AAC7E,sCAAsC;AACtC,eAAe;IACb,OAAO,CAAC,OAAO,CAAC,WAAW;IAC3B,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW;IACnC,WAAW,CAAC,OAAO,CAAC,0BAA0B,CAAC;IAC/C,WAAW,CAAC,OAAO,CAAC,4CAA4C,CAAC;CAClE,CAAC"}
1
+ {"version":3,"file":"react.js","sourceRoot":"","sources":["../src/react.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,6BAA6B,CAAC;AACtD,OAAO,OAAO,MAAM,0BAA0B,CAAC;AAC/C,OAAO,UAAU,MAAM,2BAA2B,CAAC;AAEnD,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAExC,0EAA0E;AAC1E,8EAA8E;AAC9E,+EAA+E;AAC/E,6EAA6E;AAC7E,sCAAsC;AAEtC,oFAAoF;AACpF,6EAA6E;AAC7E,4DAA4D;AAC5D,uBAAuB;AACvB,eAAe;IACb,OAAO,CAAC,OAAO,CAAC,WAAW;IAC3B,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW;IACnC,WAAW,CAAC,OAAO,CAAC,0BAA0B,CAAC;IAC/C,WAAW,CAAC,OAAO,CAAC,4CAA4C,CAAC;CAClE,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC"}
@@ -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.8",
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.8"
65
+ "@zukhruf/testing": "^0.6.10"
66
66
  },
67
67
  "peerDependencies": {
68
68
  "@eslint-react/eslint-plugin": "^5.28.8",
@@ -74,7 +74,7 @@
74
74
  "eslint-plugin-functional": "^10.0.0",
75
75
  "eslint-plugin-import-x": "^4.16.0",
76
76
  "eslint-plugin-jsx-a11y-x": "^0.2.0",
77
- "eslint-plugin-react-hooks": "^5.0.0 || ^7.0.0",
77
+ "eslint-plugin-react-hooks": "^7.0.0",
78
78
  "jsonc-eslint-parser": "^2.4.0 || ^3.0.0",
79
79
  "react": "*",
80
80
  "typescript": ">=5.8.0 <6.1.0",