@phsd/lint 0.1.1 → 0.1.2

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/dist/index.d.mts CHANGED
@@ -2676,12 +2676,12 @@ interface RuleOptions {
2676
2676
  */
2677
2677
  'radix'?: Linter.RuleEntry<Radix>;
2678
2678
  /**
2679
- * Disallows 'dangerouslySetInnerHTML'.
2679
+ * Disallows DOM elements from using 'dangerouslySetInnerHTML'.
2680
2680
  * @see https://eslint-react.xyz/docs/rules/dom-no-dangerously-set-innerhtml
2681
2681
  */
2682
2682
  'react-dom/no-dangerously-set-innerhtml'?: Linter.RuleEntry<[]>;
2683
2683
  /**
2684
- * Disallows 'dangerouslySetInnerHTML' and 'children' at the same time.
2684
+ * Disallows DOM elements from using 'dangerouslySetInnerHTML' and 'children' at the same time.
2685
2685
  * @see https://eslint-react.xyz/docs/rules/dom-no-dangerously-set-innerhtml-with-children
2686
2686
  */
2687
2687
  'react-dom/no-dangerously-set-innerhtml-with-children'?: Linter.RuleEntry<[]>;
@@ -2696,17 +2696,17 @@ interface RuleOptions {
2696
2696
  */
2697
2697
  'react-dom/no-flush-sync'?: Linter.RuleEntry<[]>;
2698
2698
  /**
2699
- * Replaces usage of 'ReactDom.hydrate()' with 'hydrateRoot()'.
2699
+ * Replaces usage of 'ReactDOM.hydrate()' with 'hydrateRoot()'.
2700
2700
  * @see https://eslint-react.xyz/docs/rules/dom-no-hydrate
2701
2701
  */
2702
2702
  'react-dom/no-hydrate'?: Linter.RuleEntry<[]>;
2703
2703
  /**
2704
- * Enforces explicit 'type' attribute for 'button' elements.
2704
+ * Enforces an explicit 'type' attribute for 'button' elements.
2705
2705
  * @see https://eslint-react.xyz/docs/rules/dom-no-missing-button-type
2706
2706
  */
2707
2707
  'react-dom/no-missing-button-type'?: Linter.RuleEntry<[]>;
2708
2708
  /**
2709
- * Enforces explicit 'sandbox' attribute for 'iframe' elements.
2709
+ * Enforces an explicit 'sandbox' attribute for 'iframe' elements.
2710
2710
  * @see https://eslint-react.xyz/docs/rules/dom-no-missing-iframe-sandbox
2711
2711
  */
2712
2712
  'react-dom/no-missing-iframe-sandbox'?: Linter.RuleEntry<[]>;
@@ -2716,7 +2716,7 @@ interface RuleOptions {
2716
2716
  */
2717
2717
  'react-dom/no-namespace'?: Linter.RuleEntry<[]>;
2718
2718
  /**
2719
- * Replaces usage of 'ReactDom.render()' with 'createRoot(node).render()'.
2719
+ * Replaces usage of 'ReactDOM.render()' with 'createRoot(node).render()'.
2720
2720
  * @see https://eslint-react.xyz/docs/rules/dom-no-render
2721
2721
  */
2722
2722
  'react-dom/no-render'?: Linter.RuleEntry<[]>;
@@ -2736,7 +2736,7 @@ interface RuleOptions {
2736
2736
  */
2737
2737
  'react-dom/no-string-style-prop'?: Linter.RuleEntry<[]>;
2738
2738
  /**
2739
- * Disallows unknown 'DOM' property.
2739
+ * Disallows unknown 'DOM' properties.
2740
2740
  * @see https://eslint-react.xyz/docs/rules/dom-no-unknown-property
2741
2741
  */
2742
2742
  'react-dom/no-unknown-property'?: Linter.RuleEntry<ReactDomNoUnknownProperty>;
@@ -2761,7 +2761,7 @@ interface RuleOptions {
2761
2761
  */
2762
2762
  'react-dom/no-void-elements-with-children'?: Linter.RuleEntry<[]>;
2763
2763
  /**
2764
- * Enforces React DOM is imported via a namespace import.
2764
+ * Enforces importing React DOM via a namespace import.
2765
2765
  * @see https://eslint-react.xyz/docs/rules/dom-prefer-namespace-import
2766
2766
  */
2767
2767
  'react-dom/prefer-namespace-import'?: Linter.RuleEntry<[]>;
@@ -2894,7 +2894,7 @@ interface RuleOptions {
2894
2894
  */
2895
2895
  'react-naming-convention/context-name'?: Linter.RuleEntry<[]>;
2896
2896
  /**
2897
- * Enforces consistent file naming conventions.
2897
+ * Enforces consistent file-naming conventions.
2898
2898
  * @see https://eslint-react.xyz/docs/rules/naming-convention-filename
2899
2899
  */
2900
2900
  'react-naming-convention/filename'?: Linter.RuleEntry<ReactNamingConventionFilename>;
@@ -2940,7 +2940,7 @@ interface RuleOptions {
2940
2940
  */
2941
2941
  'react/jsx-dollar'?: Linter.RuleEntry<[]>;
2942
2942
  /**
2943
- * Enforces that the 'key' prop is placed before the spread prop in JSX elements when using the new JSX transform (automatic runtime).
2943
+ * Enforces that the 'key' prop is placed before the spread prop in JSX elements when using the new JSX transform.
2944
2944
  * @see https://eslint-react.xyz/docs/rules/jsx-key-before-spread
2945
2945
  */
2946
2946
  'react/jsx-key-before-spread'?: Linter.RuleEntry<[]>;
@@ -16235,6 +16235,8 @@ interface OptionsStylistic {
16235
16235
  stylistic?: boolean | StylisticConfig;
16236
16236
  }
16237
16237
  interface OptionsTailwind extends OptionsOverrides, Partial<CalleeOption>, Partial<AttributeOption>, Partial<TagOption>, Partial<VariableOption> {
16238
+ allowClasses?: string[];
16239
+ forceRegisteredClasses?: boolean;
16238
16240
  tailwindConfig: string;
16239
16241
  }
16240
16242
  type OptionsTypescript = (OptionsOverrides & OptionsTypeScriptParserOptions) | (OptionsOverrides & OptionsTypeScriptWithTypes);
@@ -16354,7 +16356,7 @@ declare function sortTurboConfig(): TypedFlatConfigItem[];
16354
16356
  //#region src/configs/stylistic.d.ts
16355
16357
  declare const StylisticConfigDefaults: StylisticConfig;
16356
16358
  interface StylisticOptions extends OptionsOverrides, StylisticConfig {
16357
- lessOpinionated?: boolean;
16359
+ opinionated?: boolean;
16358
16360
  }
16359
16361
  declare function stylistic(options?: StylisticOptions): Promise<TypedFlatConfigItem[]>;
16360
16362
  //#endregion
package/dist/index.mjs CHANGED
@@ -225,18 +225,11 @@ const StylisticConfigDefaults = {
225
225
  semi: true
226
226
  };
227
227
  async function stylistic(options = {}) {
228
- const { indent, jsx: jsx$1, overrides = {}, quotes, semi } = {
228
+ const { indent, jsx: jsx$1, opinionated, overrides = {}, quotes, semi } = {
229
229
  ...StylisticConfigDefaults,
230
230
  ...options
231
231
  };
232
232
  const pluginStylistic = await interopDefault(import("@stylistic/eslint-plugin"));
233
- const config = pluginStylistic.configs.customize({
234
- indent,
235
- jsx: jsx$1,
236
- pluginName: "style",
237
- quotes,
238
- semi
239
- });
240
233
  return [{
241
234
  name: "phs/stylistic/rules",
242
235
  plugins: {
@@ -244,7 +237,13 @@ async function stylistic(options = {}) {
244
237
  style: pluginStylistic
245
238
  },
246
239
  rules: {
247
- ...config.rules,
240
+ ...opinionated ? pluginStylistic.configs.customize({
241
+ indent,
242
+ jsx: jsx$1,
243
+ pluginName: "style",
244
+ quotes,
245
+ semi
246
+ }).rules : {},
248
247
  "antfu/consistent-chaining": "error",
249
248
  "antfu/consistent-list-newline": "error",
250
249
  "antfu/if-newline": "error",
@@ -253,6 +252,11 @@ async function stylistic(options = {}) {
253
252
  after: true,
254
253
  before: false
255
254
  }],
255
+ "style/jsx-curly-brace-presence": ["error", {
256
+ children: "never",
257
+ propElementValues: "always",
258
+ props: "never"
259
+ }],
256
260
  "style/quote-props": ["error", "as-needed"],
257
261
  "style/yield-star-spacing": ["error", {
258
262
  after: true,
@@ -7888,7 +7892,7 @@ async function svelte(options = {}) {
7888
7892
  //#endregion
7889
7893
  //#region src/configs/tailwind.ts
7890
7894
  async function tailwind(options = {}) {
7891
- const { attributes = [], callees = [], overrides = {}, tags = [], tailwindConfig, variables = [] } = options;
7895
+ const { allowClasses, attributes = [], callees = [], forceRegisteredClasses = true, overrides = {}, tags = [], tailwindConfig, variables = [] } = options;
7892
7896
  const { getDefaultAttributes, getDefaultCallees, getDefaultTags, getDefaultVariables } = await import("eslint-plugin-better-tailwindcss/api/defaults");
7893
7897
  const defaults = {
7894
7898
  attributes: [...getDefaultAttributes(), ...attributes],
@@ -7925,11 +7929,12 @@ async function tailwind(options = {}) {
7925
7929
  allowMultiline: true,
7926
7930
  ...defaults
7927
7931
  }],
7928
- "tw/no-unregistered-classes": ["error", {
7929
- detectComponentClasses: false,
7932
+ ...forceRegisteredClasses ? { "tw/no-unregistered-classes": ["error", {
7933
+ detectComponentClasses: true,
7930
7934
  entryPoint: tailwindConfig,
7935
+ ignore: allowClasses ?? [],
7931
7936
  ...defaults
7932
- }],
7937
+ }] } : {},
7933
7938
  ...overrides
7934
7939
  },
7935
7940
  settings: { "better-tailwindcss": { entryPoint: tailwindConfig } }
@@ -8023,7 +8028,7 @@ async function typescript(options = {}) {
8023
8028
  ];
8024
8029
  const filesTypeAware = options.filesTypeAware ?? [GLOB_TS, GLOB_TSX];
8025
8030
  const ignoresTypeAware = options.ignoresTypeAware ?? [`${GLOB_MARKDOWN}/**`, GLOB_ASTRO_TS];
8026
- const tsconfigPath = options?.tsconfigPath ? options.tsconfigPath : void 0;
8031
+ const tsconfigPath = options.tsconfigPath;
8027
8032
  const isTypeAware = !!tsconfigPath;
8028
8033
  const typeAwareRules = {
8029
8034
  "dot-notation": "off",
@@ -8034,20 +8039,16 @@ async function typescript(options = {}) {
8034
8039
  "ts/no-for-in-array": "error",
8035
8040
  "ts/no-implied-eval": "error",
8036
8041
  "ts/no-misused-promises": "error",
8042
+ "ts/no-unnecessary-condition": "error",
8043
+ "ts/no-unnecessary-template-expression": "error",
8044
+ "ts/no-unnecessary-type-arguments": "error",
8037
8045
  "ts/no-unnecessary-type-assertion": "error",
8038
- "ts/no-unsafe-argument": "error",
8039
- "ts/no-unsafe-assignment": "error",
8040
- "ts/no-unsafe-call": "error",
8041
- "ts/no-unsafe-member-access": "error",
8042
- "ts/no-unsafe-return": "error",
8046
+ "ts/no-unnecessary-type-conversion": "error",
8047
+ "ts/prefer-optional-chain": "error",
8043
8048
  "ts/promise-function-async": "error",
8044
8049
  "ts/restrict-plus-operands": "error",
8045
8050
  "ts/restrict-template-expressions": "error",
8046
8051
  "ts/return-await": ["error", "in-try-catch"],
8047
- "ts/strict-boolean-expressions": ["error", {
8048
- allowNullableBoolean: true,
8049
- allowNullableObject: true
8050
- }],
8051
8052
  "ts/switch-exhaustiveness-check": "error",
8052
8053
  "ts/unbound-method": "error"
8053
8054
  };
@@ -8322,7 +8323,7 @@ function phs(options = {}, ...userConfigs) {
8322
8323
  overrides: getOverrides(options, "typescript"),
8323
8324
  type: options.type
8324
8325
  }));
8325
- if (stylisticOptions) configs$1.push(stylistic({
8326
+ configs$1.push(stylistic({
8326
8327
  ...stylisticOptions,
8327
8328
  overrides: getOverrides(options, "stylistic")
8328
8329
  }));
@@ -8361,7 +8362,7 @@ function phs(options = {}, ...userConfigs) {
8361
8362
  componentExts,
8362
8363
  overrides: getOverrides(options, "markdown")
8363
8364
  }));
8364
- if (options.formatters) configs$1.push(formatters(options.formatters || true, typeof stylisticOptions === "boolean" ? {} : stylisticOptions));
8365
+ if (options.formatters) configs$1.push(formatters(options.formatters, typeof stylisticOptions === "boolean" ? {} : stylisticOptions));
8365
8366
  if ("files" in options) throw new Error("The first argument should not contain the \"files\" property as the options are supposed to be global. Place it in the second or later config instead.");
8366
8367
  const fusedConfig = flatConfigProps.reduce((acc, key) => {
8367
8368
  if (key in options) acc[key] = options[key];
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@phsd/lint",
3
3
  "type": "module",
4
- "version": "0.1.1",
4
+ "version": "0.1.2",
5
5
  "exports": {
6
6
  "./eslint": {
7
7
  "types": "./dist/index.d.mts",
@@ -13,7 +13,7 @@
13
13
  "dist"
14
14
  ],
15
15
  "dependencies": {
16
- "@eslint-react/eslint-plugin": "^2.5.3",
16
+ "@eslint-react/eslint-plugin": "^2.5.4",
17
17
  "@eslint/js": "^9.39.2",
18
18
  "@eslint/markdown": "^7.5.1",
19
19
  "@stylistic/eslint-plugin": "5.2.3",
@@ -41,7 +41,7 @@
41
41
  "eslint-plugin-react-refresh": "^0.4.26",
42
42
  "eslint-plugin-regexp": "^2.10.0",
43
43
  "eslint-plugin-svelte": "^3.14.0",
44
- "eslint-plugin-toml": "^0.13.0",
44
+ "eslint-plugin-toml": "^0.13.1",
45
45
  "eslint-plugin-unicorn": "^62.0.0",
46
46
  "eslint-plugin-unused-imports": "^4.3.0",
47
47
  "eslint-plugin-yml": "^1.19.1",
@@ -52,20 +52,20 @@
52
52
  "prettier-plugin-svelte": "^3.4.1",
53
53
  "publint": "^0.3.16",
54
54
  "svelte-eslint-parser": "^1.4.1",
55
- "toml-eslint-parser": "^0.11.0",
55
+ "toml-eslint-parser": "^1.0.0",
56
56
  "typescript-eslint": "^8.52.0",
57
57
  "yaml-eslint-parser": "^1.3.2"
58
58
  },
59
59
  "devDependencies": {
60
- "@types/node": "^25.0.3",
60
+ "@types/node": "^25.0.5",
61
61
  "local-pkg": "^1.1.2",
62
62
  "prettier": "^3.7.4",
63
63
  "tailwindcss": "^4.1.18",
64
- "tsdown": "^0.18.4",
64
+ "tsdown": "^0.19.0",
65
65
  "tsx": "^4.21.0",
66
66
  "typescript": "^5.9.3",
67
67
  "@phsd/format": "0.0.4",
68
- "@phsd/typescript": "0.0.1"
68
+ "@phsd/typescript": "0.2.0"
69
69
  },
70
70
  "scripts": {
71
71
  "start": "pnpm dev",